Skip to content

Commit

Permalink
shorten service-worker filename to sw.js
Browse files Browse the repository at this point in the history
Signed-off-by: Mel <[email protected]>
  • Loading branch information
melnary committed Dec 9, 2024
1 parent 7ec21b0 commit 46000f6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/http/routes/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions internal/view/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@
<script type="module">
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('assets/js/pwabuilder-sw.js', {scope: '/'});
navigator.serviceWorker.register('assets/js/sw.js', {scope: '/'});
});
}
</script>
<script type="module">
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);
</script>
</body>
Expand Down
4 changes: 2 additions & 2 deletions internal/view/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,15 @@
<script type="module">
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('assets/js/pwabuilder-sw.js', {scope: '/'});
navigator.serviceWorker.register('assets/js/sw.js', {scope: '/'});
});
}
</script>
<script type="module">
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);
</script>
</body>
Expand Down

0 comments on commit 46000f6

Please sign in to comment.