diff options
author | zeripath <art27@cantab.net> | 2021-06-08 18:46:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-08 18:46:13 +0100 |
commit | e03a91a48ef7fb716cc7c8bfb411ca8f332dcfe5 (patch) | |
tree | 31d0c4d85426eca4f25a55fd7f905a9fa99bc500 /web_src | |
parent | 44f8c812ec8bfc13c6cc17d3bda339825a31eb72 (diff) | |
download | gitea-e03a91a48ef7fb716cc7c8bfb411ca8f332dcfe5.tar.gz gitea-e03a91a48ef7fb716cc7c8bfb411ca8f332dcfe5.zip |
Remove spurious AppSubUrl in serviceworker request. (#16047)
There is another spurious AppSubUrl placement in the serviceworker registration.
This PR removes it.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'web_src')
-rw-r--r-- | web_src/js/features/serviceworker.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/web_src/js/features/serviceworker.js b/web_src/js/features/serviceworker.js index e92d21cde9..37cd15c5bd 100644 --- a/web_src/js/features/serviceworker.js +++ b/web_src/js/features/serviceworker.js @@ -1,6 +1,6 @@ import {joinPaths} from '../utils.js'; -const {UseServiceWorker, AppSubUrl, AssetUrlPrefix, AppVer} = window.config; +const {UseServiceWorker, AssetUrlPrefix, AppVer} = window.config; const cachePrefix = 'static-cache-v'; // actual version is set in the service worker script const workerAssetPath = joinPaths(AssetUrlPrefix, 'serviceworker.js'); @@ -41,10 +41,9 @@ export default async function initServiceWorker() { // unregister all service workers where scriptURL does not match the current one await unregisterOtherWorkers(); try { - // normally we'd serve the service worker as a static asset from AssetUrlPrefix but - // the spec strictly requires it to be same-origin so it has to be AppSubUrl to work + // the spec strictly requires it to be same-origin so the AssetUrlPrefix should contain AppSubUrl await checkCacheValidity(); - await navigator.serviceWorker.register(joinPaths(AppSubUrl, workerAssetPath)); + await navigator.serviceWorker.register(workerAssetPath); } catch (err) { console.error(err); await invalidateCache(); |