feat: add typed data and views with scoped device power

This commit is contained in:
Codex
2026-10-25 14:35:24 +08:00
parent 5b99a7e9fc
commit ca60398dea
65 changed files with 4238 additions and 231 deletions
+5 -1
View File
@@ -100,7 +100,11 @@ class Baidu:
if p.scheme != 'https' or not p.hostname or p.username or p.password or p.query or p.fragment or p.path != CALLBACK:
raise a.Problem('回调地址须为 HTTPS 站点地址加 '+CALLBACK)
changed = any(old.get(k) != v for k, v in dict(appKey=key, secretKey=secret, appFolder=folder, redirectUri=callback).items())
if changed and saved['connections']:
identity_changed = any(old.get(k) != v for k, v in dict(appKey=key, secretKey=secret, appFolder=folder).items())
# Moving this platform to a new HTTPS hostname does not change the
# authorized Baidu application or account. Keep its existing tokens;
# revision and pending-state invalidation prevent old OAuth completion.
if identity_changed and saved['connections']:
raise a.Problem('已有网盘授权,修改应用前须先解除共享网盘连接', 409)
saved['config'] = dict(appKey=key, secretKey=secret, appFolder=folder,
redirectUri=callback, revision=old.get('revision', 0)+1)