fix(screen-mirror): grant display-capture permission + Flatpak pipeline - #266
fix(screen-mirror): grant display-capture permission + Flatpak pipeline#266Muneerali199 wants to merge 4 commits into
Conversation
…OSSIE-Org#130) - Add koffi@2.15.1 as production dependency - Add src/server/VirtualInput.ts: platform-native VirtualInputDriver interface with Windows (user32.dll SendInput), Linux (/dev/uinput), macOS (CoreGraphics) implementations; createVirtualInput() factory selects driver at runtime - Rewrite move/click/scroll in InputHandler.ts to use VirtualInput; NutJS retained only for keyboard actions (key, combo, text, copy, paste, zoom modifier) - Add InputHandler.cleanup() and call it in websocket.ts on wss close - Add poc/virtual-input.cjs: standalone runnable PoC (node poc/virtual-input.cjs) covering all 9 operations; tested and confirmed working on Windows 10 Closes AOSSIE-Org#130
- poc/virtual-input.cjs: fix run command in header comment (.js -> .cjs)
- VirtualInput.ts: add leftDown/leftUp, rightDown/rightUp, middleDown/middleUp
for press-only / release-only drag support on all three platforms
- VirtualInput.ts: fix macOS scrollH — use CGEventCreateScrollWheelEvent with
wheelCount=2 and wheel2 arg so horizontal scroll is no longer a no-op
- InputHandler.ts: click case now respects msg.press (true=down, false=up,
undefined=full click) enabling drag flows
- InputHandler.ts: wrap vi.init() in constructor try/catch; server startup
continues with vi=null if virtual device cannot be opened, all vi call
sites guard against null
- InputHandler.ts: cleanup() cancels pending move/scroll timers and sets
isShuttingDown flag before destroying the device; timer callbacks guard
isShuttingDown so no event fires after cleanup
- websocket.ts: replace wss.on('close') (never fires for noServer:true WSS)
with server.on('close') on the underlying HTTP server so cleanup runs
reliably on Vite dev server shutdown
- poc/README.md: add architecture diagram, comparison table vs NutJS,
per-platform run instructions, and operation coverage table
- virtual-input-poc.cjs: standalone PoC (move, click, scroll) on Windows/Linux/macOS - POC_README.md: quick test instructions + why this approach beats NutJS Run: node virtual-input-poc.cjs (Linux: sudo node virtual-input-poc.cjs)
…utables - Add setPermissionRequestHandler and setPermissionCheckHandler to BrowserWindow session so getDisplayMedia is not silently denied in packaged builds (Bug AOSSIE-Org#254) - Add macOS screen recording permission check at app startup - Add contextIsolation/nodeIntegration webPreferences - Add macOS activate handler for dock re-open - Add linux target (dir) to package.json for electron-builder - Add flatpak/ directory with Flatpak manifest, .desktop file and AppStream metadata - Add .github/workflows/flatpak.yml CI pipeline for Flatpak distribution (Issue AOSSIE-Org#206)
|
Caution Review failedPull request was closed or merged during review WalkthroughThe PR implements a cross-platform virtual input driver using koffi FFI to replace NutJS mouse control, adds Electron permission handling for media and screen capture, introduces Flatpak packaging automation and metadata, and includes PoC documentation and implementation for the new input system. Changes
Sequence DiagramsequenceDiagram
participant Client as Client<br/>(WebSocket)
participant InputHandler
participant VirtualInput
participant OS as OS API<br/>(SendInput/uinput/CoreGraphics)
Client->>InputHandler: WebSocket input message<br/>(move/click/scroll)
InputHandler->>InputHandler: Parse & validate<br/>shutdown guards
alt Mouse Movement
InputHandler->>VirtualInput: moveMouse(x, y)
VirtualInput->>OS: Emit mouse event
OS-->>VirtualInput: Success
else Click
InputHandler->>VirtualInput: leftClick() / rightClick()
VirtualInput->>OS: SendInput / write /dev/uinput /<br/>CGEventPost
OS-->>VirtualInput: Event delivered
else Scroll
InputHandler->>VirtualInput: scrollV(delta) / scrollH(delta)
VirtualInput->>OS: Emit scroll event
OS-->>VirtualInput: Success
end
VirtualInput-->>InputHandler: Completion
InputHandler-->>Client: Ready for next input
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~75 minutes Suggested Labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
dirtarget in electron-builder config, Flatpak manifest + desktop/metainfo files, and a GitHub Actions Flatpak workflow.Why
Changes
electron/main.cjssetPermissionRequestHandlerandsetPermissionCheckHandlerwebPreferencesactivateflowpackage.jsondir) for electron-builderflatpak/com.rein.app.ymlflatpak/com.rein.app.desktopflatpak/com.rein.app.metainfo.xml.github/workflows/flatpak.ymlNotes
flatpak/generated-sources.jsonwhen running manually.Closes #254
Related to #206
Summary by CodeRabbit
New Features
Chores