From 46000f69805d4de0cb5d71246cbccba0eb0f40ea Mon Sep 17 00:00:00 2001 From: Mel Date: Tue, 10 Dec 2024 00:13:40 +0100 Subject: [PATCH] shorten service-worker filename to `sw.js` Signed-off-by: Mel --- internal/http/routes/frontend.go | 2 +- internal/view/assets/js/{pwabuilder-sw.js => sw.js} | 0 internal/view/content.html | 4 ++-- internal/view/index.html | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) rename internal/view/assets/js/{pwabuilder-sw.js => sw.js} (100%) diff --git a/internal/http/routes/frontend.go b/internal/http/routes/frontend.go index f1a196bfe..50a628b20 100644 --- a/internal/http/routes/frontend.go +++ b/internal/http/routes/frontend.go @@ -60,7 +60,7 @@ func (r *FrontendRoutes) Setup(e *gin.Engine) { func serviceWorkerMiddleware(cfg *config.Config) gin.HandlerFunc { return func(ctx *gin.Context) { - if ctx.Request.URL.Path == "/assets/js/pwabuilder-sw.js" { + if ctx.Request.URL.Path == "/assets/js/sw.js" { ctx.Header("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0") ctx.Header("Service-Worker-Allowed", cfg.Http.RootPath) } diff --git a/internal/view/assets/js/pwabuilder-sw.js b/internal/view/assets/js/sw.js similarity index 100% rename from internal/view/assets/js/pwabuilder-sw.js rename to internal/view/assets/js/sw.js diff --git a/internal/view/content.html b/internal/view/content.html index a724977d2..339a164b8 100644 --- a/internal/view/content.html +++ b/internal/view/content.html @@ -98,7 +98,7 @@ @@ -106,7 +106,7 @@ import 'https://cdn.jsdelivr.net/npm/@pwabuilder/pwaupdate'; const el = document.createElement('pwa-update'); - el.setAttribute('swpath', 'assets/js/pwabuilder-sw.js'); + el.setAttribute('swpath', 'assets/js/sw.js'); document.body.appendChild(el); diff --git a/internal/view/index.html b/internal/view/index.html index d2a4f9cd0..fdc62004b 100644 --- a/internal/view/index.html +++ b/internal/view/index.html @@ -237,7 +237,7 @@ @@ -245,7 +245,7 @@ import 'https://cdn.jsdelivr.net/npm/@pwabuilder/pwaupdate'; const el = document.createElement('pwa-update'); - el.setAttribute('swpath', 'assets/js/pwabuilder-sw.js'); + el.setAttribute('swpath', 'assets/js/sw.js'); document.body.appendChild(el);