mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-27 20:00:51 +00:00
* feat(remote-desktop): add built-in VNC and RDP support, JumpServer RDP, AI vision, monitoring, and recordings * fix(build): move ironrdp-web patches out of patch-package directory * perf(remote-desktop): coalesce pointer/snip events, zero-copy VNC paint, and memoize views * fix(remote-desktop): prevent StrictMode WS one-time token race and improve new-host protocol switch * style(remote-desktop): align toolbar height to 36px, refine overlays, and complete zh-CN/en i18n * fix(rdp): fallback to TLS 1.2 kRSA when Electron BoringSSL rejects Windows RDP cert KEY_USAGE_BIT_INCORRECT * feat(remote-desktop): responsive toolbar overflow, fix RDP HiDPI scaling, add Cmd-to-Ctrl, VNC refresh, and protocol-aware keys * feat(remote-desktop): add RDP multi-monitor/RDPDR, telemetry, AI Computer Use, VNC upgrades, and perf hardening
57 lines
2.4 KiB
TypeScript
57 lines
2.4 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import {
|
|
domCodeToQemuKeycode,
|
|
domEventToVncKeysym,
|
|
textToVncKeysymSequence,
|
|
unicodeCharToVncKeysym,
|
|
VNC_SPECIAL_CHORDS,
|
|
X11_KEYSYM,
|
|
} from './vncKeymap';
|
|
|
|
test('vncKeymap maps modifiers, navigation, function keys, and numpad keys', () => {
|
|
assert.equal(domEventToVncKeysym({ key: 'Control', code: 'ControlLeft' }), X11_KEYSYM.Control_L);
|
|
assert.equal(domEventToVncKeysym({ key: 'Control', code: 'ControlRight' }), X11_KEYSYM.Control_R);
|
|
assert.equal(domEventToVncKeysym({ key: 'Alt', code: 'AltRight' }), X11_KEYSYM.Alt_R);
|
|
assert.equal(domEventToVncKeysym({ key: 'Meta', code: 'MetaLeft' }), X11_KEYSYM.Super_L);
|
|
assert.equal(domEventToVncKeysym({ key: 'ArrowUp', code: 'ArrowUp' }), X11_KEYSYM.Up);
|
|
assert.equal(domEventToVncKeysym({ key: 'Delete', code: 'Delete' }), X11_KEYSYM.Delete);
|
|
assert.equal(domEventToVncKeysym({ key: 'F12', code: 'F12' }), X11_KEYSYM.F12);
|
|
assert.equal(domEventToVncKeysym({ key: 'Enter', code: 'NumpadEnter' }), X11_KEYSYM.KP_Enter);
|
|
});
|
|
|
|
test('vncKeymap maps printable ASCII, Latin-1, and Unicode characters with 0x01000000 bit', () => {
|
|
assert.equal(domEventToVncKeysym({ key: 'a', code: 'KeyA' }), 0x61);
|
|
assert.equal(domEventToVncKeysym({ key: 'A', code: 'KeyA' }), 0x41);
|
|
assert.equal(domEventToVncKeysym({ key: 'é' }), 0xe9);
|
|
assert.equal(unicodeCharToVncKeysym('中'), 0x01000000 | 0x4e2d);
|
|
assert.equal(domEventToVncKeysym({ key: 'Process' }), null);
|
|
assert.equal(domEventToVncKeysym({ key: 'Dead' }), null);
|
|
});
|
|
|
|
test('vncKeymap maps DOM codes to QEMU extended XT scancodes', () => {
|
|
assert.equal(domCodeToQemuKeycode('KeyA'), 0x1e);
|
|
assert.equal(domCodeToQemuKeycode('ControlLeft'), 0x1d);
|
|
assert.equal(domCodeToQemuKeycode('ControlRight'), 0x80 | 0x1d);
|
|
assert.equal(domCodeToQemuKeycode('ArrowUp'), 0x80 | 0x48);
|
|
assert.equal(domCodeToQemuKeycode('Delete'), 0x80 | 0x53);
|
|
assert.equal(domCodeToQemuKeycode('MetaLeft'), 0x80 | 0x5b);
|
|
assert.equal(domCodeToQemuKeycode('UnknownKey'), null);
|
|
});
|
|
|
|
test('vncKeymap converts clipboard strings into X11 keysym sequences', () => {
|
|
assert.deepEqual(textToVncKeysymSequence('Hi!\r\n\t中'), [
|
|
0x48,
|
|
0x69,
|
|
0x21,
|
|
X11_KEYSYM.Return,
|
|
X11_KEYSYM.Tab,
|
|
0x01000000 | 0x4e2d,
|
|
]);
|
|
assert.deepEqual(VNC_SPECIAL_CHORDS['ctrl-alt-del'], [
|
|
X11_KEYSYM.Control_L,
|
|
X11_KEYSYM.Alt_L,
|
|
X11_KEYSYM.Delete,
|
|
]);
|
|
});
|