From f016a9de0eae545c46ab54d76929b7357361a0ce Mon Sep 17 00:00:00 2001 From: Gergely Brautigam <182850+Skarlso@users.noreply.github.com> Date: Sat, 25 May 2024 16:12:47 +0200 Subject: [PATCH] tiny refactor --- wasm/app-worker.js | 6 +++--- wasm/app.go | 42 ++++++++++++++++++++++-------------------- wasm/app.js | 2 +- wasm/index.html | 18 +++++++++--------- wasm/web/app.wasm | Bin 28358139 -> 28358161 bytes 5 files changed, 35 insertions(+), 33 deletions(-) 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 @@ - + Preview CRDs - + - - - + + + - + - + @@ -61,7 +61,7 @@
diff --git a/wasm/web/app.wasm b/wasm/web/app.wasm index e5dd42514c23846ddbf4e6980bf990a35bc5b31f..d6c9bb4ae4bb8c0c67cb66f970d8601bcb9d4309 100755 GIT binary patch delta 3973 zcmZYB30PF+8o=>+zd1952#&dwTAEl^N(90%h?Q$@xnbm1xnM|?ikRinhNfZVhAS$< z!BSCMz!kTITuaLgD!W-q_j)Un($ccjy7&JM!_$4b^8EhaIUnyi%p92K@#?vK;R~zx zh3B+M?muR1^0>$2d-?kLx(}PsFExGK)Sl74bYJX~2`R}#`w#SW8$Yy1kF?(Y=tvcRhgHZ&0c;dvHD1H(ScA1#ha#-U25iI|coT2o zZ4{#fo3I&Muoc^|9i`ZTo!Eul*n@Yl7iB2NyV!^QIDmsVgu{3b@8bxL;sbn$WB3Ti z@i8h;iBIq;KEnxoj(^|_oWz&-3a4-yRrnhJ#J_L`|He1?7T@74zQ;LK;|KhR^SFSY z@G~yr5`Mw2xQyTMJFb+Tt-P9cB{!}5mO-U!j$O+N$(_-$YqQ)xCQfRU+p^raXLmVq z4S(QI{AW&=6S4prqj731jZ5R!cr+oJI+{>TT}_xKTvJcu)zsHqr)i*RsA;5Wthruu zgQkh5siv9cM$Ju{=2F(>L<{lmydyTv9}}05k{A~sn-DW5&KDQou3cgUY5HphXp%GoH4kW#H4kbAX$EVCXohNrX&%x%ta(H;Tr)y5QZq`E zq8Y7uRFkS1qe;^|rb*X4u6aT;Rx?gBUX!7jpvlxs)I6z~q2n&uhJ zvzq5L&ud=LWND^rW@uj2%+$=%yd-6LIoUEKLavov+>|YiWnh%tWun}d!inU%n+F+3>u3w%SgO&IPMgS2@~LCb=rfrWXqJSauMUy zZ-h#+3^sN6YGjPdaQ|a2bJXP-E}1gHWSYmUbP=nL$H_!1xl$?ScNqDNUe+U1CQ>e8 zneyj3%lrW&*XUL71Ks-N@_a2Whr=gM(}XJ;h$-u{HCt|wtXcX_E^(WSftw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