assetsのjs要求時にsaltを付けないように (#4358)

* No assets salt

* remove related code
This commit is contained in:
MeiMei 2019-02-24 10:38:00 +09:00 committed by syuilo
parent ac0390fec3
commit a6c5e62923
2 changed files with 1 additions and 10 deletions

View file

@ -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');

View file

@ -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
}); });
}); });