Commit Graph

10630 Commits

Author SHA1 Message Date
Georges-Antoine Assi
d760b8d13e Merge pull request #3781 from rommapp/posthog-code/roms-optional-id-index
perf(roms): make full rom id index opt-out on GET /api/roms
2026-07-16 21:20:19 -04:00
Georges-Antoine Assi
bc602972c7 cleanup 2026-07-16 21:00:57 -04:00
Georges-Antoine Assi
6ca8d943b2 Merge branch 'master' into posthog-code/roms-optional-id-index 2026-07-16 20:58:46 -04:00
Georges-Antoine Assi
07bf93508b Merge pull request #3780 from rommapp/posthog-code/roms-platform-fs-size-index
perf(backend): index roms (platform_id, fs_size_bytes)
2026-07-16 20:57:57 -04:00
Georges-Antoine Assi
3db9cde084 cleanup 2026-07-16 20:39:54 -04:00
Georges-Antoine Assi
a171aa97bc Merge pull request #3779 from rommapp/posthog-code/fix-simple-rom-eager-load
fix(backend): lightweight eager-load for /roms/{id}/simple
2026-07-16 20:37:45 -04:00
Georges-Antoine Assi
f771f1173b Merge pull request #3778 from rommapp/posthog-code/fix-ss-invalid-json-escape
fix(ss): tolerate ScreenScraper's invalid JSON escapes
2026-07-16 20:30:38 -04:00
Georges-Antoine Assi
0cf5f472a5 Apply suggestion from @greptile-apps[bot]
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-07-16 19:07:26 -04:00
Georges-Antoine Assi
484b1d3958 Merge pull request #3765 from rommapp/posthog-code/fix-v2-gallery-batch-fetch
fix(v2): batch gallery cover fetches into windows
2026-07-16 19:06:00 -04:00
Georges-Antoine Assi
8c236a982b upgrade trunk 2026-07-16 19:01:59 -04:00
Georges-Antoine Assi
3dd9c69687 cleanup comment spam 2026-07-16 19:00:42 -04:00
Georges-Antoine Assi
d4018e5d3a fix(v2): skip metadata aggregations on later gallery windows
Once the bootstrap or window 0 has populated the filter panel, alpha
strip, and id index, later window fetches only need their paged items.
Send with_char_index=false and with_filter_values=false so the backend
doesn't recompute those aggregations for every window.

Generated-By: PostHog Code
Task-Id: daf23950-b84a-4537-971c-3f85425c172c
2026-07-16 18:55:24 -04:00
Georges-Antoine Assi
04ae566749 Merge pull request #3783 from rommapp/posthog-code/v2-hasheous-provider-link
feat(v2): link Hasheous provider to game detail page
2026-07-16 18:49:44 -04:00
Georges-Antoine Assi
c3721a8a69 Merge pull request #3782 from rommapp/posthog-code/v2-igdb-provider-link
fix(v2): link IGDB provider to game page by slug
2026-07-16 18:49:05 -04:00
Georges-Antoine Assi
ab01cd0e24 feat(v2): link Hasheous provider to game detail page
Add a URL builder for the Hasheous provider so its card in the
GameDetails provider grid links out to the corresponding game page
instead of rendering unlinked.

Generated-By: PostHog Code
Task-Id: 522c9198-de9b-4973-9057-ce4c0a33dcc9
2026-07-16 18:41:06 -04:00
Georges-Antoine Assi
6a9236aada fix(v2): link IGDB provider to game page by slug
The IGDB provider link built a text-search URL from the numeric ID,
which returns no results. Point it at the canonical /games/<slug> page
when the slug is present, falling back to the ID search otherwise. The
URL builder now receives the DetailedRom so it can reach fields beyond
the provider ID.

Generated-By: PostHog Code
Task-Id: 6843b623-ed80-454f-8373-8192f3c629b4
2026-07-16 18:40:44 -04:00
Georges-Antoine Assi
0f36ed5009 fix(ss): tolerate ScreenScraper's invalid JSON escapes
ScreenScraper occasionally returns malformed JSON with raw, unescaped
backslashes in text fields (e.g. synopses), which the strict parser
rejects with "Invalid \escape". The whole response was then discarded as
{}, so ScreenScraper found no match even for trivially-matchable titles
while other providers matched fine.

Parse leniently: on a decode error, double any backslash that isn't a
valid JSON escape and retry, instead of dropping the entire response.

Fixes #3764

