#4837·romm

[Feature] Let a paired client read a user's play time across all devices

Author: MMagTechCreated Sep 27, 2026Updated Sep 27, 2026

Is your feature request related to a problem? Please describe.

A client that signs in through device pairing (/api/auth/device/*) gets a token tied to its device. When it calls GET /api/play-sessions, the endpoint falls back to the token's device when no device_id is given:

python
effective_device_id = device_id or getattr(request.state, "device_id", None)

So a paired client can only ever read its own sessions. It can report play sessions correctly, but it cannot show a user their total time on a game, because sessions from the web player or from other devices are filtered out, and there is no way to ask for all of them. Reinstalling a client (which pairs as a new device) also hides everything it reported before.

db_play_session_handler.get_total_play_time(user_id, rom_id) already sums a user's time on a rom across every device, but no endpoint uses it.

Describe the solution you'd like

Either of these would do:

  1. Expose the total on the rom's user data, e.g. rom_user.play_time_ms, using get_total_play_time. This is the smallest change for clients: the number arrives with the rom they already fetch.
  2. Or let GET /api/play-sessions opt out of the device fallback, e.g. ?all_devices=true, still limited to the requesting user.

Describe alternatives you've considered

Showing only the time played on the device itself, which is what we do for now. It undercounts for anyone who also plays in the web player or on a second device.

Additional context

This comes from CabinetOS, a console frontend for RomM that reports a play session at the end of every game and wants to show "12 hours played" on a game's page.