Skip to content

feat: custom games, game profile buttons and custom game images - #32

Draft
onyxhq-dev wants to merge 1 commit into
OpenMouse-Project:mainfrom
onyxhq-dev:feat/custom-game-icons
Draft

onyxhq-dev wants to merge 1 commit into
OpenMouse-Project:mainfrom
onyxhq-dev:feat/custom-game-icons

Conversation

@onyxhq-dev

@onyxhq-dev onyxhq-dev commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

The Bridge side of custom games and Logitech game profile buttons in the OpenMouse app.

  • Custom games. A game added by hand (its name and executables) is stored in the Bridge config, apart from the catalog, and tracked like any listed game. Names and executables are normalized, and the list is capped (200 games, 80 characters per name, 20 executables per game).
  • Side button assignments. A game profile can assign a Logitech mouse's Back and Forward buttons to a key (with modifiers) or a media key. While that profile is active, the Node helper native-hid/src/button-listener.mjs reports button changes and Bridge presses the assigned key. An unassigned side button keeps its normal click. The default profile can carry Host buttons too.
  • Key presses on all three systems. Windows uses SendInput. Linux uses a virtual keyboard and mouse through /dev/uinput, which works on X11 and Wayland. macOS posts CoreGraphics events and asks for the Accessibility permission. Media keys are not pressed on macOS yet. install-linux.sh adds a udev rule for /dev/uinput and loads the uinput module at boot; the uninstall removes both.
  • Custom game pictures. Upload one (PNG, JPEG or WebP, up to 512 KB) or paste a link. Link downloads accept public http and https addresses only, check every redirect, connect to the checked addresses, cap size (12 MB) and time (10 s), and allow two at a time. Both image routes send X-Content-Type-Options: nosniff.

Tests: cargo test passes, including new tests for the config limits, the image routes, the address checks and the key tables. The new Linux and macOS modules compile for x86_64-unknown-linux-gnu and aarch64-apple-darwin.

Checked by hand: the Windows listener works (bunny hop and the default Back and Forward mapping included). The Linux key injection was run on a real Linux 6.8 kernel and delivered the expected key and button events. Not tested: a Linux desktop (X11 or Wayland) and macOS, so those need someone to try them.

Draft because the listener needs a protocol release with the button listener (OpenMouse-Project/mouse-protocol#246). Once that is released, native-hid/package.json should be bumped to it. Until then the listener reports that it is unavailable and does nothing.

Note

Add custom games, profile-driven side buttons, and custom game images

  • Adds a persisted custom_games config collection with shared normalization and size limits; tracked_games merges custom games with catalog games, and catalog names win collisions in config.rs
  • Adds HTTP endpoints for custom games and their images: GET/PUT /v1/custom-games, GET/PUT /v1/custom-games/image, GET /v1/custom-games/image-from-url, and GET /v1/default-profile in api.rs
  • Stores custom game images as PNG, JPEG, or WebP up to 512 KiB under a stable hashed filename next to the config file, and prunes images for removed games in service.rs
  • Adds SSRF-safe remote image fetch: DNS results must be public addresses, redirects are followed manually with re-validation, and downloads are capped at 12 MiB with a 10s timeout in remote_image.rs
  • Adds a Logitech side-button listener driven by the active profile: buttons.Assignments::from_profile parses hostButtons, a Node.js helper (button-listener.mjs) reports button masks, and platform injectors emit key, media, and side-button events on Windows (SendInput), Linux (uinput), and macOS (CoreGraphics) in buttons.rs
  • Risk: behavioral changes — BridgeService.games and snapshot now return tracked games (catalog plus custom) instead of catalog only; the monitor suppresses button updates while a HID client session is active; unsupported operating systems log but do not inject button events; Linux installs now add a udev rule and module-load config for /dev/uinput in install-linux.sh

Macroscope summarized 4279c34.

- Custom games are stored in the Bridge config, apart from the catalog, and
  tracked like any listed game. Names and executables are normalized and capped.
- A game's profile can assign a Logitech mouse's side buttons (including media
  keys). A listener helper reports button changes and Bridge presses the keys
  while that profile is active. The default profile carries Host buttons too.
- The key presses work on Windows (SendInput), Linux (a virtual keyboard and
  mouse through /dev/uinput, which works on X11 and Wayland) and macOS
  (CoreGraphics events; macOS asks for the Accessibility permission, and media
  keys are not pressed there yet). install-linux.sh adds the uinput udev rule
  and loads the module at boot.
- Custom games can have a picture: uploaded (PNG, JPEG, WebP, up to 512 KB) or
  downloaded from a pasted link. Link downloads accept public http and https
  addresses only, check every redirect, connect to the checked addresses, cap
  size and time, and allow two at a time.
- Image routes send nosniff; image reads and writes are async; the new routes
  have tests.
@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added type: enhancement PR title category: enhancement area: native Native bridge and platform services area: devices HID access and device drivers area: packaging Installation and application assets area: documentation Documentation area: dependencies Dependency manifests and lockfiles labels Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: dependencies Dependency manifests and lockfiles area: devices HID access and device drivers area: documentation Documentation area: native Native bridge and platform services area: packaging Installation and application assets type: enhancement PR title category: enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant