From 7de1a41ddbc393aafd5e0135734967acc442f475 Mon Sep 17 00:00:00 2001 From: fly_mc Date: Fri, 22 Nov 2024 00:40:28 +0800 Subject: [PATCH 1/2] lint --- packages/sw/src/sw.ts | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/packages/sw/src/sw.ts b/packages/sw/src/sw.ts index 458b2081d..042ce570d 100644 --- a/packages/sw/src/sw.ts +++ b/packages/sw/src/sw.ts @@ -19,7 +19,9 @@ async function cacheWithFallback(cache, paths) { for (const path of paths) { try { await cache.add(new Request(path, { credentials: 'same-origin' })); - } catch (error) {} + } catch (error) { + // eslint-disable-next-line no-empty + } } } @@ -31,13 +33,13 @@ globalThis.addEventListener('install', (ev) => { })()); }); -globalThis.addEventListener('activate', ev => { +globalThis.addEventListener('activate', (ev) => { ev.waitUntil( caches.keys() - .then(cacheNames => Promise.all( + .then((cacheNames) => Promise.all( cacheNames .filter((v) => v !== STATIC_CACHE_NAME && v !== swLang.cacheName) - .map(name => caches.delete(name)), + .map((name) => caches.delete(name)), )) .then(() => globalThis.clients.claim()), ); @@ -51,28 +53,28 @@ async function offlineContentHTML() { reload: i18n.ts?.reload ?? 'Reload', }; - return `${messages.title}
${messages.header}
v${_VERSION_}
`; + return `${messages.title}
${messages.header}
v${_VERSION_}
`; } -globalThis.addEventListener('fetch', ev => { - const shouldCache = PATHS_TO_CACHE.some(path => ev.request.url.includes(path)); +globalThis.addEventListener('fetch', (ev) => { + const shouldCache = PATHS_TO_CACHE.some((path) => ev.request.url.includes(path)); if (shouldCache) { ev.respondWith( caches.match(ev.request) - .then(response => { + .then((response) => { if (response) return response; - return fetch(ev.request).then(response => { + return fetch(ev.request).then((response) => { if (!response || response.status !== 200 || response.type !== 'basic') return response; const responseToCache = response.clone(); caches.open(STATIC_CACHE_NAME) - .then(cache => { + .then((cache) => { cache.put(ev.request, responseToCache); }); return response; }); - }) + }), ); return; } @@ -101,7 +103,7 @@ globalThis.addEventListener('fetch', ev => { ); }); -globalThis.addEventListener('push', ev => { +globalThis.addEventListener('push', (ev) => { ev.waitUntil(globalThis.clients.matchAll({ includeUncontrolled: true, type: 'window', @@ -116,7 +118,7 @@ globalThis.addEventListener('push', ev => { return createNotification(data); case 'readAllNotifications': await globalThis.registration.getNotifications() - .then(notifications => notifications.forEach(n => n.tag !== 'read_notification' && n.close())); + .then((notifications) => notifications.forEach((n) => n.tag !== 'read_notification' && n.close())); break; } @@ -168,9 +170,6 @@ globalThis.addEventListener('notificationclick', (ev: ServiceWorkerGlobalScopeEv case 'showFollowRequests': client = await swos.openClient('push', '/my/follow-requests', loginId); break; - case 'edited': - if ('note' in data.body) client = await swos.openPost({ reply: data.body.note }, loginId); - break; default: switch (data.body.type) { case 'receiveFollowRequest': @@ -196,9 +195,9 @@ globalThis.addEventListener('notificationclick', (ev: ServiceWorkerGlobalScopeEv switch (action) { case 'markAllAsRead': await globalThis.registration.getNotifications() - .then(notifications => notifications.forEach(n => n.tag !== 'read_notification' && n.close())); - await get[]>('accounts').then(accounts => { - return Promise.all((accounts ?? []).map(async account => { + .then((notifications) => notifications.forEach((n) => n.tag !== 'read_notification' && n.close())); + await get[]>('accounts').then((accounts) => { + return Promise.all((accounts ?? []).map(async (account) => { await swos.sendMarkAllAsRead(account.id); })); }); @@ -235,8 +234,8 @@ globalThis.addEventListener('message', (ev: ServiceWorkerGlobalScopeEventMap['me ev.waitUntil((async (): Promise => { if (ev.data === 'clear') { await caches.keys() - .then(cacheNames => Promise.all( - cacheNames.map(name => caches.delete(name)), + .then((cacheNames) => Promise.all( + cacheNames.map((name) => caches.delete(name)), )); return; } From ebb5ef63e36ad1be76dce9a779f474ea8885c597 Mon Sep 17 00:00:00 2001 From: fly_mc Date: Fri, 22 Nov 2024 00:41:11 +0800 Subject: [PATCH 2/2] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 15bd8102a..b4136aea6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "2024.11.0-pari.28", + "version": "2024.11.0-pari.29", "codename": "nasubi", "repository": { "type": "git",