mirror of
https://github.com/go-gitea/gitea
synced 2024-11-25 04:52:47 +01:00
Remove useless appVer
from JS window.config
(#21445)
The only usage of `appVer` was in serviceworker.js, while indeed it needs the asset version.
This commit is contained in:
parent
0e58201d1a
commit
f40833d1f0
2 changed files with 2 additions and 3 deletions
|
@ -6,7 +6,6 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly.
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('error', function(e) {window._globalHandlerErrors=window._globalHandlerErrors||[]; window._globalHandlerErrors.push(e);});
|
window.addEventListener('error', function(e) {window._globalHandlerErrors=window._globalHandlerErrors||[]; window._globalHandlerErrors.push(e);});
|
||||||
window.config = {
|
window.config = {
|
||||||
appVer: '{{AppVer}}',
|
|
||||||
appUrl: '{{AppUrl}}',
|
appUrl: '{{AppUrl}}',
|
||||||
appSubUrl: '{{AppSubUrl}}',
|
appSubUrl: '{{AppSubUrl}}',
|
||||||
assetVersionEncoded: encodeURIComponent('{{AssetVersion}}'), // will be used in URL construction directly
|
assetVersionEncoded: encodeURIComponent('{{AssetVersion}}'), // will be used in URL construction directly
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {joinPaths, parseUrl} from '../utils.js';
|
import {joinPaths, parseUrl} from '../utils.js';
|
||||||
|
|
||||||
const {useServiceWorker, assetUrlPrefix, appVer, assetVersionEncoded} = window.config;
|
const {useServiceWorker, assetUrlPrefix, assetVersionEncoded} = window.config;
|
||||||
const cachePrefix = 'static-cache-v'; // actual version is set in the service worker script
|
const cachePrefix = 'static-cache-v'; // actual version is set in the service worker script
|
||||||
const workerUrl = `${joinPaths(assetUrlPrefix, 'serviceworker.js')}?v=${assetVersionEncoded}`;
|
const workerUrl = `${joinPaths(assetUrlPrefix, 'serviceworker.js')}?v=${assetVersionEncoded}`;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ async function invalidateCache() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkCacheValidity() {
|
async function checkCacheValidity() {
|
||||||
const cacheKey = appVer;
|
const cacheKey = assetVersionEncoded;
|
||||||
const storedCacheKey = localStorage.getItem('staticCacheKey');
|
const storedCacheKey = localStorage.getItem('staticCacheKey');
|
||||||
|
|
||||||
// invalidate cache if it belongs to a different gitea version
|
// invalidate cache if it belongs to a different gitea version
|
||||||
|
|
Loading…
Reference in a new issue