Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useless appVer from JS window.config #21445

Merged
merged 1 commit into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion templates/base/head_script.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly.
<script>
window.addEventListener('error', function(e) {window._globalHandlerErrors=window._globalHandlerErrors||[]; window._globalHandlerErrors.push(e);});
window.config = {
appVer: '{{AppVer}}',
appUrl: '{{AppUrl}}',
appSubUrl: '{{AppSubUrl}}',
assetVersionEncoded: encodeURIComponent('{{AssetVersion}}'), // will be used in URL construction directly
Expand Down
4 changes: 2 additions & 2 deletions web_src/js/features/serviceworker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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 workerUrl = `${joinPaths(assetUrlPrefix, 'serviceworker.js')}?v=${assetVersionEncoded}`;

Expand All @@ -25,7 +25,7 @@ async function invalidateCache() {
}

async function checkCacheValidity() {
const cacheKey = appVer;
const cacheKey = assetVersionEncoded;
const storedCacheKey = localStorage.getItem('staticCacheKey');

// invalidate cache if it belongs to a different gitea version
Expand Down