feat: web command console v1 (GET /console) (#57)

Co-authored-by: host <host@test.local>
This commit is contained in:
openqjandhost authored and GitHub committed 2026-10-27 01:02:24 +08:00
1 parent c6e633d162
commit e40c2c33bb
4 files changed
+441

No files matched your search

+13
View File
@@ -685,6 +685,19 @@ class CloudControlPlaneHandler(BaseHTTPRequestHandler):
"commit": _deployed_commit(),
})
return
if path == "/console" and method == "GET":
# 命令台 v1:只出静态壳,不走鉴权与限流(与 /health 同款
# pre-auth 待遇)。壳里没有任何数据;数据一律凭用户在
# 浏览器里填的 X-API-Key 调接口,key 只存在用户浏览器
# localStorage。页面文件与 server.py 同目录,改动随部署走。
try:
here = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(here, "console.html"),
"r", encoding="utf-8") as f:
self._send_html(200, f.read())
except OSError:
self._send_json(404, {"error": "console not found"})
return
if path.startswith("/oauth/"):
# OAuth 登录/回调是 pre-auth 端点(用户还没本站 API key,
# 这正是 OAuth 要解决的问题),靠 state + client_secret