fix: #9127, scope service worker to relative_path for the forum #9239
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a
Service-Worker-Allowed
header set to forum url (nconf.get('relative_path')
) onassets/src/service-worker.js
URL and usesscope
option during its registration to ensure the service worker is correctly scoped to the entire forum and only the forum.This is the implementation of what I described in #9127 (comment) - sorry it took so long, had some other stuff to do and I was actually kinda afraid I'll waste my time as someone will do it a bit faster than me (well, I had it happen here once with a pretty simple fix that I wasn't fast enough to make into a PR before one of the maintainers managed it and here I basically described all changes :)
Should fix #9127 and this issue was also mentioned in #9193. I found it thanks to this thread on the community forum
I can confirm that Chrome now asks user to install the page (on the desktop it's in the right part of the address bar) with these changes, when it didn't do so before. Haven't tested with other/mobile browsers though, but I'd be very surprised if it was different.