kvm/ui
Alex P 64a6a1a078 fix: resolve intermittent mouse control loss and add permission logging
This commit addresses three critical issues discovered during testing:

Issue 1 - Intermittent mouse control loss requiring page refresh:
When a session was promoted to primary, the HID queue handlers were fetching
a fresh session copy from the session manager instead of using the original
session pointer. This meant the queue handler had a stale Mode field (observer)
while the manager had the updated Mode (primary). The permission check would
fail, silently dropping all mouse input until the page was refreshed.

Issue 2 - Missing permission failure diagnostics:
When keyboard/mouse input was blocked due to insufficient permissions, there
was no debug logging to help diagnose why input wasn't working. This made
troubleshooting observer mode issues extremely difficult.

Issue 3 - Session timeout despite active jiggler:
The server-side jiggler moves the mouse every 30s after inactivity to prevent
screen savers, but wasn't updating the session's LastActive timestamp. This
caused sessions to timeout after 60s even with the jiggler active.

Issue 4 - Session flapping after emergency promotion:
When a session timed out and another was promoted, the newly promoted session
had a stale LastActive timestamp (60+ seconds old), causing immediate re-timeout.
This created an infinite loop where both sessions rapidly alternated between
primary and observer every second.

Issue 5 - Unnecessary WebSocket reconnections:
The WebSocket fallback was unconditionally closing and reconnecting during
emergency promotions, even when the connection was healthy. This caused
spurious "Connection Issue Detected" overlays during normal promotions.

Changes:
- webrtc.go: Use original session pointer in handleQueues() (line 197)
- hidrpc.go: Add debug logging when permission checks block input (lines 31-34, 61-64, 75-78)
- jiggler.go: Update primary session LastActive after mouse movement (lines 146-152)
- session_manager.go: Reset LastActive to time.Now() on promotion (line 1090)
- devices.$id.tsx: Only reconnect if connection is unhealthy (lines 413-425)

This ensures:
1. Queue handlers always have up-to-date session state
2. Permission failures are visible in logs for debugging
3. Jiggler prevents both screen savers AND session timeout
4. Newly promoted sessions get full timeout period (no immediate re-timeout)
5. Emergency promotions only reconnect when connection is actually stale
6. No spurious "Connection Issue" overlays during normal promotions
2025-10-16 00:27:51 +03:00
..
public Update UI dependencies (#819) 2025-09-24 12:16:02 +02:00
src fix: resolve intermittent mouse control loss and add permission logging 2025-10-16 00:27:51 +03:00
.env.cloud-development feat(cloud): Add custom cloud API URL configuration support (#181) 2025-02-25 16:10:46 +01:00
.env.cloud-production feat(cloud): Add custom cloud API URL configuration support (#181) 2025-02-25 16:10:46 +01:00
.env.cloud-staging feat(cloud): Add custom cloud API URL configuration support (#181) 2025-02-25 16:10:46 +01:00
.gitignore Release 202412292127 2024-12-29 21:27:42 +01:00
.prettierrc refactor: network settings UI (#486) 2025-05-20 15:22:08 +02:00
dev_device.sh network enhanecment / refactor (#361) 2025-04-16 01:39:23 +02:00
eslint.config.cjs Add ability to track modifier state on the device (#725) 2025-08-26 17:09:35 +02:00
index.html Update UI dependencies (#819) 2025-09-24 12:16:02 +02:00
package-lock.json upgrade ui packages (#861) 2025-10-01 21:43:46 +02:00
package.json upgrade ui packages (#861) 2025-10-01 21:43:46 +02:00
postcss.config.js chore: Upgrade UI vite and tailwind packages (#443) 2025-05-15 14:21:03 +02:00
tailwind.config.js chore(ui): Patch-bump packages and use tailwind upgrade (#456) 2025-05-16 19:59:57 +02:00
tsconfig.json chore(ui): Clean up warnings (#536) 2025-05-30 15:01:32 +02:00
tsconfig.node.json Release 202412292127 2024-12-29 21:27:42 +01:00
vite-env.d.ts Release 202412292127 2024-12-29 21:27:42 +01:00
vite.config.ts chore: enhance the gzip and cacheable handling of static files 2025-09-12 08:41:41 +02:00