This repository has been archived by the owner on Apr 17, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from vidar-team/dev
Dev
- Loading branch information
Showing
12 changed files
with
202 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ jobs: | |
steps: | ||
- uses: actions/checkout@master | ||
- name: compile and release | ||
uses: wuhan005/[email protected] | ||
uses: wuhan005/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN }} | ||
GOARCH: "386" | ||
|
@@ -18,7 +18,7 @@ jobs: | |
steps: | ||
- uses: actions/checkout@master | ||
- name: compile and release | ||
uses: wuhan005/[email protected] | ||
uses: wuhan005/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN }} | ||
GOARCH: amd64 | ||
|
@@ -29,7 +29,7 @@ jobs: | |
steps: | ||
- uses: actions/checkout@master | ||
- name: compile and release | ||
uses: wuhan005/[email protected] | ||
uses: wuhan005/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN }} | ||
GOARCH: arm | ||
|
@@ -40,7 +40,7 @@ jobs: | |
steps: | ||
- uses: actions/checkout@master | ||
- name: compile and release | ||
uses: wuhan005/[email protected] | ||
uses: wuhan005/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN }} | ||
GOARCH: arm64 | ||
|
@@ -51,7 +51,7 @@ jobs: | |
steps: | ||
- uses: actions/checkout@master | ||
- name: compile and release | ||
uses: wuhan005/[email protected] | ||
uses: wuhan005/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN }} | ||
GOARCH: "386" | ||
|
@@ -62,7 +62,7 @@ jobs: | |
steps: | ||
- uses: actions/checkout@master | ||
- name: compile and release | ||
uses: wuhan005/[email protected] | ||
uses: wuhan005/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN }} | ||
GOARCH: amd64 | ||
|
@@ -73,7 +73,7 @@ jobs: | |
steps: | ||
- uses: actions/checkout@master | ||
- name: compile and release | ||
uses: wuhan005/[email protected] | ||
uses: wuhan005/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN }} | ||
GOARCH: "386" | ||
|
@@ -84,7 +84,7 @@ jobs: | |
steps: | ||
- uses: actions/checkout@master | ||
- name: compile and release | ||
uses: wuhan005/[email protected] | ||
uses: wuhan005/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN }} | ||
GOARCH: amd64 | ||
|
@@ -95,7 +95,7 @@ jobs: | |
steps: | ||
- uses: actions/checkout@master | ||
- name: compile and release | ||
uses: wuhan005/[email protected] | ||
uses: wuhan005/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN }} | ||
GOARCH: arm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package main | ||
|
||
import ( | ||
frontend "github.com/vidar-team/Cardinal_frontend/dist" | ||
manager "github.com/vidar-team/Cardinal_manager_frontend/dist" | ||
"net/http" | ||
"strings" | ||
) | ||
|
||
// FrontendFS is the file system struct of challengers' frontend. | ||
type FrontendFS struct { | ||
frontendFS http.FileSystem | ||
managerFS http.FileSystem | ||
} | ||
|
||
func frontendFS() *FrontendFS { | ||
return &FrontendFS{ | ||
frontendFS: frontend.New(), | ||
managerFS: manager.New(), | ||
} | ||
} | ||
|
||
// Open: open file. | ||
func (f *FrontendFS) Open(name string) (http.File, error) { | ||
if strings.HasPrefix(name, "/manager") { | ||
return f.managerFS.Open(name) | ||
} | ||
return f.frontendFS.Open(name) | ||
} | ||
|
||
// Exists: check if the file exist. | ||
func (f *FrontendFS) Exists(prefix string, filePath string) bool { | ||
if strings.HasPrefix(filePath, "/manager") { | ||
if _, err := f.managerFS.Open(filePath); err != nil { | ||
return false | ||
} | ||
return true | ||
} | ||
if _, err := f.frontendFS.Open(filePath); err != nil { | ||
return false | ||
} | ||
return true | ||
} |
Oops, something went wrong.