feat(console): API Key 介面錯位收斂為簡單 email+password 登入 (Arcrun#3 發現②)
背景:self-hosted 單租戶下 console 原本那格「API Key」其實只是 namespace 明碼字串,不是註冊制 key(leo 原話:理論上根本沒有 API Key 這件事)。leo 拍板: 換成簡單 email+password 登入頁(自己設一組帳密,不用 OAuth),登入成功後端發 session token 存 localStorage;後端 API 呼叫仍用固定租戶字串打 KBDB(登入系統 只擋外人看頁面,不做多租戶)。 租戶字串收斂:發現①已核實 owner_id='leo' 是 D1 中 458,357 筆資料實際使用的 租戶字串(ak_... 只有 2 筆孤兒資料)。CONSOLE_TENANT 預設 "leo",不製造第三個租戶。 新增: - cypher-executor/src/routes/console-auth.ts:/console/auth-status、 /console/setup(首次自助設定帳密,寫入 SESSIONS_KV console:credentials)、 /console/setup/reset(換帳密,需舊密碼)、/console/login、/console/session (驗 session + 回傳固定租戶字串)、/console/logout。密碼用 salt + 3 輪 SHA-256 雜湊,不存明碼。 - cypher-executor/src/types.ts:Bindings 加 CONSOLE_TENANT。 - cypher-executor/wrangler.toml:[vars] 加 CONSOLE_TENANT = "leo"。 - cypher-executor/src/routes/console.ts:① 卡片從「貼 API Key」改成登入/首次 設定表單;查詢函式改用登入後端回的固定租戶字串,使用者不再需要知道任何 namespace 字串。 驗證見 issue #3 留言。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import { executionsRouter } from './routes/executions';
|
||||
import { initSeedRouter } from './routes/init-seed';
|
||||
import { kbdbProxyRouter } from './routes/kbdb-proxy';
|
||||
import { consoleRouter } from './routes/console';
|
||||
import { consoleAuthRouter } from './routes/console-auth';
|
||||
|
||||
const app = new Hono<{ Bindings: Bindings }>();
|
||||
|
||||
@@ -52,6 +53,7 @@ app.route('/', executionsRouter); // LI SDD M2.1: /executions/* + /workflows/:n
|
||||
app.route('/', initSeedRouter); // 薄殼原則:seed recipe 是 API 行為(rule 07,壓測 §4.1)
|
||||
app.route('/', kbdbProxyRouter); // kbdb-base 9.5:KBDB 資料層 proxy(讓 CLI 透過 cypher 達 KBDB,純轉發)
|
||||
app.route('/', consoleRouter); // Arcrun#3:搜尋/控制台頁 v0(單檔 HTML+原生 JS,薄殼)
|
||||
app.route('/', consoleAuthRouter); // Arcrun#3 發現②:console 專用簡單 email+password 登入(單一管理員帳密,非多租戶)
|
||||
|
||||
// Worker 導出(fetch + scheduled)
|
||||
// scheduled handler 對應 wrangler.toml [triggers].crons,每分鐘 tick;
|
||||
|
||||
Reference in New Issue
Block a user