Remote: paste the phone clipboard, including images, on the desktop
CI / test (push) Failing after 1m2s

- Web UI: Ctrl+V, Ctrl+Shift+V, Shift+Insert (Cmd+V on Mac) and a Paste button send the phone clipboard (text or PNG, up to 16 MB) to the desktop over POST /api/clipboard
- chandra-remote passes clipboard data to the compositor in a sealed memfd (clipboard-set-fd), replacing the 4 KB hex clipboard-set line
- Compositor: new clipboard-status and input-paste commands; text is typed into the launcher, password dialog and shell popups, otherwise the paste chord is sent (Ctrl+Shift+V in terminals)
- Paste data is captured when a paste starts, so a clipboard change mid-transfer can't corrupt it
- VNC clipboard text limit raised from 4 KB to 1 MB
- Upload endpoints are authorized with the same token check as /ws; the no-header cross-site case is refused with 403
This commit is contained in:
nandi committed 2026-11-29 15:42:46 -08:00
1 parent 8a6d19d16f
commit d2e00b4658
11 files changed
+853 -68

No files matched your search

+2 -11
View File
@@ -571,7 +571,7 @@ static int rfb_handle_message(RfbClient *c) {
uint8_t hdr[7];
if (read_exact(c->fd, hdr, 7) < 0) return -1;
uint32_t len = get_be32(hdr + 3);
uint32_t take = len > 32768u ? 32768u : len;
uint32_t take = len > 1024u * 1024u ? 1024u * 1024u : len;
uint8_t *txt = take ? malloc(take) : NULL;
if (take && !txt) return -1;
if (take && read_exact(c->fd, txt, take) < 0) { free(txt); return -1; }
@@ -582,16 +582,7 @@ static int rfb_handle_message(RfbClient *c) {
if (read_exact(c->fd, drain, chunk) < 0) { free(txt); return -1; }
rem -= (uint32_t)chunk;
}
if (take > 0) {
size_t clen = take > 4096u ? 4096u : take;
char *cmd = malloc(16 + clen * 2 + 1);
if (cmd) {
memcpy(cmd, "clipboard-set ", 14);
hex_encode(txt, clen, cmd + 14);
ctl_fire(&c->app->ctl, cmd);
free(cmd);
}
}
if (take > 0) remote_clipboard_set(&c->app->ctl, "text/plain", txt, take, NULL);
free(txt);
break;
}