Skip to content

feat: add clipboard API for remote browser clipboard access#68

Open
aakhter wants to merge 1 commit intoArk0N:masterfrom
aakhter:feat/clipboard-api
Open

feat: add clipboard API for remote browser clipboard access#68
aakhter wants to merge 1 commit intoArk0N:masterfrom
aakhter:feat/clipboard-api

Conversation

@aakhter
Copy link
Copy Markdown
Contributor

@aakhter aakhter commented Apr 12, 2026

Summary

Adds a clipboard API endpoint that pushes text to all connected browsers via SSE.

  • POST /api/clipboard with { "text": "..." } broadcasts a clipboard write event
  • Browser attempts navigator.clipboard.writeText() for seamless copy
  • Falls back to a modal with manual copy button if browser blocks auto-copy (e.g., page not focused)
  • New SSE event: clipboard:write

Use case

When accessing Codeman remotely, CLI tools and scripts can push text to the user's browser clipboard across the network. Useful for copying code snippets, URLs, or command output from remote sessions.

Test plan

  • curl -X POST /api/clipboard -d '{"text":"hello"}' copies "hello" to browser clipboard
  • If browser blocks auto-copy, fallback modal appears with the text
  • Manual copy button in fallback modal works
  • Multiple connected browsers all receive the clipboard event

POST /api/clipboard with { text } broadcasts to all connected browsers
via SSE. Browser attempts navigator.clipboard.writeText, falling back
to a modal with manual copy button if blocked.

Enables remote clipboard workflows: CLI tools can push text to the
user's browser clipboard across the network.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant