error page, sw
This commit is contained in:
parent
7be4b0bd18
commit
90b15ee668
@ -9,7 +9,7 @@ const ErrorPage = () => {
|
|||||||
|
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return (
|
return (
|
||||||
<div className="main-content page">
|
<div className="p-2">
|
||||||
<h4>
|
<h4>
|
||||||
<FormattedMessage defaultMessage="An error has occured!" id="FfYsOb" />
|
<FormattedMessage defaultMessage="An error has occured!" id="FfYsOb" />
|
||||||
</h4>
|
</h4>
|
||||||
@ -21,15 +21,11 @@ const ErrorPage = () => {
|
|||||||
}}>
|
}}>
|
||||||
<FormattedMessage defaultMessage="Clear cache and reload" id="HWbkEK" />
|
<FormattedMessage defaultMessage="Clear cache and reload" id="HWbkEK" />
|
||||||
</AsyncButton>
|
</AsyncButton>
|
||||||
{
|
<h5>{error.message}</h5>
|
||||||
<pre>
|
<div className="my-2">{error.message}</div>
|
||||||
{JSON.stringify(
|
<pre className="my-2 whitespace-pre-wrap">
|
||||||
error instanceof Error ? { name: error.name, message: error.message, stack: error.stack } : error,
|
{error.stack}
|
||||||
undefined,
|
</pre>
|
||||||
" ",
|
|
||||||
)}
|
|
||||||
</pre>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -15,6 +15,23 @@ import { formatShort } from "@/Utils/Number";
|
|||||||
|
|
||||||
precacheAndRoute(self.__WB_MANIFEST);
|
precacheAndRoute(self.__WB_MANIFEST);
|
||||||
clientsClaim();
|
clientsClaim();
|
||||||
|
|
||||||
|
// cache everything in current domain /assets because precache doesn't seem to include everything
|
||||||
|
registerRoute(
|
||||||
|
({ url }) => url.origin === location.origin && url.pathname.startsWith("/assets"),
|
||||||
|
new StaleWhileRevalidate({
|
||||||
|
cacheName: "assets-cache",
|
||||||
|
plugins: [
|
||||||
|
new ExpirationPlugin({
|
||||||
|
maxEntries: 200,
|
||||||
|
matchOptions: {
|
||||||
|
ignoreVary: true,
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
registerRoute(
|
registerRoute(
|
||||||
({ url }) => url.pathname.endsWith("/.well-known/nostr.json"),
|
({ url }) => url.pathname.endsWith("/.well-known/nostr.json"),
|
||||||
new StaleWhileRevalidate({
|
new StaleWhileRevalidate({
|
||||||
@ -32,13 +49,16 @@ registerRoute(
|
|||||||
plugins: [
|
plugins: [
|
||||||
new ExpirationPlugin({
|
new ExpirationPlugin({
|
||||||
maxEntries: 200,
|
maxEntries: 200,
|
||||||
|
matchOptions: {
|
||||||
|
ignoreVary: true,
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
registerRoute(
|
registerRoute(
|
||||||
({ url }) => url.pathname.endsWith("api/v1/preview"),
|
({ url }) => url.origin === "https://api.snort.social" && url.pathname.startsWith("/api/v1/preview"),
|
||||||
new StaleWhileRevalidate({
|
new StaleWhileRevalidate({
|
||||||
cacheName: "preview-cache",
|
cacheName: "preview-cache",
|
||||||
plugins: [new ExpirationPlugin({ maxAgeSeconds: 4 * 60 * 60 })],
|
plugins: [new ExpirationPlugin({ maxAgeSeconds: 4 * 60 * 60 })],
|
||||||
|
@ -18,6 +18,10 @@ export default defineConfig({
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
type: "module",
|
type: "module",
|
||||||
},
|
},
|
||||||
|
workbox: {
|
||||||
|
globPatterns: ['**/*.{js,html,wasm,woff,woff2,ttf,svg,png,jpg,jpeg,webp,ico,json}'],
|
||||||
|
sourcemap: true,
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
visualizer({
|
visualizer({
|
||||||
open: true,
|
open: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user