[Bug]: Mobile clipboard paste silently fails over HTTP LAN sessions and pastes stale host clipboard

Open
#437 3 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 2 days

@nishtha-agarwal-211 is already working on this.

Since Oct 25, 2026.

  • #438 by @ezeslucky — closed without merging
  • #439 by @nishtha-agarwal-211 — closed without merging

Assessment

This issue has not been assessed yet.

Description

bug
Bug Description

When controlling the desktop host from a mobile browser connected over a local network (e.g., http://192.168.x.x:3000), tapping the Paste button on the trackpad control bar fails to paste the mobile device's clipboard text onto the desktop host. Instead, the desktop host pastes whatever text was already residing in the host OS clipboard.

Root Cause:
  1. Over LAN HTTP (window.isSecureContext === false), navigator.clipboard.readText() in src/routes/trackpad.tsx throws NotAllowedError or is undefined.
  2. clientText becomes undefined, causing the client to send { sessionId } without a text payload.
  3. In src/server/signalling/server.ts, the server bypasses updating the host clipboard and executes handler.handleMessage({ type: "paste" }), pasting stale host clipboard data via simulated Ctrl+V/Cmd+V.
Steps to Reproduce
  1. Start the Rein server on the host machine (npm run dev or production build).
  2. On a mobile phone (iOS Safari or Android Chrome), connect to the server via local IP (e.g., http://192.168.1.15:3000/trackpad?token=...).
  3. Copy any text on the mobile phone (e.g., from Notes, browser, or messaging app).
  4. Focus a text editor on the desktop host (e.g., Notepad, TextEdit, VS Code).
  5. On the phone's Rein trackpad interface, tap the Paste button on the control bar.
  6. Observe that the text copied on the phone is not pasted, and the desktop instead pastes previous host clipboard content with no UI feedback.
Expected Behavior

When navigator.clipboard.readText() is unavailable (insecure context or denied permission):

  1. Rein should provide an interactive fallback modal or text input prompt (e.g., a DaisyUI modal stating "Paste text here to send to desktop").
  2. The user can long-press and use native mobile paste into the input field.
  3. Submitting the modal sends the pasted string to POST /api/clipboard/paste as { sessionId, text }, correctly injecting it onto the host clipboard and pasting it into the active window.
  4. If cancelled or empty, show a toast notification explaining why direct clipboard reading was blocked over plain HTTP.
Desktop Operating System

macOS (Apple Silicon)

Client OS and browser

iOS 17+ Safari, Android 14+ Chrome

Rein Version

0.5.0

Console Logs / Error Messages (Optional)

Screenshots / Recordings (Optional)

No response

Checklist
  • I have searched for existing issues to avoid duplicates
Dominant language
TypeScript
Stars
55
Forks
120
Avg merge
4d 5h
Merged PRs (30d)
24

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AOSSIE-Org/Rein

All issues in AOSSIE-Org/Rein

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.