feat: 用安装页和编排完成部署,并整理登录页

This commit is contained in:
2026-10-30 09:49:20 +08:00
parent 7ed299bbf6
commit 3fa4f83180
30 changed files with 635 additions and 121 deletions
+14 -1
View File
@@ -8,7 +8,7 @@ import os
import time
from typing import Any
from app.config import jwt_secret
from app.config import installed
ITERATIONS = 200_000
TOKEN_TTL = 12 * 60 * 60
@@ -36,6 +36,19 @@ def _decode(raw: str) -> dict[str, Any]:
return json.loads(base64.urlsafe_b64decode(padded.encode("ascii")))
def jwt_secret() -> str:
if not installed():
raise RuntimeError("尚未安装")
from app.db import session_scope
from app.models import AppSetting
with session_scope() as session:
setting = session.get(AppSetting, 1)
if setting is None or not setting.jwt_secret:
raise RuntimeError("尚未安装")
return setting.jwt_secret
def issue_token(payload: dict[str, Any]) -> str:
body = {**payload, "exp": int(time.time()) + TOKEN_TTL}
raw = _encode(body)