Files
pigway-frame-flow/pigway_frame_flow/integrations/kokonna_official/README.md
T

2.0 KiB

官方能力模块 / Official capabilities

Optional official-account integration, independent of the KoKonna device API Key client. The application composition root attaches it per configured device; the FrameDeviceDriver protocol does not depend on account login or widgets.

  • rpc.py: in-memory official login/session, disconnect, device discovery/detail and widget query. Strict method allowlist, no retries, no raw vendor errors.
  • widgets.py: normalized widget states and 60-second successful query cache.
  • capabilities.py: full discovered client operation inventory and evidence. Discovered does not mean implemented or enabled. Unenabled operations are blocked.
  • widget_catalog.json: dated, non-secret fallback catalog.

The public /api/v1/devices/{device_id}/widgets endpoint is unchanged. The old drivers.kokonna.widgets.WidgetReader import remains a compatibility re-export. No raw RPC proxy is exposed. The admin-only /official/connection endpoint provides login (POST), state/discovery (GET), local frame association (PUT), and local disconnect (DELETE), under /api/v1/devices/{device_id}. Browser requests use the existing Frame Flow session and CSRF protection; API clients require admin.

connection.py persists the official session and selected robot in /config/official-{device_id}.secret, atomically with mode 0600. Passwords are transient and never stored. These files must not be committed or exposed to users. Disconnect clears the local secret, including on restart; it does not revoke remote official account sessions. Expired sessions require logging in again. No login refresh or stored-password automatic retry is performed.

设备 API Key 仍负责现有设备、图片和图库接口。官方账号功能集中在本目录, 不进入 DisplayService、Renderer、Scheduler 或 FrameDeviceDriver。 账号连接页面与会话持久化已实现;额外写操作尚未实现。 所有已发现但未启用的 RPC 方法均拒绝执行,不复用 API Key 的写入开关。