AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
fix web asset cache updates
tianma-ifb3dd5fd1c2f6
diff --git a/apps/web/public/_headers b/apps/web/public/_headersnew file mode 100644index 00000000..d916b819--- /dev/null+++ b/apps/web/public/_headers@@ -0,0 +1,25 @@+# Always validate application entry points against the active deployment.+# Fingerprinted assets below can remain cached indefinitely.+/+ Cache-Control: no-cache, no-store, must-revalidate++/settings+ Cache-Control: no-cache, no-store, must-revalidate++/templates+ Cache-Control: no-cache, no-store, must-revalidate++/evernote-migration+ Cache-Control: no-cache, no-store, must-revalidate++/*.html+ Cache-Control: no-cache, no-store, must-revalidate++/sw.js+ Cache-Control: no-cache, no-store, must-revalidate++/manifest.webmanifest+ Cache-Control: no-cache, no-store, must-revalidate++/assets/*+ Cache-Control: public, max-age=31536000, immutablediff --git a/apps/web/vite.config.ts b/apps/web/vite.config.tsindex b6ce5e01..93e71b0d 100644--- a/apps/web/vite.config.ts+++ b/apps/web/vite.config.ts@@ -152,15 +152,39 @@ export default defineConfig({},workbox: {globPatterns: ["**/*.{js,css,html,ico,png,svg,webp,woff2}"],+ cleanupOutdatedCaches: true,+ additionalManifestEntries: [+ {+ revision: buildId,+ url: `/index.html?edgeever-offline-shell=${encodeURIComponent(buildId)}`,+ },+ ],globIgnores: [+ "index.html","**/vendor-beautiful-mermaid-*.js","**/vendor-mermaid-*.js","**/mermaid.core-*.js","**/*Diagram-*.js",],- navigateFallback: "/index.html",- navigateFallbackDenylist: [/^\/api\//, /^\/mcp\//, /^\/mobile-edit\.html$/, /^\/note-print\.html/, /^\/tiptap-ime-test\.html$/],+ navigateFallback: null,+ navigationPreload: true,runtimeCaching: [+ {+ urlPattern: ({ request, url }) =>+ request.mode === "navigate" &&+ !["/mobile-edit.html", "/note-print.html", "/tiptap-ime-test.html"].includes(url.pathname),+ handler: "NetworkFirst",+ options: {+ cacheName: "edgeever-app-shell",+ networkTimeoutSeconds: 5,+ cacheableResponse: {+ statuses: [0, 200],+ },+ precacheFallback: {+ fallbackURL: `/index.html?edgeever-offline-shell=${encodeURIComponent(buildId)}`,+ },+ },+ },{urlPattern: ({ url }) => /^\/api\/v1\/resources\/[^/]+\/blob$/.test(url.pathname),handler: "CacheFirst",diff --git a/scripts/verify-web-performance.mjs b/scripts/verify-web-performance.mjsindex 0c18dc25..bcc52f65 100644--- a/scripts/verify-web-performance.mjs+++ b/scripts/verify-web-performance.mjs@@ -5,13 +5,22 @@ import { join } from "node:path";const distDirectory = join(process.cwd(), "apps", "web", "dist");const indexHtml = readFileSync(join(distDirectory, "index.html"), "utf8");const serviceWorker = readFileSync(join(distDirectory, "sw.js"), "utf8");+const staticHeaders = readFileSync(join(distDirectory, "_headers"), "utf8");assert.match(serviceWorker, /edgeever-resource-blobs/, "PWA must provide a runtime cache for resource bytes");assert.match(serviceWorker, /CacheFirst/, "PWA resource bytes must use a cache-first runtime strategy");+assert.match(serviceWorker, /edgeever-app-shell/, "PWA navigation must use a dedicated app-shell runtime cache");+assert.match(serviceWorker, /NetworkFirst/, "PWA navigation must prefer the current deployment over cached HTML");+assert.match(serviceWorker, /PrecacheFallbackPlugin/, "PWA navigation must retain an offline app-shell fallback");+assert.doesNotMatch(serviceWorker, /NavigationRoute/, "PWA navigation must not always serve the precached HTML shell");+assert.match(staticHeaders, /\/sw\.js\s+Cache-Control: no-cache, no-store, must-revalidate/, "Service worker updates must not use stale browser cache");+assert.match(staticHeaders, /\/assets\/\*\s+Cache-Control: public, max-age=31536000, immutable/, "Fingerprinted assets must use immutable browser caching");const precacheStart = serviceWorker.indexOf("precacheAndRoute(");const precacheEnd = serviceWorker.indexOf(");", precacheStart);assert.ok(precacheStart >= 0 && precacheEnd > precacheStart, "Web service worker must contain a precache manifest");const precacheManifest = serviceWorker.slice(precacheStart, precacheEnd);+assert.doesNotMatch(precacheManifest, /\{url:"index\.html",/, "Current HTML must not be served by a cache-first precache route");+assert.match(precacheManifest, /index\.html\?edgeever-offline-shell=/, "PWA must retain a versioned offline HTML shell");const optionalDiagramPattern = /(?:vendor-(?:beautiful-mermaid|mermaid)|mermaid\.core|[^"']*Diagram-)[^"']*\.js/;assert.doesNotMatch(precacheManifest, optionalDiagramPattern, "Optional diagram chunks must remain out of the initial PWA precache");