Generated-By: PostHog Code
Task-Id: bbb1e2a8-bcb0-45a3-840e-86ce39f906a9
2026-07-16 18:38:15 -04:00
Georges-Antoine Assi
2321468a67 perf(roms): make full rom id index opt-out on GET /api/roms
The home rails ("recently added" / "continue playing") request 15 cards
but the endpoint always computed rom_id_index, the complete ordered list
of every matching rom id that backs gallery virtual scroll. On large
libraries this ran a full-table scan and shipped hundreds of KB of ids
to render 15 cards.

Add a with_rom_id_index query param (defaults to true, mirroring the
existing with_char_index / with_filter_values flags). When false, skip
building the index and serve the page directly via offset/limit off the
sort index, with a lightweight count for total. The home rail fetches
pass false.

Fixes #3770

Generated-By: PostHog Code
Task-Id: 45dbad45-bd7c-4cf3-8e8f-105f174f4386
2026-07-16 18:37:27 -04:00
Georges-Antoine Assi
9b6acf66b4 fix(backend): lightweight eager-load for /roms/{id}/simple
The v2 gallery per-card endpoint reused get_rom, which runs the full
detail eager-load (saves, states, screenshots, collections) that
SimpleRomSchema never serializes, making cards slow to hydrate.

Add get_rom_simple backed by a with_simple_details decorator that loads
only what SimpleRomSchema needs: platform, metadatum, rom_users, files,
sibling_roms (+ their rom_users), notes, and the deferred file-count
columns.

Fixes #3771

Generated-By: PostHog Code
Task-Id: 9233f519-079f-4990-8b48-9d12c81440b4
2026-07-16 16:01:59 -04:00
Georges-Antoine Assi
a65434cc67 perf(backend): index roms (platform_id, fs_size_bytes)
GET /api/platforms and GET /api/stats both sum roms.fs_size_bytes but the
column was not in any index, forcing full reads of the wide, JSON-heavy roms
table (5-11s on large libraries). A composite index on
(platform_id, fs_size_bytes) turns both sums into index-only scans.

Fixes #3769

Generated-By: PostHog Code
Task-Id: e24ff248-6329-4b70-a826-9a9fee21411e
2026-07-16 15:59:59 -04:00
Georges-Antoine Assi
cb7a67a1e6 Merge pull request #3766 from rommapp/posthog-code/v2-reduced-effects
feat(v2): add reduced-effects mode for low-power devices
2026-07-16 13:13:10 -04:00
Georges-Antoine Assi
66b2e40be0 fix(v2): clean nav + backdrop in reduced-motion mode
Reduced-motion drops the 28px backdrop blur, which exposed two rough
edges the blur had been hiding:

- The fallback backdrop art (auth_background.svg) is authored to be seen
  only through the blur; unblurred it shows a hard seam ("weird bar") and
  a bright diagonal wedge. Drop the whole fixed art + overlay stack in
  this mode and let the solid page background show through — cheaper on
  weak GPUs and no seam.
- The top nav bar's only surface is a backdrop-filter glass. Against the
  now-solid background that reads as murky, and the blur is expensive on
  weak GPUs. Swap it for a flat opaque surface so the fixed bar stays a
  clean solid strip as content scrolls under it.

Generated-By: PostHog Code
Task-Id: 6690877a-9c32-4c91-a78b-3d6fd3851fb7
2026-07-16 11:39:55 -04:00
Georges-Antoine Assi
d248df8623 refactor(v2): merge reduced-effects into useReducedMotion
Two hooks modelled overlapping concerns and useReducedEffects imported
useReducedMotion for its default, coupling them. Collapse to a single
useReducedMotion that owns the whole "reduce motion / effects" axis:

  enabled = override ?? OS prefers-reduced-motion   (+ toggle())

It drives the one r-v2-reduced-motion root class (background blur, cover
blur-up, the global animation/transition neutralize) and the JS motion
gates (cover CD-spin, view-transition morphs, RExpandTransition, RBox3D).
One hook, one Settings toggle, one source of truth.

- Delete useReducedEffects; move its override tests onto useReducedMotion.
- Rename the class r-v2-reduced-effects -> r-v2-reduced-motion and the
  localStorage key to settings.v2.reducedMotion.
- Rename the i18n keys reduced-effects(-desc) -> reduced-motion(-desc)
  across all locales; title is now "Reduced motion" (the description
  already covered both blur and animation).

