Add device-bound robot notifications and automatic OAuth cards

This commit is contained in:
ex_tianzy
2026-10-28 16:33:14 +08:00
parent b774941890
commit f5a38e0808
19 changed files with 837 additions and 2 deletions
+3 -1
View File
@@ -20,6 +20,7 @@ class Transaction:
status: str = "waiting"
result: dict | None = None
owner: str = ""
host_id: str = ""
class Empty(BaseModel):
@@ -72,7 +73,8 @@ class OAuth:
if len(self.pending) >= self.settings.max_pending:
raise HTTPException(503, "too many pending transactions")
state, secret = secrets.token_urlsafe(32), secrets.token_urlsafe(32)
self.pending[state] = Transaction(hashlib.sha256(secret.encode()).hexdigest(), time.monotonic() + 600, owner=owner)
self.pending[state] = Transaction(hashlib.sha256(secret.encode()).hexdigest(), time.monotonic() + 600,
owner=owner, host_id=body.host_id)
redirect = self.settings.public_url.rstrip("/") + "/oauth/cb"
parameters = {"app_id": self.settings.feishu_app_id, "redirect_uri": redirect, "state": state}
if self.settings.feishu_oauth_scopes: