fix: rdp_type now actually types — clipboard + Ctrl+V keystroke sim
All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 4m44s
All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 4m44s
Was only setting the remote clipboard without pasting. Now sends clipboard content then simulates Ctrl+V (scancode 0x001D + 0x002F) with 50ms delay for clipboard propagation. Works for any text including special characters and multi-line content. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f578c434df
commit
1b7b1a0051
@ -504,9 +504,19 @@ async fn handle_rdp_click(AxumState(state): AxumState<Arc<McpServerState>>, Json
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_rdp_type(AxumState(state): AxumState<Arc<McpServerState>>, Json(req): Json<RdpTypeRequest>) -> Json<McpResponse<String>> {
|
async fn handle_rdp_type(AxumState(state): AxumState<Arc<McpServerState>>, Json(req): Json<RdpTypeRequest>) -> Json<McpResponse<String>> {
|
||||||
// Type text by sending it via clipboard paste (most reliable for arbitrary text)
|
// Set clipboard then simulate Ctrl+V to paste (most reliable for arbitrary text)
|
||||||
if let Err(e) = state.rdp.send_clipboard(&req.session_id, &req.text) { return err_response(e); }
|
if let Err(e) = state.rdp.send_clipboard(&req.session_id, &req.text) { return err_response(e); }
|
||||||
ok_response(format!("typed {} chars", req.text.len()))
|
// Small delay for clipboard to propagate, then Ctrl+V
|
||||||
|
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
|
||||||
|
// Ctrl down
|
||||||
|
let _ = state.rdp.send_key(&req.session_id, 0x001D, true);
|
||||||
|
// V down
|
||||||
|
let _ = state.rdp.send_key(&req.session_id, 0x002F, true);
|
||||||
|
// V up
|
||||||
|
let _ = state.rdp.send_key(&req.session_id, 0x002F, false);
|
||||||
|
// Ctrl up
|
||||||
|
let _ = state.rdp.send_key(&req.session_id, 0x001D, false);
|
||||||
|
ok_response(format!("typed {} chars via clipboard paste", req.text.len()))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_rdp_clipboard(AxumState(state): AxumState<Arc<McpServerState>>, Json(req): Json<RdpClipboardRequest>) -> Json<McpResponse<String>> {
|
async fn handle_rdp_clipboard(AxumState(state): AxumState<Arc<McpServerState>>, Json(req): Json<RdpClipboardRequest>) -> Json<McpResponse<String>> {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user