diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a5cc12e..506de87 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,6 +20,21 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - + name: Include web UI + uses: robinraju/release-downloader@v1.3 + with: + repository: filecoin-project/saturn-l2-webui + # Update tag to deploy new web UI. + tag: v0.0.6 + fileName: saturn-l2-webui.tar.gz + out-file-path: resources/webui + - + name: Unpack web UI archive + run: | + cd resources/webui + tar zxvf saturn-l2-webui.tar.gz + rm saturn-l2-webui.tar.gz - name: Fetch all tags run: git fetch --force --tags diff --git a/.gitignore b/.gitignore index 5800750..25dfd5a 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ # vendor/ dist/ +resources/webui diff --git a/main/main.go b/main/main.go index 536de2d..0a79603 100644 --- a/main/main.go +++ b/main/main.go @@ -6,8 +6,11 @@ import ( "net/http" "os" "strconv" + "strings" "github.com/gorilla/mux" + + "github.com/filecoin-project/saturn-l2/resources" ) func main() { @@ -24,7 +27,7 @@ func main() { } m := mux.NewRouter() - m.Handle("/webui", http.HandlerFunc(webuiIndex)) + m.PathPrefix("/webui").Handler(http.HandlerFunc(webuiHandler)) srv := &http.Server{ Handler: m, } @@ -48,8 +51,27 @@ func main() { } } -func webuiIndex(w http.ResponseWriter, req *http.Request) { - w.WriteHeader(200) - w.Header().Set("Content-Type", "text/html; charset=utf-8") - fmt.Fprint(w, "