Repository navigation
Copy keys and passwords client-side so Copy works over HTTP - #319
Merged
Merged
Conversation
The Security tab's key and fingerprint Copy buttons and the drive password Copy went through push_event and navigator.clipboard, which is undefined on the plain-HTTP device UI, yet showed "Copied" regardless. They now use the CopyToClipboard hook (execCommand fallback, honest outcome); the drive password Copy is offered only once revealed so the secret stays out of the DOM until then. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
After a mount-time SSHAccess failure, the fingerprint is never refreshed, so Copy keeps copying the unavailable placeholder and reporting success even after the service recovers.
1 open issue
What changed in this PR
Moves Security and drive-password copying to the existing client-side clipboard hook, addressing HTTP clipboard failures in #230 without reporting unconfirmed success.
Changes:
- Replaces server-driven copy events and state with client-side hooks.
- Preserves button icons during feedback and supports selecting input text after copy failure.
- Restricts drive-password copying to revealed passwords and updates LiveView tests.
| File | Description |
|---|---|
test/universal_proxy_web/live/security_live_test.exs |
Verifies clipboard hooks and selection-target attributes. |
test/universal_proxy_web/live/overview_live_test.exs |
Verifies Copy appears only while the password is revealed. |
lib/universal_proxy_web/live/security_live.ex |
Migrates key and fingerprint copying to client-side hooks. |
lib/universal_proxy_web/live/overview_live.ex |
Removes server-driven password copying and feedback state. |
lib/universal_proxy_web/components/storage.ex |
Adds a clipboard hook for the revealed drive password. |
assets/js/app.js |
Preserves icons, supports input selection, and removes the legacy copy listener. |
Review effort: Balanced
ssh_fingerprint/0 now returns nil when SSHAccess is unavailable, so the placeholder text is display-only and never lands in data-clipboard. The Copy button is disabled meanwhile, and a connected LiveView retries every 2 s until the fingerprint is readable. Co-Authored-By: Claude Opus 5.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.

Summary
CopyToClipboardhook, which falls back toexecCommandon plain HTTP and only shows "Copied" on confirmed success.phx:copylistener,push_event("copy")handlers and thecopied/ssh_copied/drive_password_copiedstate with their timers.data-copy-labelspan so icons survive, and selecting a failed copy's target works for<input>elements.Fixes #230
🤖 Generated with Claude Code