FIX: Service Worker URL was broken
Behavior was changed in #9966, which made the URL be relative. If the user landed in a topic, for example, the browser was given a service worker URL under that specific topic URL, which was a 404. Fixes broken PWA install and broken push notifications
This commit is contained in:
parent
a23d31e4d6
commit
f00e5515e4
|
@ -1,5 +1,5 @@
|
|||
import { isAbsoluteURL } from "discourse-common/lib/get-url";
|
||||
import getURL from "discourse-common/lib/get-url";
|
||||
import getAbsoluteURL from "discourse-common/lib/get-url";
|
||||
|
||||
export default {
|
||||
name: "register-service-worker",
|
||||
|
@ -33,7 +33,7 @@ export default {
|
|||
});
|
||||
|
||||
navigator.serviceWorker
|
||||
.register(`${getURL(Discourse.ServiceWorkerURL)}`)
|
||||
.register(getAbsoluteURL(`/${Discourse.ServiceWorkerURL}`))
|
||||
.catch(error => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(`Failed to register Service Worker: ${error}`);
|
||||
|
|
Loading…
Reference in New Issue