diff --git a/wasm/app-worker.js b/wasm/app-worker.js index 9f3e93a..97aecf3 100644 --- a/wasm/app-worker.js +++ b/wasm/app-worker.js @@ -1,8 +1,8 @@ -const cacheName = "app-" + "65fbac8be5b22d2841d916b839e784627375616c"; +const cacheName = "app-" + "f8ac4218bb548048986824403cd7e3fdb9206c6d"; const resourcesToCache = ["/","/app.css","/app.js","/manifest.webmanifest","/wasm_exec.js","/web/app.wasm","/web/css/alert.css","/web/img/logo.png","https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js","https://cdn.jsdelivr.net/npm/halfmoon@2.0.1/css/halfmoon.min.css","https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.11/clipboard.min.js","https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css","https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-twilight.min.css"]; self.addEventListener("install", (event) => { - console.log("installing app worker 65fbac8be5b22d2841d916b839e784627375616c"); + console.log("installing app worker f8ac4218bb548048986824403cd7e3fdb9206c6d"); event.waitUntil( caches @@ -28,7 +28,7 @@ self.addEventListener("activate", (event) => { ); }) ); - console.log("app worker 65fbac8be5b22d2841d916b839e784627375616c is activated"); + console.log("app worker f8ac4218bb548048986824403cd7e3fdb9206c6d is activated"); }); self.addEventListener("fetch", (event) => { diff --git a/wasm/app.go b/wasm/app.go index a9f77de..b154bea 100644 --- a/wasm/app.go +++ b/wasm/app.go @@ -60,32 +60,34 @@ func (h *crdView) buildError(err error) app.UI { } func (h *crdView) OnNav(ctx app.Context) { - if strings.Contains(ctx.Page().URL().String(), "share") { - u := ctx.Page().URL().Query().Get("url") - if u == "" { - h.preRenderErr = errors.New( - "url parameter has to be define in the following format: " + - "/share?url=https://example.com/crd.yaml") - - return - } + if !strings.Contains(ctx.Page().URL().String(), "share") { + return + } - if _, err := url.Parse(u); err != nil { - h.preRenderErr = fmt.Errorf("invald url provided in query: %w", err) + u := ctx.Page().URL().Query().Get("url") + if u == "" { + h.preRenderErr = errors.New( + "url parameter has to be define in the following format: " + + "/share?url=https://example.com/crd.yaml") - return - } + return + } - f := fetcher.NewFetcher(http.DefaultClient) - content, err := f.Fetch(u) - if err != nil { - h.preRenderErr = err + if _, err := url.Parse(u); err != nil { + h.preRenderErr = fmt.Errorf("invald url provided in query: %w", err) - return - } + return + } - h.content = content + f := fetcher.NewFetcher(http.DefaultClient) + content, err := f.Fetch(u) + if err != nil { + h.preRenderErr = err + + return } + + h.content = content } // The Render method is where the component appearance is defined. Here, a diff --git a/wasm/app.js b/wasm/app.js index c0fb22a..5532d24 100644 --- a/wasm/app.js +++ b/wasm/app.js @@ -13,7 +13,7 @@ var goappOnAppInstallChange = function () { goappAppInstallChangedBeforeWasmLoaded = true; }; -const goappEnv = {"GOAPP_INTERNAL_URLS":"null","GOAPP_ROOT_PREFIX":"/","GOAPP_STATIC_RESOURCES_URL":"/web","GOAPP_VERSION":"65fbac8be5b22d2841d916b839e784627375616c"}; +const goappEnv = {"GOAPP_INTERNAL_URLS":"null","GOAPP_ROOT_PREFIX":"/","GOAPP_STATIC_RESOURCES_URL":"/web","GOAPP_VERSION":"f8ac4218bb548048986824403cd7e3fdb9206c6d"}; const goappLoadingLabel = "{progress}%"; const goappWasmContentLength = ""; const goappWasmContentLengthHeader = ""; diff --git a/wasm/index.html b/wasm/index.html index e9bf769..a608866 100644 --- a/wasm/index.html +++ b/wasm/index.html @@ -1,5 +1,5 @@ - +
@@ -7,23 +7,23 @@ - +