From 2dede46509c9902b206f25bb70604f40f10d0100 Mon Sep 17 00:00:00 2001 From: bigcode Date: Mon, 5 Oct 2026 02:04:13 +0800 Subject: [PATCH] =?UTF-8?q?v2.10.0:=20=E9=82=AE=E4=BB=B6=E9=93=BE=E8=B7=AF?= =?UTF-8?q?=20401=20=E4=BF=AE=E5=A4=8D=20+=20=E4=B8=80=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E4=B8=80=20token=20+=20=E9=87=8D=E8=A3=85=20Worker=20=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E2=80=94=E2=80=94workerAuth=20=E5=90=8C=E5=90=8D?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=92=9E=E8=BD=A6=E6=97=B6=E6=8C=89=E5=80=99?= =?UTF-8?q?=E9=80=89=E9=80=90=E4=B8=80=E9=AA=8C=E7=AD=BE=E7=A1=AE=E5=AE=9A?= =?UTF-8?q?=E5=BD=92=E5=B1=9E(=E4=BF=AE=20itekmedia=20=E6=94=B6=E4=B8=8D?= =?UTF-8?q?=E5=88=B0=E4=BB=B6);=E5=87=AD=E6=8D=AE=20token(credential=20id)?= =?UTF-8?q?=E7=83=A4=E8=BF=9B=20Worker=20=E8=84=9A=E6=9C=AC=E3=80=81Consol?= =?UTF-8?q?e=20=E6=8C=89=20token=20=E7=B2=BE=E7=A1=AE=E9=89=B4=E6=9D=83(?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E5=90=8D=E4=BB=85=E4=BD=9C=E6=97=A7=E7=89=88?= =?UTF-8?q?=E5=85=BC=E5=AE=B9);=E8=B4=A6=E5=8F=B7=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E3=80=8C=E9=87=8D=E6=96=B0=E5=AE=89=E8=A3=85?= =?UTF-8?q?=20Worker=20=E8=84=9A=E6=9C=AC=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- console/frontend/src/api.ts | 4 ++ console/frontend/src/pages/Accounts.tsx | 18 ++++++ console/frontend/src/pages/Logs.tsx | 1 + console/src/routes/internal.ts | 76 +++++++++++++++++-------- console/src/routes/resources.ts | 29 +++++++++- console/src/services/cfapi.ts | 12 ++-- console/src/services/provision.ts | 17 +++--- docs/04_NODE_PROTOCOL.md | 11 +++- docs/11_REFACTOR_PLAN.md | 2 +- package.json | 2 +- shared/src/email-worker-template.ts | 16 +++--- shared/src/protocol.ts | 14 +++-- tests/authorize.test.ts | 56 +++++++++++++++++- tests/helpers.ts | 2 +- tests/reinstall_worker.test.ts | 21 +++++++ tests/ui-smoke.ts | 13 +++++ worker/src/env.ts | 4 +- worker/src/index.ts | 4 +- worker/src/local.ts | 8 +-- 19 files changed, 242 insertions(+), 68 deletions(-) create mode 100644 tests/reinstall_worker.test.ts diff --git a/console/frontend/src/api.ts b/console/frontend/src/api.ts index d372a02..d2071e5 100644 --- a/console/frontend/src/api.ts +++ b/console/frontend/src/api.ts @@ -157,6 +157,10 @@ export const rotateAccount = (id: string) => export const getAccountWorkerSecret = (id: string) => api<{ worker_id: string; secret: string }>(`/api/accounts/${id}/worker-secret`); +/** 重新安装 Worker 脚本:不轮换凭据,用当前模板(Console 地址 + 凭据 token + secret)重渲染上传 */ +export const reinstallAccountWorker = (id: string) => + api<{ ok: boolean; worker_id: string }>(`/api/accounts/${id}/reinstall-worker`, "POST"); + /* ---- OAuth ---- */ /** OAuth 是否已配置(cloudflare = 可用;unconfigured = 缺少 client id/secret) */ diff --git a/console/frontend/src/pages/Accounts.tsx b/console/frontend/src/pages/Accounts.tsx index 235d132..349b683 100644 --- a/console/frontend/src/pages/Accounts.tsx +++ b/console/frontend/src/pages/Accounts.tsx @@ -24,6 +24,7 @@ import { getAccount, listAccounts, oauthStart, + reinstallAccountWorker, rotateAccount, updateAccount, type AccountDetail, @@ -428,6 +429,23 @@ function AccountDetailDrawer({ Email Worker 以该凭据直连 Console(/internal/email/authorize 与 /ingest);轮换后已配置的域名会自动重新部署。 +