fix(webui): gate bootstrap API token issuance

This commit is contained in:
chengyongru authored and Xubin Ren committed 2026-07-08 21:01:48 +08:00
1 parent 7204d88a4c
commit 88143a8bf0
16 files changed
+219 -85

No files matched your search

+6
View File
@@ -50,6 +50,12 @@ class GatewayTokenStore:
self.api_tokens[token_value] = expiry
return token_value
def issue_api_token(self, ttl_s: int | float) -> str:
token_value = f"nbwt_{secrets.token_urlsafe(32)}"
expiry = time.monotonic() + float(ttl_s)
self.api_tokens[token_value] = expiry
return token_value
def take_issued_token_if_valid(self, token_value: str | None) -> bool:
if not token_value:
return False