Add device-bound robot notifications and automatic OAuth cards
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user