all repos — caroster @ a39140195ebca61d87447a3caac3d6e1ec49104f

[Octree] Group carpool to your event https://caroster.io

fix: :bug: Fix useless redirections to /graphql endpoint
Tim Izzo tim@octree.ch
Mon, 29 Jan 2024 14:16:49 +0000
commit

a39140195ebca61d87447a3caac3d6e1ec49104f

parent

8f6ee2d5cc57223f2192b61caad42a84deb22b96

M frontend/lib/apolloClient.tsfrontend/lib/apolloClient.ts

@@ -5,8 +5,6 @@ import {onError} from '@apollo/client/link/error';

import merge from 'deepmerge'; import isEqual from 'lodash/isEqual'; import {signOut, useSession} from 'next-auth/react'; -import {Session} from 'next-auth'; -import {JWT} from 'next-auth/jwt'; export const APOLLO_STATE_PROP_NAME = '__APOLLO_STATE__'; let apolloClient: ApolloClient<any>;

@@ -87,5 +85,8 @@

export const useApollo = (pageProps: any) => { const state = pageProps[APOLLO_STATE_PROP_NAME]; const {data: session} = useSession(); - return useMemo(() => initializeApollo('', session?.token?.jwt, state), [state, session]); + return useMemo( + () => initializeApollo('/graphql/', session?.token?.jwt, state), + [state, session] + ); };
M frontend/lib/pageUtils.tsfrontend/lib/pageUtils.ts

@@ -20,7 +20,7 @@ const session = await getSession(context);

