Resurrect Service Worker (#7108)
* Resolve #7106 * fix lint * fix lint * save lang in idb * fix lint * fix * cache locale file * fix lint * ✌️ * wip * fix [wip] * fix [wip] Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
@ -33,9 +33,8 @@
|
||||
}
|
||||
|
||||
const res = await fetch(`/assets/locales/${lang}.${v}.json`);
|
||||
const json = await res.json();
|
||||
localStorage.setItem('lang', lang);
|
||||
localStorage.setItem('locale', JSON.stringify(json));
|
||||
localStorage.setItem('locale', await res.text());
|
||||
}
|
||||
//#endregion
|
||||
|
||||
|
@ -73,8 +73,8 @@ router.get('/apple-touch-icon.png', async ctx => {
|
||||
});
|
||||
|
||||
// ServiceWorker
|
||||
router.get(/^\/sw\.(.+?)\.js$/, async ctx => {
|
||||
await send(ctx as any, `/assets/sw.${ctx.params[0]}.js`, {
|
||||
router.get('/sw.js', async ctx => {
|
||||
await send(ctx as any, `/assets/sw.${config.version}.js`, {
|
||||
root: client
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user