From 197bec7dc5dc5e9b0b47e3de8c417fc48d0c4784 Mon Sep 17 00:00:00 2001 From: Crystal Chang <223268516+Crystal32378@users.noreply.github.com> Date: Thu, 17 Sep 2026 19:37:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?chore(site):=20=E9=80=80=E5=A0=B4=E8=88=8A?= =?UTF-8?q?=E9=A0=81=E2=80=94=E2=80=94/index.html=20=E8=88=87=20/research?= =?UTF-8?q?=20=E5=95=8F=E5=8D=B7=20301=20=E5=9B=9E=E5=9F=95=EF=BC=8C?= =?UTF-8?q?=E8=A3=9C=20favicon=EF=BC=88=E5=AF=A9=E6=9F=A5=20P2=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 線上同一主機仍可達兩個與現行產品矛盾的頁面:舊版「數位籤詩宇宙」emoji 神明卡(/index.html) 與研究問卷(/research/index.html,選項仍列月老、AI 解籤)。兩者可被索引,初訪者可能先撞到舊產品。 - vercel.json:/index.html、/research(/index.html) → 301 / - assets/favicon.svg(紙色底、一橫墨線=「抽一」)+ arrival ;消掉每次載入的 favicon 404 - README:本機執行改指 paper/arrival.html - index.html 檔案本身保留:scripts/test-draw-pool.mjs T5 仍以它為 public-page 真相檢查對象;retarget 另議 Co-Authored-By: Claude Fable 5.1 --- README.md | 4 ++-- assets/favicon.svg | 1 + paper/arrival.html | 1 + vercel.json | 7 +++---- 4 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 assets/favicon.svg diff --git a/README.md b/README.md index 72a4d08..533f3e9 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This project won first place at a hackathon demo day selected from 32 finalist t Public demo: [https://draw-one-crystals-projects-0006cdef.vercel.app/](https://draw-one-crystals-projects-0006cdef.vercel.app/) -Open `index.html` in a browser to run it locally. No backend is required for the current public demo. +Open `paper/arrival.html` in a browser to run it locally (the Vercel root routes there). No backend is required for the current public demo. The earlier `index.html` prototype is kept in the repo for the content-truth test suite but is no longer served. ## What It Does @@ -95,5 +95,5 @@ Draw One is still a prototype. The product direction has been validated at demo No backend is required. ```bash -open index.html +open paper/arrival.html ``` diff --git a/assets/favicon.svg b/assets/favicon.svg new file mode 100644 index 0000000..a1c3be8 --- /dev/null +++ b/assets/favicon.svg @@ -0,0 +1 @@ + diff --git a/paper/arrival.html b/paper/arrival.html index 7bb198b..86a9013 100644 --- a/paper/arrival.html +++ b/paper/arrival.html @@ -4,6 +4,7 @@ 抽一 Draw One — 埕 + diff --git a/vercel.json b/vercel.json index b3f54b4..379ca83 100644 --- a/vercel.json +++ b/vercel.json @@ -1,10 +1,9 @@ { "$schema": "https://openapi.vercel.sh/vercel.json", "routes": [ - { - "src": "/", - "dest": "/paper/arrival.html" - }, + { "src": "/", "dest": "/paper/arrival.html" }, + { "src": "^/index\\.html$", "status": 301, "headers": { "Location": "/" } }, + { "src": "^/research/?(index\\.html)?$", "status": 301, "headers": { "Location": "/" } }, { "handle": "filesystem" } ] } From 27b01934ad4afd81b16dcf8399d6f86cbfb2df0e Mon Sep 17 00:00:00 2001 From: Crystal Chang <223268516+Crystal32378@users.noreply.github.com> Date: Fri, 18 Sep 2026 12:51:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore(site):=20#33=20=E5=B0=8D=E9=BD=8A=20m?= =?UTF-8?q?ain=EF=BC=8B=E6=94=B9=E7=94=A8=20redirects/rewrites=EF=BC=88?= =?UTF-8?q?=E7=9C=9F=E6=B0=B8=E4=B9=85=E8=BD=89=E5=9D=80=EF=BC=89=EF=BC=8B?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=B8=AC=E8=A9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 福拆單後 #33 確定範圍:只退場公開路由,不刪 Apps Script/試算表/歷史回覆。 本次在 rebase 到 c26694b(含 #34 解曰層)後: - vercel.json 由 routes[](status:301,filesystem 排序脆弱)改為現代 redirects/rewrites: - redirects:/index.html、/research、/research/、/research/index.html → /(permanent=308) - rewrites:/ → /paper/arrival.html(URL 不變,root 仍進 Arrival) - scripts/test-routing.mjs(新):把新的 Vercel 路由真相變成可回歸的 15 項斷言 (root=rewrite 非 redirect/四條 legacy 皆 permanent 到 //favicon 存在且被引用/ 解曰 guard·artifact·custody 不受影響且 content_version 仍綁定/index.html 與 google-apps-script.gs 檔案保留=只退路由不刪資料) - test-draw-pool T5 標題校正:index.html 現為「已退場的 legacy route(檔案保留)」, 內容禁字檢查仍適用;路由真相移到 test-routing - favicon.svg+arrival 、README 指向 paper/arrival.html(沿用 #33 原提交) 未改:紙、draw pool、解曰三檔、綁定、聲音、Apps Script、試算表。 測試:routing 15/interp 29/arrival 36/sound 68/slip 14/pool 60 全綠。 Co-Authored-By: Claude Opus 4.8 (1M context) --- scripts/test-draw-pool.mjs | 7 +++++- scripts/test-routing.mjs | 48 ++++++++++++++++++++++++++++++++++++++ vercel.json | 13 +++++++---- 3 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 scripts/test-routing.mjs diff --git a/scripts/test-draw-pool.mjs b/scripts/test-draw-pool.mjs index bf3c9f9..da87599 100644 --- a/scripts/test-draw-pool.mjs +++ b/scripts/test-draw-pool.mjs @@ -160,7 +160,12 @@ buildMustFail("lone surrogate code unit in poem", (d) => (d.slips[13].poem_text buildMustFail("U+FFFD in edition_title", (d) => (d.slips[14].edition_title += "�")); // --------------------------------------------------------------------------- -console.log("T5 public page truth rules"); +// T5 — legacy index.html truth rules. Since #33 the live public page is +// paper/arrival.html (Vercel root rewrite) and index.html is a retired route +// (permanent redirect to /). The file is kept on disk, not deleted, so these +// content guarantees still apply to it (no banned oracle text, no inline arrays). +// Routing truth itself is asserted in scripts/test-routing.mjs. +console.log("T5 legacy index.html truth rules (retired route, file retained)"); const html = readFileSync(join(ROOT, "index.html"), "utf8"); const BANNED_PAGE_STRINGS = [ "神明正在回應中", diff --git a/scripts/test-routing.mjs b/scripts/test-routing.mjs new file mode 100644 index 0000000..d7d3574 --- /dev/null +++ b/scripts/test-routing.mjs @@ -0,0 +1,48 @@ +// test-routing.mjs — Vercel routing truth after legacy-route retirement (#33). +// The only production host is Vercel. Root serves Arrival (rewrite, URL unchanged); +// the legacy prototype routes are permanently redirected to root. The 解曰 layer +// (guard / artifact / custody) must be untouched by this change. +import { readFileSync, existsSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; + +const ROOT = join(dirname(fileURLToPath(import.meta.url)), ".."); +let pass = 0, fail = 0; +const check = (name, ok) => { console.log((ok ? " ✓ " : " ✗ ") + name); ok ? pass++ : fail++; }; + +const vc = JSON.parse(readFileSync(join(ROOT, "vercel.json"), "utf8")); + +console.log("A root still enters Arrival (rewrite, not redirect)"); +const rw = vc.rewrites || []; +check("/ rewrites to /paper/arrival.html", rw.some((r) => r.source === "/" && r.destination === "/paper/arrival.html")); +check("root is a rewrite, never a redirect (URL stays /)", !(vc.redirects || []).some((r) => r.source === "/")); + +console.log("B legacy routes are PERMANENT redirects to /"); +const reds = vc.redirects || []; +const permTo = (src) => reds.some((r) => r.source === src && r.destination === "/" && r.permanent === true); +check("/index.html → / (permanent)", permTo("/index.html")); +check("/research → / (permanent)", permTo("/research")); +check("/research/ → / (permanent)", permTo("/research/")); +check("/research/index.html → / (permanent)", permTo("/research/index.html")); +check("every redirect is permanent (308) and lands on /", reds.length > 0 && reds.every((r) => r.permanent === true && r.destination === "/")); +// modern config: routes[] must not coexist with redirects/rewrites (Vercel rejects the mix) +check("uses modern redirects/rewrites, not legacy routes[]", !("routes" in vc)); + +console.log("C favicon so the browser stops probing"); +check("favicon.svg exists and is non-empty", existsSync(join(ROOT, "assets/favicon.svg")) && readFileSync(join(ROOT, "assets/favicon.svg"), "utf8").length > 0); +const arrival = readFileSync(join(ROOT, "paper/arrival.html"), "utf8"); +check("arrival links the favicon", /]+rel="icon"[^>]+favicon\.svg/.test(arrival)); + +console.log("D 解曰 layer untouched by the routing change"); +check("guard + artifact + custody all present", ["assets/jieyue-guard.js", "assets/interpretation-pool.guanyin.js", "data/corpora/guanyin/jieyue_custody.json"].every((p) => existsSync(join(ROOT, p)))); +const win = {}; new Function("window", readFileSync(join(ROOT, "assets/interpretation-pool.guanyin.js"), "utf8"))(win); +const gwin = {}; new Function("window", readFileSync(join(ROOT, "assets/jieyue-guard.js"), "utf8"))(gwin); +check("guard content_version still bound to artifact", gwin.JIEYUE_GUARD.CONTRACT.content_version === win.INTERPRETATION_POOL.content_version); +check("arrival still loads guard + artifact", arrival.includes("jieyue-guard.js") && arrival.includes("interpretation-pool.guanyin.js")); + +console.log("E legacy index.html retained on disk (redirected, not deleted)"); +check("index.html file still exists (source kept; only the route retires)", existsSync(join(ROOT, "index.html"))); +check("research questionnaire source kept (Apps Script not deleted)", existsSync(join(ROOT, "research/google-apps-script.gs"))); + +console.log(`\n${pass} passed, ${fail} failed`); +process.exit(fail ? 1 : 0); diff --git a/vercel.json b/vercel.json index 379ca83..48227d8 100644 --- a/vercel.json +++ b/vercel.json @@ -1,9 +1,12 @@ { "$schema": "https://openapi.vercel.sh/vercel.json", - "routes": [ - { "src": "/", "dest": "/paper/arrival.html" }, - { "src": "^/index\\.html$", "status": 301, "headers": { "Location": "/" } }, - { "src": "^/research/?(index\\.html)?$", "status": 301, "headers": { "Location": "/" } }, - { "handle": "filesystem" } + "redirects": [ + { "source": "/index.html", "destination": "/", "permanent": true }, + { "source": "/research", "destination": "/", "permanent": true }, + { "source": "/research/", "destination": "/", "permanent": true }, + { "source": "/research/index.html", "destination": "/", "permanent": true } + ], + "rewrites": [ + { "source": "/", "destination": "/paper/arrival.html" } ] }