Skip to content

Commit f40833d

Browse files
authored
Remove useless appVer from JS window.config (#21445)
The only usage of `appVer` was in serviceworker.js, while indeed it needs the asset version.
1 parent 0e58201 commit f40833d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

templates/base/head_script.tmpl

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly.
66
<script>
77
window.addEventListener('error', function(e) {window._globalHandlerErrors=window._globalHandlerErrors||[]; window._globalHandlerErrors.push(e);});
88
window.config = {
9-
appVer: '{{AppVer}}',
109
appUrl: '{{AppUrl}}',
1110
appSubUrl: '{{AppSubUrl}}',
1211
assetVersionEncoded: encodeURIComponent('{{AssetVersion}}'), // will be used in URL construction directly

web_src/js/features/serviceworker.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {joinPaths, parseUrl} from '../utils.js';
22

3-
const {useServiceWorker, assetUrlPrefix, appVer, assetVersionEncoded} = window.config;
3+
const {useServiceWorker, assetUrlPrefix, assetVersionEncoded} = window.config;
44
const cachePrefix = 'static-cache-v'; // actual version is set in the service worker script
55
const workerUrl = `${joinPaths(assetUrlPrefix, 'serviceworker.js')}?v=${assetVersionEncoded}`;
66

@@ -25,7 +25,7 @@ async function invalidateCache() {
2525
}
2626

2727
async function checkCacheValidity() {
28-
const cacheKey = appVer;
28+
const cacheKey = assetVersionEncoded;
2929
const storedCacheKey = localStorage.getItem('staticCacheKey');
3030

3131
// invalidate cache if it belongs to a different gitea version

0 commit comments

Comments
 (0)