From 469434dd9adb6457522b05eb2b16f58529042df3 Mon Sep 17 00:00:00 2001 From: tamaina Date: Thu, 23 Dec 2021 21:17:12 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=AD=E3=83=A3=E3=83=83=E3=82=B7=E3=83=A5?= =?UTF-8?q?=E5=AF=BE=E7=AD=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/server/web/index.ts | 2 +- packages/client/src/scripts/initialize-sw.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/server/web/index.ts b/packages/backend/src/server/web/index.ts index 75735badb5..105bc3659e 100644 --- a/packages/backend/src/server/web/index.ts +++ b/packages/backend/src/server/web/index.ts @@ -99,7 +99,7 @@ router.get('/twemoji/(.*)', async ctx => { }); // ServiceWorker -router.get('/sw.js', async ctx => { +router.get(`/sw.${config.version}.js`, async ctx => { await send(ctx as any, `/sw.js`, { root: swAssets, }); diff --git a/packages/client/src/scripts/initialize-sw.ts b/packages/client/src/scripts/initialize-sw.ts index b7057f84b3..4f435c1b91 100644 --- a/packages/client/src/scripts/initialize-sw.ts +++ b/packages/client/src/scripts/initialize-sw.ts @@ -1,14 +1,14 @@ import { instance } from '@/instance'; import { $i } from '@/account'; import { api } from '@/os'; -import { lang } from '@/config'; +import { lang, version } from '@/config'; export async function initializeSw() { if (instance.swPublickey && ('serviceWorker' in navigator) && ('PushManager' in window) && $i && $i.token) { - navigator.serviceWorker.register(`/sw.js`, { scope: '/', type: 'classic' }); + navigator.serviceWorker.register(`/sw.${version}.js`, { scope: '/', type: 'classic' }); navigator.serviceWorker.ready.then(registration => { registration.active?.postMessage({