commit 0d21f3581ec73a68ebf34da01e83b0e1fc07d67d
parent d2411c5d37701f38b346a8f462c912dbbea22e74
Author: Hunter
Date:   Wed, 29 Apr 2026 21:14:19 -0400

make URLs absolute relative to service worker location

Diffstat:
Mbuild.py | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/build.py b/build.py @@ -209,10 +209,9 @@ self.addEventListener('install', (event) => {{ console.log('Service Worker installing...', 'Base path:', basePath); event.waitUntil( caches.open(CACHE_NAME).then(cache => {{ - // Make URLs absolute relative to service worker location const absoluteUrls = STATIC_FILES.map(url => {{ - if (url === './') return basePath; - return new URL(url, basePath + 'index.html').href; + if (url === './') return new URL(basePath, self.location.href).href; + return new URL(url, new URL(basePath, self.location.href)).href; }}); console.log('Caching', absoluteUrls.length, 'static resources');