fix(peering): key display, reliable copy, key-id hint (#136) #137

Merged
Cordy merged 1 commit from fix/peering-key-display into main 2026-08-07 20:21:05 +00:00
Owner

Closes #136.

Root cause: the issue-key handler read r.key off the raw Response returned by api() without ever calling .json() — the one-time key was never displayed (empty bar) and the click-to-copy copied undefined. The stray "Copied" bubble at the viewport origin came from copyText being called without its btn positioning argument.

Fix:

  • Parse the response (await res.json()).
  • Replace the invisible click-to-copy <p> with a labelled one-time-key block: "One-time key for {peer} — copy it now, it is not shown again." + readonly mono input + explicit Copy button. Copy selects the visible input and uses document.execCommand("copy") first (works inside a modal dialog on plain-HTTP LAN origins where navigator.clipboard does not exist), async clipboard as the HTTPS path. Feedback lands in the dialog's own message line.
  • listKeys now returns the stored non-secret id (derived from the public key; the secret is KeyPrefix + b64(priv) and never stored). The issued list renders Hyrsh 3f2a91c8d1… in faded mono so a row is identifiable.
  • Stale secret value cleared when the dialog reopens.

i18n en/de/fr/it. Green on the branch: gofmt/vet clean, full go test ./..., both JS blocks pass node --check. Also removes the two scout workflows from .forgejo/workflows/.

Closes #136. **Root cause:** the issue-key handler read `r.key` off the raw `Response` returned by `api()` without ever calling `.json()` — the one-time key was never displayed (empty bar) and the click-to-copy copied `undefined`. The stray "Copied" bubble at the viewport origin came from `copyText` being called without its `btn` positioning argument. **Fix:** - Parse the response (`await res.json()`). - Replace the invisible click-to-copy `<p>` with a labelled one-time-key block: "One-time key for {peer} — copy it now, it is not shown again." + readonly mono input + explicit **Copy** button. Copy selects the visible input and uses `document.execCommand("copy")` first (works inside a modal dialog on plain-HTTP LAN origins where `navigator.clipboard` does not exist), async clipboard as the HTTPS path. Feedback lands in the dialog's own message line. - `listKeys` now returns the stored non-secret `id` (derived from the public key; the secret is `KeyPrefix + b64(priv)` and never stored). The issued list renders `Hyrsh 3f2a91c8d1…` in faded mono so a row is identifiable. - Stale secret value cleared when the dialog reopens. i18n en/de/fr/it. Green on the branch: gofmt/vet clean, full `go test ./...`, both JS blocks pass `node --check`. Also removes the two scout workflows from `.forgejo/workflows/`.
fix(peering): parse issue-key response, reliable copy, key-id hint in issued list (#136)
All checks were successful
ci / test-and-build (pull_request) Successful in 32s
39558f7a3c
Cordy merged commit ec318eec01 into main 2026-08-07 20:21:05 +00:00
Cordy deleted branch fix/peering-key-display 2026-08-07 20:21:09 +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: Cordy/Cairn#137
No description provided.