feat(web): 改为通过 WebSocket 推送 ttyd 状态并清理轮询与冗余接口

This commit is contained in:
mofeng-git
2026-03-27 10:49:04 +08:00
parent e20136a5ab
commit 6bcb54bd22
15 changed files with 119 additions and 84 deletions

View File

@@ -1371,8 +1371,7 @@ mod tests {
// Test keyboard packet (8 bytes data)
let data = [0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00]; // 'A' key
let packet =
Ch9329Backend::build_packet(DEFAULT_ADDR, cmd::SEND_KB_GENERAL_DATA, &data);
let packet = Ch9329Backend::build_packet(DEFAULT_ADDR, cmd::SEND_KB_GENERAL_DATA, &data);
assert_eq!(packet[0], 0x57); // Header
assert_eq!(packet[1], 0xAB); // Header

View File

@@ -199,7 +199,12 @@ pub fn encode_keyboard_event(event: &KeyboardEvent) -> Vec<u8> {
let modifiers = event.modifiers.to_hid_byte();
vec![MSG_KEYBOARD, event_type, event.key.to_hid_usage(), modifiers]
vec![
MSG_KEYBOARD,
event_type,
event.key.to_hid_usage(),
modifiers,
]
}
/// Encode a mouse event to binary format (for sending to client if needed)