From b1c5610f23ef2fa198940b951e0e0e7065803b45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B9=9B=E5=85=AE?= Date: Tue, 27 Oct 2026 11:40:22 +0800 Subject: [PATCH] =?UTF-8?q?feat(experiments):=20=E5=BC=80=E6=94=BE?= =?UTF-8?q?=E6=9C=AC=E4=BA=BA=E9=80=9A=E7=94=A8=E7=B1=BB=E5=9E=8B=E5=86=B3?= =?UTF-8?q?=E7=AD=96=E8=AF=BB=E5=8F=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - BFF:允许已登录用户按类型读取决策,拒绝对决策入口写操作 - README:补充类型消费者接入路径与后台验收边界 --- README.md | 2 ++ src/app/api/digital/[...path]/route.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 080df27..844cdef 100644 --- a/README.md +++ b/README.md @@ -130,3 +130,5 @@ pnpm start:prod - `DEEPSEEK_API_KEY` 仅在业务后端配置,前端不读取、不保存。 标签页图标采用 `public/stellar-icon-v2.svg`,同时提供多尺寸 `favicon.ico`、180/192/512 PNG,覆盖浏览器、Apple 主屏幕和 PWA。版本化资源路径用于刷新旧图标缓存。 + +通用实验消费者可经 `GET /api/digital/decisions/:key` 读取本人类型决策的 `data.value`,沿用 HttpOnly 会话与不缓存策略。类型、测试方案和用户分组全部在后台管理;新类型需要应用真实使用返回值并完成后台接入验收后才可启动。 diff --git a/src/app/api/digital/[...path]/route.ts b/src/app/api/digital/[...path]/route.ts index 348a79f..107d9df 100644 --- a/src/app/api/digital/[...path]/route.ts +++ b/src/app/api/digital/[...path]/route.ts @@ -33,11 +33,13 @@ async function proxy( const { path } = await context.params; const joined = path.join("/"); if ( - !/^(bootstrap|profile|exposure|conversations(?:\/[a-zA-Z0-9_-]+(?:\/(?:stream|stop|branch|messages\/[a-zA-Z0-9_-]+))?)?)$/.test( + !/^(bootstrap|profile|exposure|decisions\/[a-zA-Z0-9_-]+|conversations(?:\/[a-zA-Z0-9_-]+(?:\/(?:stream|stop|branch|messages\/[a-zA-Z0-9_-]+))?)?)$/.test( joined, ) ) return Response.json({ message: "接口不存在" }, { status: 404 }); + if (joined.startsWith("decisions/") && request.method !== "GET") + return Response.json({ message: "仅支持读取决策" }, {status:405,headers:{Allow:"GET"}}); if (request.method !== "GET") { const origin = request.headers.get("origin"); try { -- 2.52.0