Repository navigation
✨ feat(dashboard): read-only widget token and Add-to-iPhone QR page - #12173
Conversation
Owners mint a read-only widget token from the iPhone widget dialog; it is stored hashed and authenticates only GET /api/widget/summary via the X-Hive-Widget-Token header. The dialog renders a QR code of the Scriptable setup deep link, shows last use, and can revoke the token. The hub lets the summary path through its auth gate so the spoke can check the token. Adds a web app manifest and apple-touch-icon for Home Screen bookmarks. Closes #12147 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <scanner@hive.kubestellar.io> Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
…t baselines TestStyleRatchet flagged one new raw colour in static/index.html (the white QR backdrop) and three hub static baselines that drifted below their constants on v5. Use --infra-logo-chip-bg (the existing theme-stable white used for image chips) and lower the hub baselines to 945/448/426 so the ratchet keeps biting. Signed-off-by: scanner <scanner@hive.kubestellar.io>
|
hive/awaiting-ci: pushed fix for TestStyleRatchet (QR backdrop now uses 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Summary
Adds a read-only widget token for the iPhone widget, plus an "Add to iPhone" flow with a QR code in the existing 📱 iPhone widget dialog, and PWA polish.
Spoke
POST /api/widget/token(owner only, viarequireOwnerRole) mintshwt_<256-bit hex>, replacing any previous token. Returns the plaintext once with ascriptable:///run/Hive?url=<hive>&widgetToken=<tok>setup link and a QR PNG (data URL, rendered with the existingskip2/go-qrcodedependency). Only the SHA-256 is stored, in/data/widget-token.json(mode 0600).GET /api/widget/token(owner only) reports configured / createdAt / createdBy / lastUsedAt and never returns the token.DELETErevokes it and is idempotent.GET /api/widget/summaryreturns everything the widget renders: eval history plus each agent's name and state.authenticateaccepts the widget token only for GET/HEAD of/api/widget/summary, and only in theX-Hive-Widget-Tokenheader. The request then runs as aread-role identity with no owner marker. Every other path, including mutations and the token endpoints, returns 401 to it. It is never accepted inAuthorization, so it can't act as a session.lastUsedAtis recorded at most every 10 minutes. The update re-checks the hash under the lock, so it can't bring back a revoked token.Hub
/api/widget/summaryis added to the auth-check public exact paths. This follows the/api/knowledge/exportapproach: the hub lets the request through and the spoke does the real check.UI and widget
widgetToken=from the deep link and stores it per hive in the Keychain. When it has one, it calls/api/widget/summary. The GitHub-token path still works as before.manifest.webmanifest,apple-touch-icon.png(the repo's bee), andapple-mobile-web-app-title.Docs (
src/docs/ios-widget.md), OpenAPI entries, and a changelog fragment are included. Unit tests are inwidget_token_test.go, the hub public-path test, andios_widget_static_test.go. They were not run locally; CI will run them.Deliberate deviations from the issue proposal
/api/history,/api/status/summaryand/api/pr-throughputand act as the minting user. I narrowed this so the token can't be used anywhere beyond what the widget draws.Authorizationwould make the hub forward the token to github.com as a GitHub token.widgetToken=instead oftoken=, so it isn't mistaken for a GitHub token."display": "browser", so hub login redirects keep working instead of opening a standalone app.Closes #12147
Refs #12148: the hub-wide fleet widget is not done here. It depends on this token and needs its own hub-side design: a per-user hub token and fan-out across the owner's hives.
— hive: agent=scanner backend=copilot model=claude-fable-5.1 requested_by=@clubanderson