Add host mode to limit what phones can control #29

Merged
nezumi merged 1 commit from feat/host-mode into dev 2026-11-22 07:36:32 +00:00
Owner

Adds an optional Host mode (ADR 0006) so phones can be limited to "member" rights while hosts keep full control.

What changes

  • TV Settings → "Quyền điều khiển": Host mode switch (off by default) and a "Quản lý host" dialog with the 6-digit host PIN, "Đổi PIN", and the list of connected phones to promote/demote.
  • Rules when on (TV remote always has full control):
    • Members: search, add, start, favorite; remove/move their own queue items; skip/restart/seek only their own song.
    • Members cannot: pause/play, play next/now, volume, clear queue, touch other people's songs → forbidden toast.
    • Hosts: full control. Become host by entering the PIN on the phone (5 wrong tries/min per device) or being picked on the TV.
  • Protocol: hk WS param, hostKey message, claimHost/leaveHost, per-connection you.role, hostMode, QueueItem.mine. Owner ids never go out on the wire. "Đổi PIN", "Đổi mã" and turning the mode off revoke all host keys.
  • Remote: role chip, PIN sheet, forbidden controls hidden (not disabled) for members.
  • Docs: ADR 0006, docs/protocol.md, CONTEXT.md, updated UI prototype; mock server emulates host mode (PIN 123456).

Verified

  • pnpm typecheck (remote)
  • ./gradlew :app:testDebugUnitTest :app:assembleDebug — 86 tests, 0 failures
  • Remote flows checked headless against the mock server.
  • Not yet tried on a real TV (layout/D-pad focus of the new dialog).

Vi: Thêm Chế độ host để giới hạn quyền điều khiển của điện thoại, chỉ host mới được tạm dừng, chen bài và xử lý bài của người khác

Adds an optional **Host mode** (ADR 0006) so phones can be limited to "member" rights while hosts keep full control. ## What changes - **TV Settings → "Quyền điều khiển"**: Host mode switch (off by default) and a "Quản lý host" dialog with the 6-digit host PIN, "Đổi PIN", and the list of connected phones to promote/demote. - **Rules when on** (TV remote always has full control): - Members: search, add, start, favorite; remove/move their own queue items; skip/restart/seek only their own song. - Members cannot: pause/play, play next/now, volume, clear queue, touch other people's songs → `forbidden` toast. - Hosts: full control. Become host by entering the PIN on the phone (5 wrong tries/min per device) or being picked on the TV. - **Protocol**: `hk` WS param, `hostKey` message, `claimHost`/`leaveHost`, per-connection `you.role`, `hostMode`, `QueueItem.mine`. Owner ids never go out on the wire. "Đổi PIN", "Đổi mã" and turning the mode off revoke all host keys. - **Remote**: role chip, PIN sheet, forbidden controls hidden (not disabled) for members. - **Docs**: ADR 0006, `docs/protocol.md`, `CONTEXT.md`, updated UI prototype; mock server emulates host mode (PIN 123456). ## Verified - `pnpm typecheck` (remote) - `./gradlew :app:testDebugUnitTest :app:assembleDebug` — 86 tests, 0 failures - Remote flows checked headless against the mock server. - Not yet tried on a real TV (layout/D-pad focus of the new dialog). Vi: Thêm Chế độ host để giới hạn quyền điều khiển của điện thoại, chỉ host mới được tạm dừng, chen bài và xử lý bài của người khác
Add host mode to limit what phones can control
All checks were successful
CI / build (pull_request) Successful in 4m52s
6db2a37a33
Optional "Host mode" in TV Settings (off by default). When on, phones are
either hosts or members: members can search, add songs and manage only
their own queue items; hosts (PIN entered on the phone, or picked on the
TV) keep full control. The TV remote always has full control.

- TV: Settings group "Quyền điều khiển", host management dialog (PIN,
  change PIN, promote/demote connected phones).
- Server: host keys issued by the TV, per-connection snapshots with
  `you.role` and `mine`, `claimHost`/`leaveHost`, `forbidden` toasts,
  rate-limited PIN attempts.
- Remote: role chip, PIN sheet, forbidden controls hidden for members.
- Docs: ADR 0006, protocol, CONTEXT, prototype.

Vi: Thêm Chế độ host để giới hạn quyền điều khiển của điện thoại, chỉ host mới được tạm dừng, chen bài và xử lý bài của người khác
nezumi deleted branch feat/host-mode 2026-11-22 07:36:32 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nezumi/kara-tv-app!29
No description provided.