Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .last_build_id

This file was deleted.

25 changes: 21 additions & 4 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,33 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow, noarchive">
<meta name="agora-pages-role" content="test-entry">
<meta name="agora-target-release" content="8930c5a3f64bcced945f6d5d6f8f869d7f291eb6">
<meta http-equiv="refresh" content="2;url=https://agoramarket-test.141-148-142-175.sslip.io/">
<title>前往 AgoraMarket V2 測試站</title>
</head>
<body>
<p><a id="continue" href="https://agoramarket-test.141-148-142-175.sslip.io/">前往 AgoraMarket V2 測試站</a></p>
<script>
const destination = new URL(location.pathname + location.search + location.hash, "https://agoramarket-test.141-148-142-175.sslip.io");
document.querySelector("#continue").href = destination.href;
location.replace(destination.href);
(() => {
const entryPath = ["/404.html", "/index.html"].includes(location.pathname) ? "/" : location.pathname;
const destination = new URL(entryPath + location.search + location.hash, "https://agoramarket-test.141-148-142-175.sslip.io");
document.querySelector("#continue").href = destination.href;

const cleanup = async () => {
if ("serviceWorker" in navigator) {
const registrations = await navigator.serviceWorker.getRegistrations();
await Promise.allSettled(registrations.map((registration) => registration.unregister()));
}
if ("caches" in window) {
const names = await caches.keys();
await Promise.allSettled(names.map((name) => caches.delete(name)));
}
};

Promise.race([
cleanup().catch(() => undefined),
new Promise((resolve) => setTimeout(resolve, 1200)),
]).finally(() => location.replace(destination.href));
})();
</script>
</body>
</html>
1 change: 0 additions & 1 deletion 4dea46f7753c459eb97e38888a2efa39.txt

This file was deleted.

70 changes: 8 additions & 62 deletions _headers
Original file line number Diff line number Diff line change
@@ -1,66 +1,12 @@
# HTTP Cache-Control intent for AgoraMarket Flutter web build。
#
# Format: Netlify / Cloudflare Pages `_headers` file syntax. Currently NOT
# served by the GitHub Pages production target(GH Pages 不支援 custom
# headers,僅以 default `cache-control: max-age=600` 對所有 static 資源
# 統一回應)。本檔留作 intent doc — 若未來遷 Cloudflare Pages / Netlify /
# 自架 CDN 直接生效。
#
# nginx production target(`agoramarket.purrtechllc.com`)應對應的 cache
# config 由 server-side `/etc/nginx/sites-available/agoramarket` 維護,
# 詳 `docs/runbooks/nginx-cache-config.md`。
#
# 設計原則:
# - HTML 短期 cache,讓 SW 能把 shell 接管
# - Content-addressed files(deferred chunks)→ immutable, 1 year
# - main.dart.js 短期(SW 走 stale-while-revalidate,不需 server 強制 refresh)
# - Static assets 中期(SW 走 cache-first,server miss 時用)
#
# See: #167 service worker epic + docs/audits/canvaskit-lazy-load-audit.md
# Cache policy intent for the stable AgoraMarket V2 test-site redirect.
# GitHub Pages does not currently apply this file; it is retained for any
# future Cloudflare Pages, Netlify or self-hosted equivalent.

# === HTML pages — 短期,SW 接管 shell 後不依賴此 ===
/
Cache-Control: public, max-age=300, must-revalidate
Cache-Control: public, max-age=60, must-revalidate
/index.html
Cache-Control: public, max-age=300, must-revalidate

# === Manifest / SW registration ===
/manifest.json
Cache-Control: public, max-age=600
Cache-Control: public, max-age=60, must-revalidate
/404.html
Cache-Control: public, max-age=60, must-revalidate
/flutter_service_worker.js
Cache-Control: public, max-age=0, must-revalidate

# === Bootstrap + entry ===
/flutter_bootstrap.js
Cache-Control: public, max-age=600
/flutter.js
Cache-Control: public, max-age=600

# === main.dart.js — short cache, SW handles staleness via SWR ===
/main.dart.js
Cache-Control: public, max-age=300, must-revalidate

# === Deferred chunks — content addressed, immutable per build ===
# Pattern: main.dart.js_<hash>.part.js — filename changes when content changes,
# 安全 cache 一年。
/main.dart.js_*.part.js
Cache-Control: public, max-age=31536000, immutable

# === Static assets — long cache(asset hash 通常嵌在路徑)===
/assets/*
Cache-Control: public, max-age=31536000, immutable
/icons/*
Cache-Control: public, max-age=31536000, immutable
/splash/*
Cache-Control: public, max-age=86400

# === Fonts ===
/assets/fonts/*
Cache-Control: public, max-age=31536000, immutable
*.ttf
Cache-Control: public, max-age=31536000, immutable
*.otf
Cache-Control: public, max-age=31536000, immutable

# === API responses (cross-origin, browser handles) — listed for completeness ===
# /api/* — 由 backend Spring Boot Cache-Control header 控制
Cache-Control: public, max-age=0, no-cache, must-revalidate
2 changes: 0 additions & 2 deletions assets/.env

This file was deleted.

1 change: 0 additions & 1 deletion assets/AssetManifest.bin

This file was deleted.

1 change: 0 additions & 1 deletion assets/AssetManifest.bin.json

This file was deleted.

1 change: 0 additions & 1 deletion assets/FontManifest.json

This file was deleted.

Loading