Generated-By: PostHog Code
Task-Id: 6690877a-9c32-4c91-a78b-3d6fd3851fb7
2026-07-16 11:25:27 -04:00
Georges-Antoine Assi
f109f42512 refactor(v2): single useReducedMotion hook
Four files hand-rolled their own window.matchMedia("(prefers-reduced-
motion: reduce)") check (useCoverAnimation, useViewTransition,
RExpandTransition, RBox3D) and useReducedEffects held a fifth via
useMediaQuery. Consolidate into one useReducedMotion composable, a
module-level singleton returning a reactive Ref<boolean> (same pattern as
useBreakpoint; wraps what vueuse's usePreferredReducedMotion exposes but
as the plain boolean every call site wants).

Side benefit: the two composable call sites that read the old function
inside a computed are now reactive, so cover motion and the 3D-box idle
drift stop/resume live when the OS setting changes, no remount. It stays
generic (no store/service/domain), so the two primitives may use it
within the tier boundary.

Generated-By: PostHog Code
Task-Id: 6690877a-9c32-4c91-a78b-3d6fd3851fb7
2026-07-16 11:14:17 -04:00
Georges-Antoine Assi
3f25a5cac9 Apply suggestion from @greptile-apps[bot]
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-07-16 11:05:26 -04:00
Georges-Antoine Assi
80a985f36a Merge pull request #3767 from rommapp/posthog-code/fix-migration-idempotency
fix(migrations): make DDL idempotent on partial-failure reruns
2026-07-16 11:02:46 -04:00
Georges-Antoine Assi
44851166a2 fix(migrations): revert 0014 idempotency guard
The guard was both unreachable and unsafe. For platforms.id to exist on
a rerun, the first attempt must have already run the atomic ADD COLUMN
id ... PRIMARY KEY, which means it passed the unguarded
drop_constraint("fk_platform_roms") at the top of upgrade(). That FK
drop has no IF EXISTS, so any rerun fails there before reaching the
guard. And if it were reachable, the preceding primary-key drop would
leave id unkeyed once the ADD COLUMN was skipped.

Keep the genuinely correct fixes (0084, 0033); leave 0014 as-is.

Generated-By: PostHog Code
Task-Id: 87d70ab6-f915-48c0-afa7-55064c97d1a5
2026-07-16 09:53:27 -04:00
Georges-Antoine Assi
21303d696c feat(v2): reduced-effects also reduces motion
reduced-effects only dropped blur, leaving every animation running. The
OS prefers-reduced-motion query is honored per-component, but a CSS class
can't trigger those media blocks and the toggle must work even when the
OS setting is off, so a user enabling low-power mode on a TV box kept the
CRT flicker, disc spins, skeleton shimmer, spinners and scan pulses that
tax a weak GPU.

Make reduced-effects a superset of reduced motion:
- global.css neutralizes animation/transition under html.r-v2-reduced-effects
  (near-zero durations so transitionend/animationend still fire; !important
  overrides inline JS-set transitions such as RExpandTransition).
- Wire the JS-driven motion gates that CSS can't reach to the mode:
  useCoverAnimation (the per-card CD-spin rAF loop) and useViewTransition
  (shared-element morphs). Both keep the independent OS prefers-reduced-
  motion check so an explicit "off" never re-enables motion for a user
  whose system asks to reduce it.

Lib primitives (RExpandTransition, RBox3D) are covered by the global CSS
rule rather than importing app state, per the primitive tier boundary;
RBox3D's JS auto-spin stays OS-gated. Description updated across locales.

Generated-By: PostHog Code
Task-Id: 6690877a-9c32-4c91-a78b-3d6fd3851fb7
2026-07-16 09:48:23 -04:00
Georges-Antoine Assi
8ce8449081 fix(migrations): make DDL idempotent on partial-failure reruns
Migration 0084 could fail on startup with "Duplicate key name
'idx_roms_name_fs_name_fulltext'" when a prior run created the FULLTEXT
index but failed at a later step before Alembic recorded the revision.
On rerun, CREATE FULLTEXT INDEX (which has no portable IF NOT EXISTS on
MySQL/MariaDB) crashed re-creating the existing index.

Guard the raw DDL so re-running a partially-applied migration is safe:

- 0084: check existing indexes before creating/dropping the FULLTEXT index
- 0014: check existing columns before the raw ALTER TABLE ADD COLUMN id
- 0033: use checkfirst=True on the Postgres enum create/drop

Generated-By: PostHog Code
Task-Id: 87d70ab6-f915-48c0-afa7-55064c97d1a5
2026-07-16 09:43:48 -04:00
Georges-Antoine Assi
b7bf0dda05 feat(v2): default reduced-effects to system reduce-motion
Reduced-effects mode now defaults to the OS `prefers-reduced-motion`
setting instead of always starting off: someone who asks their system to
reduce motion generally wants fewer heavy effects too, so the mode turns
on for them with no per-app opt-in. The Settings toggle still records an
explicit choice that overrides the system default from then on.

