Implement separate installable PWAs for workspaces using Service Worker scopes - #217
Conversation
…er scopes and manifest interception - Removed dynamic Blob URL manifest generation in favor of a robust, highly compatible relative / scoped manifest.json fetch interception mechanism. - Modified sw.js registration in _layouts/default.html to register distinct directory scopes (e.g. /workspaces/maze/) for individual workspaces, passing metadata as query parameters in sw.js registration URL. - Added self.skipWaiting() and self.clients.claim() in sw.js to ensure immediate Service Worker activation and document control upon registration. - Added fetch listener interception in sw.js for any in-scope 'manifest.json' requests to dynamically return the customized JSON manifest configuration, configuring 'start_url' specifically for that workspace. - Updated Playwright test tests/pwa_workspace.spec.js to poll for service worker activation, reload the document under SW control, and fetch/validate the custom intercepted manifest JSON payload. - Fixed a bug where a missing /favicon.ico file caused Service Worker installation failures on clean contexts by removing /favicon.ico from criticalUrls in sw.js. Co-authored-by: brettfxio <105930054+brettfxio@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
…tion on start page - Removed old dynamic Blob URL manifest generation in favor of relative manifest.json and dynamic Service Worker interception. - Added scope-based Service Worker registration inside workspaces, passing title, description, and icon as query parameters. - Intercepted relative manifest.json fetches inside sw.js to dynamically return custom PWA manifests. - Added '&fullscreen=true' to the custom manifest start_url to directly launch PWAs in presentation/fullscreen mode. - Updated Playwright tests to fully poll and reload for Service Worker activation, ensuring smooth verification of intercepted dynamic manifest responses. Co-authored-by: brettfxio <105930054+brettfxio@users.noreply.github.com>
…fixed corrupted workspace data - Removed old dynamic Blob URL manifest generation in favor of highly compatible relative manifest.json Service Worker interception. - Added scope-based Service Worker registration inside workspaces, passing title, description, and icon as query parameters. - Intercepted manifest.json fetches inside sw.js to dynamically return custom PWA manifests. - Added '&fullscreen=true' to the custom manifest start_url to directly launch PWAs in presentation/fullscreen mode. - Programmatically reconstructed, balanced, and validated the corrupted `maze.md` workspace data on disk to resolve pre-existing loading errors. - Updated Playwright tests to fully poll and reload for Service Worker activation, ensuring smooth verification of intercepted dynamic manifest responses. Co-authored-by: brettfxio <105930054+brettfxio@users.noreply.github.com>
This PR implements separate, standalone installable PWAs for each individual workspace item using Service Worker directory scoping and relative manifest interception.
Instead of generating local Blob URL manifests which face compatibility issues in modern mobile/desktop PWA engines, this approach dynamically registers '/sw.js' with the exact workspace directory scope (e.g., '/workspaces/maze/') and query parameters containing page metadata (title, description, icon). The Service Worker intercepts all requests to 'manifest.json' within its scope and responds dynamically with the customized JSON configuration, setting 'start_url' to target that workspace path with app mode parameters.
Additionally:
/favicon.icoincriticalUrlscaused installation to fail on clean environments.PR created automatically by Jules for task 6151841140893464052 started by @brettfxio