const {STRAPI_URL = 'http://localhost:1337'} = process.env; const jwt = session?.token?.jwt; - const apolloClient = initializeApollo(`${STRAPI_URL}/graphql`, jwt); + const apolloClient = initializeApollo(`${STRAPI_URL}/graphql/`, jwt); try { const {
M frontend/middleware.tsfrontend/middleware.ts

@@ -14,7 +14,7 @@ export async function middleware(req: NextRequest) {

const isIgnoredPath = req.nextUrl.pathname.startsWith('/_next') || req.nextUrl.pathname.includes('/api/') || - req.nextUrl.pathname === '/graphql' || + req.nextUrl.pathname.startsWith('/graphql') || PUBLIC_FILE.test(req.nextUrl.pathname); if (!isIgnoredPath && req.nextUrl.locale === DEFAULT_LOCALE) {

@@ -45,7 +45,7 @@ secret: process.env.NEXTAUTH_SECRET,

}); const {STRAPI_URL = 'http://localhost:1337'} = process.env; - return fetch(`${STRAPI_URL}/graphql`, { + return fetch(`${STRAPI_URL}/graphql/`, { method: 'POST', headers: { 'Content-Type': 'application/json',
M frontend/public/sw.jsfrontend/public/sw.js

@@ -1,1 +1,1 @@

-if(!self.define){let e,s={};const a=(a,n)=>(a=new URL(a+".js",n).href,s[a]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=a,e.onload=s,document.head.appendChild(e)}else e=a,importScripts(a),s()})).then((()=>{let e=s[a];if(!e)throw new Error(`Module ${a} didn’t register its module`);return e})));self.define=(n,i)=>{const c=e||("document"in self?document.currentScript.src:"")||location.href;if(s[c])return;let t={};const r=e=>a(e,c),d={module:{uri:c},exports:t,require:r};s[c]=Promise.all(n.map((e=>d[e]||r(e)))).then((e=>(i(...e),t)))}}define(["./workbox-588899ac"],(function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/static/3pC0whv_e2F0VKF7pnm40/_buildManifest.js",revision:"9eefe7270aa0684c391f2f5039eb3123"},{url:"/_next/static/3pC0whv_e2F0VKF7pnm40/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/_next/static/chunks/0b7b90cd.5bfb8e73dff615d1.js",revision:"5bfb8e73dff615d1"},{url:"/_next/static/chunks/183-b37d10b612b3a9db.js",revision:"b37d10b612b3a9db"},{url:"/_next/static/chunks/284.c3c08f95c3039bae.js",revision:"c3c08f95c3039bae"},{url:"/_next/static/chunks/302-26393d32a6e66c4f.js",revision:"26393d32a6e66c4f"},{url:"/_next/static/chunks/31-d535fcf427485415.js",revision:"d535fcf427485415"},{url:"/_next/static/chunks/334-459150a541b91bb3.js",revision:"459150a541b91bb3"},{url:"/_next/static/chunks/353-c2e7e308c19907c1.js",revision:"c2e7e308c19907c1"},{url:"/_next/static/chunks/399-d255797d5ae1e4e7.js",revision:"d255797d5ae1e4e7"},{url:"/_next/static/chunks/417-7e51b04b0b8eaffb.js",revision:"7e51b04b0b8eaffb"},{url:"/_next/static/chunks/474-5cb67dfff48136ca.js",revision:"5cb67dfff48136ca"},{url:"/_next/static/chunks/509-7d439fdc63a8c9bd.js",revision:"7d439fdc63a8c9bd"},{url:"/_next/static/chunks/565-57b569ce68bda31c.js",revision:"57b569ce68bda31c"},{url:"/_next/static/chunks/572.add016c88034f829.js",revision:"add016c88034f829"},{url:"/_next/static/chunks/619-c264ee619d57bbdc.js",revision:"c264ee619d57bbdc"},{url:"/_next/static/chunks/664-5af51080742797e4.js",revision:"5af51080742797e4"},{url:"/_next/static/chunks/689-af87e1cd8babdbf7.js",revision:"af87e1cd8babdbf7"},{url:"/_next/static/chunks/691-04e0e1a1165615d5.js",revision:"04e0e1a1165615d5"},{url:"/_next/static/chunks/746-c06e46f52d822802.js",revision:"c06e46f52d822802"},{url:"/_next/static/chunks/889.8b98a5d2151b2e99.js",revision:"8b98a5d2151b2e99"},{url:"/_next/static/chunks/899-30f0490d71940243.js",revision:"30f0490d71940243"},{url:"/_next/static/chunks/framework-18c7e6fcf99e5daa.js",revision:"18c7e6fcf99e5daa"},{url:"/_next/static/chunks/main-e7eaf35d0b680ee7.js",revision:"e7eaf35d0b680ee7"},{url:"/_next/static/chunks/pages/_app-7947eafa5272ae87.js",revision:"7947eafa5272ae87"},{url:"/_next/static/chunks/pages/_error-0af77d51243a3919.js",revision:"0af77d51243a3919"},{url:"/_next/static/chunks/pages/auth/confirm-26cf99db62380930.js",revision:"26cf99db62380930"},{url:"/_next/static/chunks/pages/auth/confirm/google-ef085c4b4d5b3433.js",revision:"ef085c4b4d5b3433"},{url:"/_next/static/chunks/pages/auth/login-fa635b363017642e.js",revision:"fa635b363017642e"},{url:"/_next/static/chunks/pages/auth/lost-password-55bfea92cea33232.js",revision:"55bfea92cea33232"},{url:"/_next/static/chunks/pages/auth/register-b511990a57d0af93.js",revision:"b511990a57d0af93"},{url:"/_next/static/chunks/pages/auth/register/mail-cba2776e22c58e51.js",revision:"cba2776e22c58e51"},{url:"/_next/static/chunks/pages/auth/reset-6d4bdbd5d23fe17b.js",revision:"6d4bdbd5d23fe17b"},{url:"/_next/static/chunks/pages/dashboard-c2e1b5d1ffe91c62.js",revision:"c2e1b5d1ffe91c62"},{url:"/_next/static/chunks/pages/e/%5Buuid%5D-909ed68856a74372.js",revision:"909ed68856a74372"},{url:"/_next/static/chunks/pages/e/%5Buuid%5D/assign/%5BpassengerId%5D-b5aa7ff6c0a808f6.js",revision:"b5aa7ff6c0a808f6"},{url:"/_next/static/chunks/pages/e/%5Buuid%5D/details-08335776a2e4fe1b.js",revision:"08335776a2e4fe1b"},{url:"/_next/static/chunks/pages/e/%5Buuid%5D/waitingList-78b60892356d8942.js",revision:"78b60892356d8942"},{url:"/_next/static/chunks/pages/index-01c9aa0a79a527ad.js",revision:"01c9aa0a79a527ad"},{url:"/_next/static/chunks/pages/profile-90bf3c081c1a1651.js",revision:"90bf3c081c1a1651"},{url:"/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js",revision:"79330112775102f91e1010318bae2bd3"},{url:"/_next/static/chunks/webpack-6519809fddd576b6.js",revision:"6519809fddd576b6"},{url:"/_next/static/css/be71e1e74069890e.css",revision:"be71e1e74069890e"},{url:"/_next/static/media/layers-2x.9859cd12.png",revision:"9859cd12"},{url:"/_next/static/media/layers.ef6db872.png",revision:"ef6db872"},{url:"/_next/static/media/marker-icon.d577052a.png",revision:"d577052a"},{url:"/assets/Caroster_Octree_Social.jpg",revision:"563fc10a4ec83e735943c5f67d417a6e"},{url:"/assets/Caroster_beta.png",revision:"86c6259620aee306a019b2a611eaf21d"},{url:"/assets/Logo_in_beta.svg",revision:"cdde8d69adbfdbaf7c903e155419b12c"},{url:"/assets/android-chrome-192x192.png",revision:"b288769d936ad5f9a87944e027d0096c"},{url:"/assets/android-chrome-512x512.png",revision:"c789c009674fc4a2087a8b71c24a12b7"},{url:"/assets/apple-touch-icon.png",revision:"573a4bc22886d3ef3f6c3aa0eab64d44"},{url:"/assets/car.png",revision:"0c95a91895d437b7ea06db071aa8f68f"},{url:"/assets/favicon-16x16.png",revision:"9f98c22a36ec0001995797d29a7583b1"},{url:"/assets/favicon-32x32.png",revision:"562ff70a6694a29302644d4f85b2e920"},{url:"/assets/favicon.ico",revision:"45004f0a61722a526ca688bddc4955c4"},{url:"/assets/google-icon.svg",revision:"81ad048ed858673aaca6cc2227076b8a"},{url:"/assets/icon.png",revision:"ac122f40fd4c9fd7f1831b0dd406c950"},{url:"/assets/logo.png",revision:"d685d6b49c3aedcf4819d5cbbc873d60"},{url:"/assets/logo.svg",revision:"bf83592cc1865c5c492b7ab09bb18f59"},{url:"/assets/site.webmanifest",revision:"053100cb84a50d2ae7f5492f7dd7f25e"},{url:"/favicon.ico",revision:"8eb6dd187ac1c4e26f8df8062bb42e09"},{url:"/leaflet_reset.css",revision:"6f4d8f15afd38d42b34a51581d8e90ce"},{url:"/manifest.json",revision:"e76480838d8eb8908456941dcb59275e"}],{ignoreURLParametersMatching:[]}),e.cleanupOutdatedCaches(),e.registerRoute("/",new e.NetworkFirst({cacheName:"start-url",plugins:[{cacheWillUpdate:async({request:e,response:s,event:a,state:n})=>s&&"opaqueredirect"===s.type?new Response(s.body,{status:200,statusText:"OK",headers:s.headers}):s}]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,new e.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:31536e3})]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,new e.StaleWhileRevalidate({cacheName:"google-fonts-stylesheets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,new e.StaleWhileRevalidate({cacheName:"static-font-assets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,new e.StaleWhileRevalidate({cacheName:"static-image-assets",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/image\?url=.+$/i,new e.StaleWhileRevalidate({cacheName:"next-image",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp3|wav|ogg)$/i,new e.CacheFirst({cacheName:"static-audio-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp4)$/i,new e.CacheFirst({cacheName:"static-video-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:js)$/i,new e.StaleWhileRevalidate({cacheName:"static-js-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:css|less)$/i,new e.StaleWhileRevalidate({cacheName:"static-style-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/data\/.+\/.+\.json$/i,new e.StaleWhileRevalidate({cacheName:"next-data",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:json|xml|csv)$/i,new e.NetworkFirst({cacheName:"static-data-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;const s=e.pathname;return!s.startsWith("/api/auth/")&&!!s.startsWith("/api/")}),new e.NetworkFirst({cacheName:"apis",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:16,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;return!e.pathname.startsWith("/api/")}),new e.NetworkFirst({cacheName:"others",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>!(self.origin===e.origin)),new e.NetworkFirst({cacheName:"cross-origin",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:3600})]}),"GET")})); +if(!self.define){let e,s={};const a=(a,c)=>(a=new URL(a+".js",c).href,s[a]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=a,e.onload=s,document.head.appendChild(e)}else e=a,importScripts(a),s()})).then((()=>{let e=s[a];if(!e)throw new Error(`Module ${a} didn’t register its module`);return e})));self.define=(c,n)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(s[i])return;let t={};const r=e=>a(e,i),d={module:{uri:i},exports:t,require:r};s[i]=Promise.all(c.map((e=>d[e]||r(e)))).then((e=>(n(...e),t)))}}define(["./workbox-588899ac"],(function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/static/chunks/0b7b90cd.5bfb8e73dff615d1.js",revision:"5bfb8e73dff615d1"},{url:"/_next/static/chunks/183-b37d10b612b3a9db.js",revision:"b37d10b612b3a9db"},{url:"/_next/static/chunks/284.4cd0e53507e02ea0.js",revision:"4cd0e53507e02ea0"},{url:"/_next/static/chunks/302-42211765ad595070.js",revision:"42211765ad595070"},{url:"/_next/static/chunks/31-d535fcf427485415.js",revision:"d535fcf427485415"},{url:"/_next/static/chunks/334-459150a541b91bb3.js",revision:"459150a541b91bb3"},{url:"/_next/static/chunks/353-c2e7e308c19907c1.js",revision:"c2e7e308c19907c1"},{url:"/_next/static/chunks/399-d255797d5ae1e4e7.js",revision:"d255797d5ae1e4e7"},{url:"/_next/static/chunks/417-e5213295c7ec853d.js",revision:"e5213295c7ec853d"},{url:"/_next/static/chunks/474-5cb67dfff48136ca.js",revision:"5cb67dfff48136ca"},{url:"/_next/static/chunks/509-7d439fdc63a8c9bd.js",revision:"7d439fdc63a8c9bd"},{url:"/_next/static/chunks/565-57b569ce68bda31c.js",revision:"57b569ce68bda31c"},{url:"/_next/static/chunks/572.1bba26c5c67fda4f.js",revision:"1bba26c5c67fda4f"},{url:"/_next/static/chunks/619-c264ee619d57bbdc.js",revision:"c264ee619d57bbdc"},{url:"/_next/static/chunks/664-5af51080742797e4.js",revision:"5af51080742797e4"},{url:"/_next/static/chunks/689-af87e1cd8babdbf7.js",revision:"af87e1cd8babdbf7"},{url:"/_next/static/chunks/691-04e0e1a1165615d5.js",revision:"04e0e1a1165615d5"},{url:"/_next/static/chunks/746-6c5b820dc29a7c57.js",revision:"6c5b820dc29a7c57"},{url:"/_next/static/chunks/889.8b98a5d2151b2e99.js",revision:"8b98a5d2151b2e99"},{url:"/_next/static/chunks/899-3380c55c278ef7f1.js",revision:"3380c55c278ef7f1"},{url:"/_next/static/chunks/framework-5866cead997b9ace.js",revision:"5866cead997b9ace"},{url:"/_next/static/chunks/main-83f1980da87e4872.js",revision:"83f1980da87e4872"},{url:"/_next/static/chunks/pages/_app-4e38a4c7b1c27585.js",revision:"4e38a4c7b1c27585"},{url:"/_next/static/chunks/pages/_error-1e0fee5be45be928.js",revision:"1e0fee5be45be928"},{url:"/_next/static/chunks/pages/auth/confirm-09c2ec9bad9b6569.js",revision:"09c2ec9bad9b6569"},{url:"/_next/static/chunks/pages/auth/confirm/google-d609a4ef1823d107.js",revision:"d609a4ef1823d107"},{url:"/_next/static/chunks/pages/auth/login-e347900e3fae9dc1.js",revision:"e347900e3fae9dc1"},{url:"/_next/static/chunks/pages/auth/lost-password-a256d74ebb123bd5.js",revision:"a256d74ebb123bd5"},{url:"/_next/static/chunks/pages/auth/register-876f3078b0a9e1ce.js",revision:"876f3078b0a9e1ce"},{url:"/_next/static/chunks/pages/auth/register/mail-effd6fdfaa276600.js",revision:"effd6fdfaa276600"},{url:"/_next/static/chunks/pages/auth/reset-6cd2fa6d974e2e07.js",revision:"6cd2fa6d974e2e07"},{url:"/_next/static/chunks/pages/dashboard-38b09f3f7a980bf2.js",revision:"38b09f3f7a980bf2"},{url:"/_next/static/chunks/pages/e/%5Buuid%5D-2d11c135260d1b10.js",revision:"2d11c135260d1b10"},{url:"/_next/static/chunks/pages/e/%5Buuid%5D/assign/%5BpassengerId%5D-2d9c31701aedeb0b.js",revision:"2d9c31701aedeb0b"},{url:"/_next/static/chunks/pages/e/%5Buuid%5D/details-89c18724004983cb.js",revision:"89c18724004983cb"},{url:"/_next/static/chunks/pages/e/%5Buuid%5D/waitingList-f69fd48f8926ea85.js",revision:"f69fd48f8926ea85"},{url:"/_next/static/chunks/pages/index-3b736b0ce35c7875.js",revision:"3b736b0ce35c7875"},{url:"/_next/static/chunks/pages/profile-ed56370ef3551be7.js",revision:"ed56370ef3551be7"},{url:"/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js",revision:"79330112775102f91e1010318bae2bd3"},{url:"/_next/static/chunks/webpack-02fc99d2a832059f.js",revision:"02fc99d2a832059f"},{url:"/_next/static/css/be71e1e74069890e.css",revision:"be71e1e74069890e"},{url:"/_next/static/media/layers-2x.9859cd12.png",revision:"9859cd12"},{url:"/_next/static/media/layers.ef6db872.png",revision:"ef6db872"},{url:"/_next/static/media/marker-icon.d577052a.png",revision:"d577052a"},{url:"/_next/static/s4Cg1hN0IZHem0dfcwR7V/_buildManifest.js",revision:"38f83814843c8f99a230beaf26f31ef0"},{url:"/_next/static/s4Cg1hN0IZHem0dfcwR7V/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/assets/Caroster_Octree_Social.jpg",revision:"563fc10a4ec83e735943c5f67d417a6e"},{url:"/assets/Caroster_beta.png",revision:"86c6259620aee306a019b2a611eaf21d"},{url:"/assets/Logo_in_beta.svg",revision:"cdde8d69adbfdbaf7c903e155419b12c"},{url:"/assets/android-chrome-192x192.png",revision:"b288769d936ad5f9a87944e027d0096c"},{url:"/assets/android-chrome-512x512.png",revision:"c789c009674fc4a2087a8b71c24a12b7"},{url:"/assets/apple-touch-icon.png",revision:"573a4bc22886d3ef3f6c3aa0eab64d44"},{url:"/assets/car.png",revision:"0c95a91895d437b7ea06db071aa8f68f"},{url:"/assets/favicon-16x16.png",revision:"9f98c22a36ec0001995797d29a7583b1"},{url:"/assets/favicon-32x32.png",revision:"562ff70a6694a29302644d4f85b2e920"},{url:"/assets/favicon.ico",revision:"45004f0a61722a526ca688bddc4955c4"},{url:"/assets/google-icon.svg",revision:"81ad048ed858673aaca6cc2227076b8a"},{url:"/assets/icon.png",revision:"ac122f40fd4c9fd7f1831b0dd406c950"},{url:"/assets/logo.png",revision:"d685d6b49c3aedcf4819d5cbbc873d60"},{url:"/assets/logo.svg",revision:"bf83592cc1865c5c492b7ab09bb18f59"},{url:"/assets/site.webmanifest",revision:"053100cb84a50d2ae7f5492f7dd7f25e"},{url:"/favicon.ico",revision:"8eb6dd187ac1c4e26f8df8062bb42e09"},{url:"/leaflet_reset.css",revision:"6f4d8f15afd38d42b34a51581d8e90ce"},{url:"/manifest.json",revision:"e76480838d8eb8908456941dcb59275e"}],{ignoreURLParametersMatching:[]}),e.cleanupOutdatedCaches(),e.registerRoute("/",new e.NetworkFirst({cacheName:"start-url",plugins:[{cacheWillUpdate:async({request:e,response:s,event:a,state:c})=>s&&"opaqueredirect"===s.type?new Response(s.body,{status:200,statusText:"OK",headers:s.headers}):s}]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,new e.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:31536e3})]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,new e.StaleWhileRevalidate({cacheName:"google-fonts-stylesheets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,new e.StaleWhileRevalidate({cacheName:"static-font-assets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,new e.StaleWhileRevalidate({cacheName:"static-image-assets",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/image\?url=.+$/i,new e.StaleWhileRevalidate({cacheName:"next-image",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp3|wav|ogg)$/i,new e.CacheFirst({cacheName:"static-audio-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp4)$/i,new e.CacheFirst({cacheName:"static-video-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:js)$/i,new e.StaleWhileRevalidate({cacheName:"static-js-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:css|less)$/i,new e.StaleWhileRevalidate({cacheName:"static-style-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/data\/.+\/.+\.json$/i,new e.StaleWhileRevalidate({cacheName:"next-data",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:json|xml|csv)$/i,new e.NetworkFirst({cacheName:"static-data-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;const s=e.pathname;return!s.startsWith("/api/auth/")&&!!s.startsWith("/api/")}),new e.NetworkFirst({cacheName:"apis",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:16,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;return!e.pathname.startsWith("/api/")}),new e.NetworkFirst({cacheName:"others",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>!(self.origin===e.origin)),new e.NetworkFirst({cacheName:"cross-origin",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:3600})]}),"GET")}));