Feature/editor auth and testing - #39
Merged
Merged
Conversation
…, add .agent to gitignore
eigger
added a commit
that referenced
this pull request
Jul 7, 2026
* Add API token auth for non-browser API callers (Home Assistant rest_command) The editor session-cookie gate added in #38/#39 blocks any client that can't hold a cookie, breaking the documented Home Assistant rest_command power control integration (§8.6) with a 401. Adds a long-lived Authorization: Bearer <token> credential with the same scope as the admin session, viewable/ rotatable from editor Settings, and updates both install-device docs with the required header. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Let device commands be addressed by pairing token, expose both tokens in Settings Following up on the API token fix: HA still needed a separate authenticated GET /api/devices call just to resolve a display's internal UUID before it could call /command. The command route now accepts the pairing token directly (already known — it's in the "Open display" URL), and both the device token and the API token are shown together in editor Settings so there's nothing left to look up via curl. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Simplify: drop separate API token, device pairing token self-authorizes its own /command A dedicated admin-wide API token was redundant with the per-device pairing token that's already required in the same URL — two secrets to manage for one job. Now a device's own pairing token, when used in place of the internal id in /api/devices/<token>/command, is sufficient on its own: no Authorization header, no separate token to view/rotate. It only unlocks that one device's command endpoint; every other /api/* route still needs the admin session. Updated both install-device docs and the settings UI (now a single "device token" field instead of two). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Remove unused server backup/restore routes leaking a raw HA token Investigating whether the device pairing token belongs in device backups turned up that the editor's actual "백업 내보내기/가져오기" buttons never call GET/POST /api/devices/:id/backup|restore at all — they build and parse the backup JSON entirely client-side (layout + basic settings only, no tokens), matching the existing comment in editor.js. The server routes were dead code that returned the Home Assistant long-lived access token in plaintext (bypassing the masking /api/settings/ha applies), contradicting that same comment's stated intent. Removed the routes and the now-unused store.updateDeviceToken/updateToken statement. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.