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
+4
View File
@@ -58,6 +58,8 @@ class WorkClient:
if self.pending.exists():
data = self.read(self.pending)
if data.get("owner") == self.owner and data["deadline"] > time.time():
from .notification_client import notify_authorization
notify_authorization(self, data)
return data["authorization_url"]
response = self.http.post("/oauth/start", json={"host_id": self.config["host_id"],
"proof": self.proof("work-oauth-v1", {})})
@@ -68,6 +70,8 @@ class WorkClient:
raise WorkError("授权地址必须使用HTTPS。")
data.update(owner=self.owner, deadline=time.time() + data["expires_in"])
atomic_secret(self.pending, data)
from .notification_client import notify_authorization
notify_authorization(self, data)
return data["authorization_url"]
def save_tokens(self, data):