chore: Fix app
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
# Game Activity
|
||||
|
||||
> **Status:** Active
|
||||
> **Last updated:** 2026-07-05
|
||||
|
||||
## Overview
|
||||
|
||||
"Now playing" game detection: Electron foreground-window/process heuristics, RAWG metadata match via signaling server, and P2P `game-activity` broadcast to peers. Shown on profile cards and room sidebars.
|
||||
|
||||
## Responsibilities
|
||||
|
||||
| Layer | Owns |
|
||||
|-------|------|
|
||||
| `game-activity` domain | Scan loop, confidence scoring, P2P broadcast, user store updates |
|
||||
| Electron IPC | `get-running-process-names`, `get-active-game-candidate` |
|
||||
| Signaling server | `POST /api/games/match` (RAWG proxy + miss cache) |
|
||||
| P2P | `game-activity` data-channel event |
|
||||
|
||||
## Server API
|
||||
|
||||
### `POST /api/games/match`
|
||||
|
||||
- **Auth:** Public
|
||||
- **Body:** `{ processNames: string[], candidates?: { processName, score }[] }` (bounded list sizes)
|
||||
- **Response:** `{ game: MatchedGame | null }` — RAWG-backed title, cover art, store links
|
||||
|
||||
Misses cached in server SQLite (`GameMatchMiss`) to limit API calls.
|
||||
|
||||
## Client detection
|
||||
|
||||
- Periodic scan (default 10 s, configurable 5–60 s in localStorage `metoyou_game_scan_interval_ms`).
|
||||
- Ignores launcher/helper processes via `IGNORED_PROCESS_NAMES` and regex patterns.
|
||||
- **Electron:** suppresses scan when MetoYou window is focused; prefers foreground-window candidate from `get-active-game-candidate`.
|
||||
- **Browser/Capacitor:** no process scan — activity only from P2P peers.
|
||||
|
||||
## P2P event
|
||||
|
||||
```json
|
||||
{ "type": "game-activity", "activity": { "game", "startedAt", "processName", ... } }
|
||||
```
|
||||
|
||||
Peers merge into `User.gameActivity` in NgRx store.
|
||||
|
||||
## Related
|
||||
|
||||
- [signaling.md](signaling.md) — not WS-relayed
|
||||
- [server-directory.md](server-directory.md) — API base URL for match endpoint
|
||||
- Domain README: [`toju-app/src/app/domains/game-activity/README.md`](../../toju-app/src/app/domains/game-activity/README.md)
|
||||
|
||||
## Changelog
|
||||
|
||||
| Date | Change |
|
||||
|------|--------|
|
||||
| 2026-07-05 | Initial cross-context game-activity contract |
|
||||
Reference in New Issue
Block a user