The stored value becomes tri-state: null (no explicit choice, follow the
system) or true/false (user override), with an explicit serializer since
vueuse's null-default path would otherwise read booleans back as strings.
Add unit tests covering the system default, override precedence, and
persistence.

Generated-By: PostHog Code
Task-Id: 6690877a-9c32-4c91-a78b-3d6fd3851fb7
2026-07-16 09:19:28 -04:00
Georges-Antoine Assi
79f350ab3e fix(v2): cancel gallery windows that scroll out of view
Switching from per-card to per-window fetching dropped the departure
cancellation the per-card path had: scrolling through a large library
started a request per 72-item window encountered and left every departed
window downloading and applying in the background, the wasted network /
backend / render work this change set out to avoid on low-power devices.

Add store.syncVisibleWindows(positions): it starts the windows covering
the visible positions (deduped in fetchWindowAt) and aborts any in-flight
or retry-pending window that no longer covers one. The shell's debounced
viewport sync now delegates to it. Also abort in-flight windows when the
gallery unmounts (onBeforeRouteLeave doesn't reset the store), keeping
the loaded cache so returning is still instant. Drops the shell's dead
visiblePositions bookkeeping.

Generated-By: PostHog Code
Task-Id: 6690877a-9c32-4c91-a78b-3d6fd3851fb7
2026-07-16 09:05:25 -04:00
Georges-Antoine Assi
f6f3519c92 fix(v2): auto-retry failed gallery windows
syncFetches only runs on viewport changes, so a window whose fetch
failed once would leave up to WINDOW_SIZE (72) visible cards stranded as
skeletons on a static viewport until the user scrolled or the gallery
context changed. Since only visible windows are ever fetched, a failed
window was always visible when it failed.

fetchWindowAt now schedules a bounded, backing-off refetch (up to 3
attempts, 2s/4s/6s) on failure so a transient blip self-heals. Retry
timers and attempt counts are cleared on success and aborted alongside
in-flight requests on any gallery-context switch, so we never retry
against a stale context.

Generated-By: PostHog Code
Task-Id: 6690877a-9c32-4c91-a78b-3d6fd3851fb7
2026-07-16 08:55:58 -04:00
Georges-Antoine Assi
ce59e5d9ed feat(v2): add reduced-effects mode for low-power devices
The v2 UI leans on two GPU-heavy decorative effects that are cheap on a
desktop GPU but punishing on weak hardware (TV boxes, older phones):

- a full-viewport filter: blur(28px) background-art layer (always on),
  which the code's own Firefox note already flags as pegging weak
  rendering backends; and
- a per-cover filter: blur(16px) blur-up reveal, run on ~100 covers at
  once when a full grid paints.

Add a per-device "Reduced effects" toggle (Settings > User interface,
under Theme) backed by a localStorage flag, mirroring useCrtMode. When
on, AppLayout sets `r-v2-reduced-effects` on <html> and the global /
GameCover CSS drops the blur filters (keeping tone and the opacity
fade), so low-power devices composite sharp, unblurred visuals.

Per-device rather than backend-synced on purpose: whether effects are
too heavy depends on the machine RomM is viewed on, not the account.

Generated-By: PostHog Code
Task-Id: 6690877a-9c32-4c91-a78b-3d6fd3851fb7
2026-07-16 08:50:38 -04:00
Georges-Antoine Assi
6d92713037 fix(v2): batch gallery cover fetches into windows
The v2 gallery hydrated each visible card with its own
GET /roms/{id}/simple request (one HTTP round trip and one DB lookup
per card). On a full grid that meant ~100 simultaneous requests, which
the browser's per-host connection cap serialized into slow waves,
taking 1-2 minutes to fill the grid on low-power devices. v1 loaded the
same library in 1-2 paginated requests.

Route both grid (GalleryShell viewport sync) and list (GameListRow
mount) hydration through the store's existing fetchWindowAt, which
aligns each visible position to its shared 72-item window and dedupes
against pending/loaded windows. A full viewport now resolves in a
handful of paginated requests instead of one per card. Drops the
now-unused per-card fetchRomAt/cancelFetchAt store actions.

Generated-By: PostHog Code
Task-Id: 6690877a-9c32-4c91-a78b-3d6fd3851fb7
2026-07-16 08:40:00 -04:00
Georges-Antoine Assi
030952b921 Merge pull request #3763 from rommapp/posthog-code/fix-safari-match-rom-sliver
fix(v2): render match-rom covers at full width in Safari
2026-07-16 08:09:47 -04:00
Georges-Antoine Assi
44ef5cf515 fix(v2): render match-rom covers at full width in Safari
The manual "Match ROM" dialog wrapped each GameCard in a block-level
cell, so the card's aspect-ratio-derived width resolved against a
shrink-to-fit containing block. WebKit collapses that circular case to a
near-zero width, rendering covers as thin slivers (Chromium is fine).

Lay the cell out as a flex container so the card sizes via flex intrinsic
sizing, the same path the gallery row already uses.

Fixes #3761

Generated-By: PostHog Code
Task-Id: 85199a96-11de-4403-a30e-e533cf9a8e48
2026-07-16 07:58:17 -04:00
Georges-Antoine Assi
c87b6b7088 flex grow dropzone 2026-07-16 07:57:32 -04:00
Georges-Antoine Assi
92e4074ea4 Merge pull request #3759 from kthistlewood/fix/virtual-collections-collation-mariadb-11.6
fix(db): pin explicit collation in virtual_collections view for MariaDB 11.6+
2026-07-16 07:49:39 -04:00
Georges-Antoine Assi
5f6bda9b1e Merge pull request #3757 from rommapp/posthog-code/i18n-sorted-linter
chore(i18n): add linter enforcing alphabetically sorted locale files
2026-07-16 07:41:09 -04:00
Georges-Antoine Assi
373a03aef2 Merge branch 'master' into posthog-code/i18n-sorted-linter 2026-07-16 07:30:54 -04:00
Kyle Thistlewood
6011334478 fix(db): pin explicit collation in virtual_collections view for MariaDB 11.6+
On MariaDB 11.6+ the default character_set_collations maps utf8mb4
expressions to uca1400_ai_ci, which clashes with the view's general_ci
string literals and JSON_TABLE columns: every /api/collections/virtual
request fails with 'Illegal mix of collations ... for operation ='.

Recreate the view (new migration, 0095 pattern) with an explicit
COLLATE utf8mb4_general_ci on each string output column so comparisons
resolve deterministically regardless of server collation defaults.
PostgreSQL is unaffected (no-op).

Fixes #3758

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 05:19:14 +00:00
Georges-Antoine Assi
27692ae212 chore(i18n): add linter enforcing alphabetically sorted locale files
Add check_i18n_sorted.py, which fails when any locale JSON file's keys
are not sorted alphabetically (recursively, so nested objects are
covered). Supports --fix to sort in place. Wire it into the i18n CI
workflow alongside the existing parity check, and sort all existing
locale files.

Generated-By: PostHog Code
Task-Id: 7cbf74de-6bf1-45c0-9c8e-c45f94119edc
2026-07-15 22:07:35 -04:00
Georges-Antoine Assi
96abd8b87c Merge pull request #3756 from DevYukine/fix/playmatch-heartbeat
fix(playmatch): handle empty heartbeat query
2026-07-15 21:44:15 -04:00
Georges-Antoine Assi
9c46bfde9c Merge pull request #3731 from rommapp/posthog-code/optimize-cleanup-frequency-and-logging
Reduce RQ worker registry sweep verbosity and frequency
2026-07-15 21:00:16 -04:00
Georges-Antoine Assi
23d724f447 fix(backend): keep default RQ maintenance interval for prompt scan recovery
The registry-cleanup log noise is already suppressed by the RomMWorker log
filter, so the hourly maintenance interval was unnecessary and delayed pruning
of orphaned STARTED jobs and stale workers. The watcher's Worker.all() scan
dedupe relies on that pruning, so restore the default (~10 min) cadence.

Generated-By: PostHog Code
Task-Id: 78c8b2f8-2b03-443f-aa4c-8867c1259f2a
2026-07-15 20:02:49 -04:00
Yukine
e418dd4ba9 fix(playmatch): handle empty heartbeat query 2026-07-16 01:36:39 +02:00
Georges-Antoine Assi
5608eb8679 Merge pull request #3753 from rommapp/copilot/bug-fix-cannot-delete-file
feat: add file deletion to the Files tab on the game details page
2026-07-15 19:26:48 -04:00
Georges-Antoine Assi
9aac4c7193 Update backend/endpoints/roms/files.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-07-15 19:21:59 -04:00
Georges-Antoine Assi
b3d8d6f43c fix typo 2026-07-15 19:20:05 -04:00
Georges-Antoine Assi
18f46a44f9 run fmt 2026-07-15 19:10:57 -04:00