Allow service worker to serve cached unfurl responses
This commit is contained in:
@@ -14,8 +14,8 @@ dotenv.config({
|
|||||||
silent: true,
|
silent: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default () => {
|
export default () =>
|
||||||
return defineConfig({
|
defineConfig({
|
||||||
root: "./",
|
root: "./",
|
||||||
publicDir: "./server/static",
|
publicDir: "./server/static",
|
||||||
base: (process.env.CDN_URL ?? "") + "/static/",
|
base: (process.env.CDN_URL ?? "") + "/static/",
|
||||||
@@ -51,6 +51,22 @@ export default () => {
|
|||||||
modifyURLPrefix: {
|
modifyURLPrefix: {
|
||||||
"": `${process.env.CDN_URL ?? ""}/static/`,
|
"": `${process.env.CDN_URL ?? ""}/static/`,
|
||||||
},
|
},
|
||||||
|
runtimeCaching: [
|
||||||
|
{
|
||||||
|
urlPattern: /api\/urls\.unfurl$/,
|
||||||
|
handler: "CacheOnly",
|
||||||
|
options: {
|
||||||
|
cacheName: "unfurl-cache",
|
||||||
|
expiration: {
|
||||||
|
maxEntries: 100,
|
||||||
|
maxAgeSeconds: 60 * 60,
|
||||||
|
},
|
||||||
|
cacheableResponse: {
|
||||||
|
statuses: [0, 200],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
manifest: {
|
manifest: {
|
||||||
name: "Outline",
|
name: "Outline",
|
||||||
@@ -124,4 +140,3 @@ export default () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|||||||
Reference in New Issue
Block a user