URLをsw.jsに戻す
This commit is contained in:
parent
6e19ca8b22
commit
312f46378d
|
@ -101,9 +101,10 @@ router.get('/twemoji/(.*)', async ctx => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// ServiceWorker
|
// ServiceWorker
|
||||||
router.get(`/sw.${config.version}.js`, async ctx => {
|
router.get(`/sw.js`, async ctx => {
|
||||||
await send(ctx as any, `/sw.js`, {
|
await send(ctx as any, `/sw.js`, {
|
||||||
root: swAssets,
|
root: swAssets,
|
||||||
|
maxage: ms('10 minutes'),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { instance } from '@/instance';
|
import { instance } from '@/instance';
|
||||||
import { $i } from '@/account';
|
import { $i } from '@/account';
|
||||||
import { api } from '@/os';
|
import { api } from '@/os';
|
||||||
import { lang, version } from '@/config';
|
import { lang } from '@/config';
|
||||||
|
|
||||||
export async function initializeSw() {
|
export async function initializeSw() {
|
||||||
if (!('serviceWorker' in navigator)) return;
|
if (!('serviceWorker' in navigator)) return;
|
||||||
|
|
||||||
navigator.serviceWorker.register(`/sw.${version}.js`, { scope: '/', type: 'classic' });
|
navigator.serviceWorker.register(`/sw.js`, { scope: '/', type: 'classic' });
|
||||||
navigator.serviceWorker.ready.then(registration => {
|
navigator.serviceWorker.ready.then(registration => {
|
||||||
registration.active?.postMessage({
|
registration.active?.postMessage({
|
||||||
msg: 'initialize',
|
msg: 'initialize',
|
||||||
|
|
Loading…
Reference in New Issue