Three fixes for KVM port management:
1. HTML unescape scraped values — the > character in hotkey strings
(e.g., PrintScreen>0>1) gets entity-encoded to > in the device's
HTML. Added html_unescape() to the scraper so hotkeys round-trip
correctly.
2. Send hotkeys over WebSocket — port switching via the Belkin web form
only changes the active port number, it doesn't send the hotkey
sequence to the downstream KVM. Now when switching ports from the
console dropdown, blekin parses the Belkin hotkey syntax and sends
the key press/release sequence over the existing WebSocket connection.
3. New hotkey.ts parser — converts Belkin hotkey syntax to scancode
sequences:
- > and -> = sequential (tap each key)
- + = simultaneous (hold all, release in reverse)
- Supports all key names: PrintScreen, Ctrl, Alt, Shift, F1-F12,
letters, digits, navigation keys, numpad
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Belkin firmware requires:
1. A hidden __templates__ field in all form POSTs
2. Image button actions submitted as name.x=0&name.y=0 (not name=value)
3. ECG_kvm_powerport_cnt hidden field
Without these, the device returns "Permission denied" on port config
saves. Also fixed the switch endpoint with the same pattern.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Backend (crates/ericrfb-proxy):
- Session cookie now persisted in AppState for device API calls
- New kvm.rs with three REST endpoints:
GET /api/kvm/ports — scrapes kvm.asp, returns port config as JSON
PUT /api/kvm/ports — saves port names, hotkeys, visibility, count
POST /api/kvm/switch — switches active KVM port via home2.asp
- HTML scraping extracts form values from predictable firmware HTML
Frontend (crates/ericrfb-frontend):
- New shell.ts: sidebar navigation with page routing pattern
(Console, Ports — extensible for Virtual Media, Users, etc.)
- Console refactored into pages/console.ts with mount/unmount lifecycle
- Port switcher dropdown in toolbar (fetches port list, switches on change)
- WebSocket auto-reconnects after port switch
- New pages/ports.ts: editable port configuration table
- Port count, key pause duration, per-port name/hotkey/show-in-console
- Save, reload, and per-port switch buttons
- Active port highlighted
- Dark theme sidebar with active state indicators
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>