mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-23 06:05:11 +00:00
assetsのjs要求時にsaltを付けないように (#4358)
* No assets salt * remove related code
This commit is contained in:
parent
ac0390fec3
commit
a6c5e62923
2 changed files with 1 additions and 10 deletions
|
@ -108,16 +108,11 @@
|
||||||
app = isMobile ? 'mobile' : 'desktop';
|
app = isMobile ? 'mobile' : 'desktop';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get salt query
|
|
||||||
const salt = localStorage.getItem('salt')
|
|
||||||
? `?salt=${localStorage.getItem('salt')}`
|
|
||||||
: '';
|
|
||||||
|
|
||||||
// Load an app script
|
// Load an app script
|
||||||
// Note: 'async' make it possible to load the script asyncly.
|
// Note: 'async' make it possible to load the script asyncly.
|
||||||
// 'defer' make it possible to run the script when the dom loaded.
|
// 'defer' make it possible to run the script when the dom loaded.
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.setAttribute('src', `/assets/${app}.${ver}.js${salt}`);
|
script.setAttribute('src', `/assets/${app}.${ver}.js`);
|
||||||
script.setAttribute('async', 'true');
|
script.setAttribute('async', 'true');
|
||||||
script.setAttribute('defer', 'true');
|
script.setAttribute('defer', 'true');
|
||||||
head.appendChild(script);
|
head.appendChild(script);
|
||||||
|
@ -155,9 +150,6 @@
|
||||||
|
|
||||||
localStorage.removeItem('locale');
|
localStorage.removeItem('locale');
|
||||||
|
|
||||||
// Random
|
|
||||||
localStorage.setItem('salt', Math.random().toString().substr(2, 8));
|
|
||||||
|
|
||||||
// Clear cache (service worker)
|
// Clear cache (service worker)
|
||||||
try {
|
try {
|
||||||
navigator.serviceWorker.controller.postMessage('clear');
|
navigator.serviceWorker.controller.postMessage('clear');
|
||||||
|
|
|
@ -55,7 +55,6 @@ router.get('/assets/*', async ctx => {
|
||||||
await send(ctx as any, ctx.path, {
|
await send(ctx as any, ctx.path, {
|
||||||
root: client,
|
root: client,
|
||||||
maxage: ms('7 days'),
|
maxage: ms('7 days'),
|
||||||
immutable: true
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue