[build] upgrade eslint to 9.37.0 (#88)
Co-authored-by: tobi <tobi.smethurst@protonmail.com> Reviewed-on: https://codeberg.org/superseriousbusiness/masto-fe-standalone/pulls/88 Co-authored-by: Zoë Bijl <moiety@noreply.codeberg.org> Co-committed-by: Zoë Bijl <moiety@noreply.codeberg.org>
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
import { ExpirationPlugin } from 'workbox-expiration';
|
||||
import { precacheAndRoute } from 'workbox-precaching';
|
||||
import { registerRoute } from 'workbox-routing';
|
||||
import { CacheFirst } from 'workbox-strategies';
|
||||
import { ExpirationPlugin } from "workbox-expiration";
|
||||
import { precacheAndRoute } from "workbox-precaching";
|
||||
import { registerRoute } from "workbox-routing";
|
||||
import { CacheFirst } from "workbox-strategies";
|
||||
|
||||
import { handleNotificationClick, handlePush } from './web_push_notifications';
|
||||
import { handleNotificationClick, handlePush } from "./web_push_notifications";
|
||||
|
||||
const CACHE_NAME_PREFIX = 'mastodon-';
|
||||
const CACHE_NAME_PREFIX = "mastodon-";
|
||||
|
||||
function openWebCache() {
|
||||
return caches.open(`${CACHE_NAME_PREFIX}web`);
|
||||
}
|
||||
|
||||
function fetchRoot() {
|
||||
return fetch('/', { credentials: 'include', redirect: 'manual' });
|
||||
return fetch("/", { credentials: "include", redirect: "manual" });
|
||||
}
|
||||
|
||||
precacheAndRoute(self.__WB_MANIFEST);
|
||||
@@ -31,7 +31,7 @@ registerRoute(
|
||||
);
|
||||
|
||||
registerRoute(
|
||||
({ request }) => request.destination === 'font',
|
||||
({ request }) => request.destination === "font",
|
||||
new CacheFirst({
|
||||
cacheName: `${CACHE_NAME_PREFIX}fonts`,
|
||||
plugins: [
|
||||
@@ -44,7 +44,7 @@ registerRoute(
|
||||
);
|
||||
|
||||
registerRoute(
|
||||
({ request }) => request.destination === 'image',
|
||||
({ request }) => request.destination === "image",
|
||||
new CacheFirst({
|
||||
cacheName: `m${CACHE_NAME_PREFIX}media`,
|
||||
plugins: [
|
||||
@@ -58,26 +58,26 @@ registerRoute(
|
||||
|
||||
// Cause a new version of a registered Service Worker to replace an existing one
|
||||
// that is already installed, and replace the currently active worker on open pages.
|
||||
self.addEventListener('install', function(event) {
|
||||
event.waitUntil(Promise.all([openWebCache(), fetchRoot()]).then(([cache, root]) => cache.put('/', root)));
|
||||
self.addEventListener("install", function(event) {
|
||||
event.waitUntil(Promise.all([openWebCache(), fetchRoot()]).then(([cache, root]) => cache.put("/", root)));
|
||||
});
|
||||
|
||||
self.addEventListener('activate', function(event) {
|
||||
self.addEventListener("activate", function(event) {
|
||||
event.waitUntil(self.clients.claim());
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', function(event) {
|
||||
self.addEventListener("fetch", function(event) {
|
||||
const url = new URL(event.request.url);
|
||||
|
||||
if (url.pathname === '/auth/sign_out') {
|
||||
if (url.pathname === "/auth/sign_out") {
|
||||
const asyncResponse = fetch(event.request);
|
||||
const asyncCache = openWebCache();
|
||||
|
||||
event.respondWith(asyncResponse.then(response => {
|
||||
if (response.ok || response.type === 'opaqueredirect') {
|
||||
if (response.ok || response.type === "opaqueredirect") {
|
||||
return Promise.all([
|
||||
asyncCache.then(cache => cache.delete('/')),
|
||||
indexedDB.deleteDatabase('mastodon'),
|
||||
asyncCache.then(cache => cache.delete("/")),
|
||||
indexedDB.deleteDatabase("mastodon"),
|
||||
]).then(() => response);
|
||||
}
|
||||
|
||||
@@ -86,5 +86,5 @@ self.addEventListener('fetch', function(event) {
|
||||
}
|
||||
});
|
||||
|
||||
self.addEventListener('push', handlePush);
|
||||
self.addEventListener('notificationclick', handleNotificationClick);
|
||||
self.addEventListener("push", handlePush);
|
||||
self.addEventListener("notificationclick", handleNotificationClick);
|
||||
|
||||
Reference in New Issue
Block a user