Add isolated read-only official widget integration and searchable catalog

This commit is contained in:
Pigway
2026-10-02 16:20:54 +08:00
parent bfef1ad28d
commit 59fbdf7c1a
13 changed files with 1144 additions and 7 deletions
@@ -62,3 +62,35 @@ The selected-widget metadata extractor returned null for cover ID/name during th
Cleanup verified: PAC URL `(null)`, disabled; zero observer CA certificate entries in System keychain; observer terminated; private CA files removed; user session only existed in process memory and was discarded. Original HTTP/HTTPS/SOCKS proxy remains 127.0.0.1:7890. No official subscription/upload/display/delete writes were sent. Other NAS services and VPN application configuration were untouched.
Integration is now technically supported by live read evidence, not blocked on interface discovery. Remaining work is authenticated current-selection verification and an explicit maintainable official-session login/renewal strategy. Do not silently persist the captured WeChat session or commit it as configuration. Official RPC is undocumented and may change independently of OpenAPI.
## Read-only integration implemented
`GET /api/v1/devices/{device_id}/widgets` returns a typed catalog, source
(`live`, `snapshot`, `mock`), configuration status and verified current selection.
The template page provides searchable official widgets, separately from local
Frame Flow templates. Missing credentials show the 2026-10-02 observed catalog
of 75 entries; this is explicitly a snapshot, never a live subscription claim.
For an authorized official session, configure a device in `config/devices.yml`:
```yaml
devices:
living-room:
driver: kokonna
api_key_env: KOKONNA_API_KEY
widget_token_env: KOKONNA_WIDGET_TOKEN
widget_robot_id: 123 # replace with the official internal robot ID
enabled: true
```
Supply `KOKONNA_WIDGET_TOKEN_FILE` pointing to a protected mounted secret file,
or inject `KOKONNA_WIDGET_TOKEN`. This credential is a separate official user
session, not the OpenAPI device key or Frame Flow login password. No observed
WeChat session has been persisted. Sessions may expire; there is no automatic
WeChat login or refresh implementation yet. Successful reads are cached for
60 seconds. Raw robot data, token-bearing URLs and argument values are omitted.
Only `appFrame.getFrameCovers` is callable by this integration. Widget selection,
subscription mutation and cancellation are not implemented or executed. A null
or unmatched current selection returns `CURRENT_UNVERIFIED`, not “no subscription”.
This private RPC contract is unofficial and may change independently of OpenAPI.