- Match on (issuer, sub) with exact collation, so subjects from another
provider or differing only in case never match.
- Refuse a login whose email is linked to another subject at the same
issuer instead of rebinding the account; relink only across issuers.
- Check the account is enabled before saving identity changes.
- Keep the old email when it is claimed between the check and the write.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Store the provider's `sub` on a new nullable users.oidc_sub column, look users
up by it first and fall back to email, backfilling the sub on the next login. A
user matched by sub gets their stored email updated, unless another account
already holds it.
Fixes#1690
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sixty seconds cut off extraction of mid-sized disc images, so their scan
fell back to hashing the archive itself.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(deps): bump vue-router to 5.3.1 and vue to 3.5.43
vue-router 5 needs vue ^3.5.34. The runtime API RomM uses is unchanged:
typecheck, the unit suite and the production build pass without code
changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CB3a8xbmnmuMeddGnRgVse
* fix(v2): stop URL query writes from dropping history entries
Query-only router.replace calls resolved against currentRoute, which is
still the page being left while a navigation waits on async guards (the
view-transition capture, the ROM fetch in /rom/:id's beforeEnter). A
write landing in that window cancelled a pending push, so the click was
swallowed, or, on Back/Forward, replaceState'd the entry the browser had
already moved to with the old page's URL, deleting it from history.
patchQuery now binds each write to the path it was made on, waits for an
in-flight navigation to settle (tracked by installQueryNavigationGuard,
installed in AppLayout) and drops the write if the navigation left that
page. The gallery filter sync, the platform, collection, admin, library
management and notification tabs, and the notes selection now write
through it, and the gallery's debounced write is cancelled on unmount.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CB3a8xbmnmuMeddGnRgVse
* style(v2): replace em-dashes in comments of files this PR touches
trunk check reports every no-emdash-in-comment hit in a modified file,
not only on changed lines. Comment text only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CB3a8xbmnmuMeddGnRgVse
* fix(v2): rewrite a ?subtab= the details tab can't show
GameDetails swaps currentRom before a rom-to-rom navigation commits, so a
tab that resets its subtab for the new game writes into the pending
navigation and that write is dropped. The URL then kept a subtab the new
game doesn't have. useSubtabQuery now rewrites an invalid ?subtab= to the
subtab on screen on mount and after every path change, which also fixes
stale deep links.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CB3a8xbmnmuMeddGnRgVse
* refactor(v2): key the details ROM by the route's :rom param
GameDetails read a single currentRom slot that the route guards filled
before the navigation committed, so the page being left briefly
rendered the next game under its own URL, and anything reacting to that
wrote into a navigation still in flight.
stores/roms now keeps a bounded, id-keyed cache of DetailedRoms.
setCurrentRom and update() feed it, so the shared /rom/:rom guard and
every SimpleRom write keep it current, and v1 keeps reading currentRom
unchanged. v2 reads through useRouteRom(), which looks the record up by
the committed route's :rom param: a guard can prefetch the next game
without the current page seeing it. The dialogs, useRomSync, the scan
and pending-asset refreshes, FilesTab and the player seeds all go
through the cache or the route id. useSubtabQuery's rewrite is narrowed
to stale links, the case it still covers.
Also replaces em-dashes in comments of the files this touches, which
trunk check flags per modified file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CB3a8xbmnmuMeddGnRgVse
* style(v2): sort useRomScanRefresh imports for trunk's prettier
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CB3a8xbmnmuMeddGnRgVse
* fix(v2): keep the shown game cached through a burst of rom hops (code-review)
Each superseded rom-to-rom navigation still cached its game, so ten
quick hops could evict the record the committed page renders and blank
it until the last hop landed. Re-cache the shown game before the next.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CB3a8xbmnmuMeddGnRgVse
* refactor(v2): simplify the query-write and ROM cache plumbing (simplify)
- routeQuery: track the in-flight navigation as a single marker and
schedule one flush per router instead of a waiter queue; add
replaceQuery for whole-query writes and route Logs through it, so no
v2 query writer bypasses the guard.
- Tab, subtab and gallery-filter writers use syncQueryParam, which only
writes keys that changed.
- useSubtabQuery shares one owned-subtab helper and drops the route.path
trigger the id-keyed cache made redundant.
- The ROM cache holds 3 records (nothing reads it to skip a fetch) with a
single-step eviction; GameDetails re-caches the shown game via
useRouteRom; FilesTab uses refetchRom's result; Stream parses :rom
with romIdFromRoute.
- Trim comments to the two-line rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CB3a8xbmnmuMeddGnRgVse
* style(v2): trim the roms.update merge comment (review-polish)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CB3a8xbmnmuMeddGnRgVse
* style(v2): tidy comment grammar left by the em-dash pass (humanizer)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CB3a8xbmnmuMeddGnRgVse
* fix(v2): address review findings on query writes and the ROM cache
- syncQueryParam compares against the queued write, so a control
switched back before the first write lands still gets written.
- Only the tracked navigation (or an untracked duplicate) settles the
query guard, so an older navigation aborting after a newer one
started can't release writes into it.
- roms.reset() (run on logout) clears the detailed ROM cache, and
deleting a game drops its record once the page has moved off it.
- Shared makeDetailedRom fixture beside makeRom; the CollectionsIndex
mock carries a route path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CB3a8xbmnmuMeddGnRgVse
* fix(v2): settle query writes only for the tracked redirect chain
- A duplicate navigation settles the query guard only when it began as
the tracked navigation (a guard redirect back onto this page, followed
through redirect chains via redirectedFrom). An unrelated duplicate no
longer releases a held write while the tracked navigation is pending;
that navigation settles itself when vue-router cancels it.
- DeleteRomDialog logs a failed post-delete redirect instead of
reporting the delete as failed, and keeps the record of a game the
page still shows so an aborted redirect can't blank it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CB3a8xbmnmuMeddGnRgVse
* style(v2): drop the routeQuery header paragraph the guard docs already cover
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CB3a8xbmnmuMeddGnRgVse
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
- endpoints/device_auth.py -> endpoints/device/auth.py (and its response module)
- Device and install handler tests mirror the new package layout
- The install router is included by the device router, so main.py mounts one
/devices router plus the /auth/device one
- GET /api/devices/online moves to the install routes and 404s while
DEVICE_INSTALL_ENABLED is off, like the rest of them
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- no-color-literal: scan declarations after nested blocks, skip nested
selectors and quoted strings.
- no-layout-media-query: allow the Media Queries 4 `or` keyword.
- no-emdash-in-comment: bound each search to its comment.
- Primitive import limits also cover the `@v2/` alias, `@/locales`, and
`@/plugins/router`, and skip `*.spec.ts`.
- block-order puts scoped styles before unscoped ones.
- no-emdash (Trunk) points Python columns at the comment and treats .mdx
as Markdown.
- Drop stale ESLint ignores and the unused sfc() lang parameter; update the
scripts table in FRONTEND_ARCHITECTURE.md.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Move connect-time user resolution and login-session binding into
SocketHandler.authenticate, shared by the /ws and netplay servers.
- Add SocketHandler.get_session and drop the per-module copies.
- Fold disconnect into leave-room, and the user load into the ROM gate.
- Read the room password only from the field EmulatorJS sends.
- Close both servers' sockets for a revoked session concurrently.
- Correct the join-room password rule in the architecture doc.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Bind netplay sockets to their login session, keying the socket set per
channel so revoking a session closes sockets on both servers.
- Read the room password from the top-level field EmulatorJS sends, and
compare it in constant time.
- Namespace Socket.IO room names so a room id cannot collide with a sid.
- Refuse a duplicate player id on join, and leave the current room before
opening or joining another.
- Coerce client-supplied maxPlayers and names, and store the resolved ROM id.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Pasting a service's own URL (a Discord webhook's) or an Apprise URL
in the channel dialog fills its fields in as soon as it's pasted, or
says why it can't. POST /api/notification-channels/apprise-services/parse
instantiates the plugin and matches the URL Apprise writes for it
against the service's templates, so it works for every service; a new
channel moves to the service the URL is for.
- A failed delivery's error carries the start of the service's reply
after Apprise's warning, so a 400 says why (Discord refuses a bot name
containing "discord"). Apprise's log stays out of the server log.
- Setup guides link Apprise's wiki instead of appriseit.com.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Name what the helpers return: checked_fields gives back the fields to
keep, _defuse_mentions breaks up pings.
- Declare AppriseFieldValue as an explicit TypeAlias, which mypy under
trunk needs to use it in annotations.
- Trim the comments that restated a field list or defended a limit, fix
the Apprise type's comment still describing a single URL, and split
the dense channels paragraph in the architecture doc.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Leave FCM out of the catalog: its keyfile token makes Apprise open a
local path or fetch a URL itself.
- Treat credential-named tokens as secrets even when Apprise doesn't
(Mastodon, Misskey, Plivo, SMSEagle, LaMetric, Rocket.Chat, a JSON
path), and hide any secret left in the masked target or in the
errors that reach last_error and the logs.
- A secret left out of an edit keeps its value, an empty one removes it,
and a kept secret no longer follows the channel to another host,
port, schema, SMTP server or ntfy mode. The form offers "Remove it"
for stored secrets and names them through `stored_secrets`.
- Break up @everyone, @here and <@…> so a notification pings nobody, as
the removed Discord payload did.
- Keep only the fields the service takes, cap lists at 20 items, and
accept only a hostname or address as a host.
- Give the channel test the same 60 s budget as a queued delivery, and
build the service catalog response once per process.
- Don't require a stored secret list (Bark) again on edit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Forward notifications to any of the 100+ services Apprise reaches instead
of the two hand-coded webhook formats. The channel form lists every
Apprise service with the fields it takes, and the backend builds the
Apprise URL from them.
- New `apprise` channel type, admin only: Apprise opens its own
connections, past the SSRF guard. The owner's role is checked again at
every delivery.
- GET /api/notification-channels/apprise-services describes each service
from Apprise's plugin details: URL tokens as fields, options as
advanced fields. A field is required only when every URL template
needs it.
- A channel stores the service and its fields sealed; the URL is built
from the template those fields fill at each send. Local schemas, the
options that read files and the ones RomM sets are never offered.
Apprise follows no redirects, does not retry and its timeouts are
capped.
- The RomM JSON webhook keeps its payload and HMAC signature; its
Discord and ntfy formats go, Apprise covers them. Email is unchanged.
- The v2 dialog picks the type from one searchable list and renders the
service's fields, options folded under "Advanced options".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The kiosk guest may PROPFIND the root and browse or download under
roms/, as it can in the web UI. The manifest, saves, states, blobs and
OPTIONS still challenge it, so RetroArch sends credentials.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Rewrite the RetroArch Cloud Sync architecture section: add the PSP,
kiosk, size cap and missing-file behavior, drop the stale hash note
- Document SYNC_RETROARCH_PSP_SERIAL_MAP in env.template and the env table
- Trim two docstrings and reuse CLIENT_DEVICE_IDENTIFIER for the device type
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
FSRetroArchSyncBlobHandler becomes FSRetroArchSyncHandler, and
SYNC_RETROARCH_BLOB_BASE_PATH becomes SYNC_RETROARCH_BASE_PATH, stored
under /romm/retroarch_sync.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Each manifest.server fetch creates the user's RetroArch device if it is
missing, or bumps its last_seen, so RetroArch shows up alongside the
user's other devices. RetroArch's requests carry no install identity, so
it is one device per user, deduped on client_device_identifier.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The manifest protocol is RetroArch's own, so name it after RetroArch
rather than its WebDAV transport, and group it with the existing sync
code: endpoints/sync/ becomes a package with the RetroArch router as a
subroute, and the handlers move under handler/sync/retroarch/. Settings
move into the SYNC config section as SYNC_RETROARCH_*.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Group the handler modules under handler/webdav_cloud_sync/ (sync_handler,
psp, emulator_names, browser) and rename the endpoint, blob handler, tests,
config settings, storage folders and cache keys to match. The route moves
from /api/cloud-sync to /api/webdav-cloud-sync.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Bound /api/cloud-sync uploads with the asset size limit
- Cap PSP bundle member count and uncompressed size
- Keep PSP writes and deletes on the existing bundle row, one member at a time
- Match PSP bundles by exact folder, support the no-core-folder layout
- Reject . and .. PSP segments; map parse_sfo struct errors and write
errors to 4xx
- Require ROMS_READ for roms/ browsing
- Clear missing_from_fs on overwrite
- Resolve state screenshots by exact name, never a gallery screenshot
- Round-trip unknown core folder names exactly
- Keep + allowed in the shared sanitizer, strip it only on ROM rename (#2746)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- PUT /collections/{id}/visibility and /collections/smart/{id}/visibility
flip is_public alone. The settings switch used the full update, which
rewrote membership from the client's rom_ids and ran the cover branch.
- update_save, update_state and update_screenshot derive the file-name
columns from file_name, like update_rom does for fs_name, so the rename
path hands them a name instead of building the columns itself.
- Name fields use notBlank, AssetEditDialog picks its own title from its
type, ScreenshotEditDialog shares one canSubmit, the collection tile and
row drop a virtual guard their callers already cover, and PublicBadge
uses the pill radius token.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Saves and states could only be renamed by downloading, renaming and
uploading them again (#2653).
Backend: PUT /api/saves/{id}/file-name and PUT /api/states/{id}/file-name
rename the file on disk and the row, and take the auto-captured thumbnail
along so it stays bound by stem. A name another save/state of the ROM
holds, or one that would bind another screenshot, is a 409. Renaming
keeps updated_at, like the other annotations, so device sync does not
see a new version.
Frontend (v2): the Save data tab's per-row actions are now download,
edit, favorite and delete. Edit opens one form with the file name (stem
preselected), labels and visibility; a taken name is flagged in the
field. Public saves and states carry the same globe badge as shared
screenshots. RTextField now puts `autofocus` on its native field, which
is what RDialog looks for, so autofocused fields in dialogs get focus
instead of the close button.
Fixes#2653
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A failed login keeps the attempted username only when it names an
account, so a password typed into the username box is never stored.
- Gunicorn trusts X-Forwarded-For only from loopback and private ranges
(FORWARDED_ALLOW_IPS, documented in env.template), so a client can no
longer choose the address the audit log and rate limits see.
- A player's fetch (purpose=play) is recorded as rom.player_load instead
of being skipped, so the marker can't hide a download.
- Play-session ingest treats a rom hidden from the caller as unknown, so
its session and rom.play event don't name it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Trim comments to what the code can't say, type the remaining test
fixtures, and document the audit_events table, GET /api/audit-events
and the cleanup_audit_log task in the backend architecture guide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Bound a webhook delivery: 15 s in all, and only the first KiB of a
refusal's body is read, so a hostile endpoint can't hold the API or a
worker with an endless or slow reply.
- Key the confirmation-code cooldown per user and per address instead of
per channel, which a delete and re-create reset, so a user can't mail
an address without limit.
- Don't carry a stored secret to another origin or format: it has to be
given again (Discord, which uses none, drops it), so a changed URL
can't be used to read an ntfy token or HMAC key.
- Refuse a webhook URL whose port isn't a number; one got saved and then
broke the channel list with a 500.
- Refuse an unknown SMTP_SECURITY instead of logging in over plaintext.
- Tell the reset form whether reset links are really emailed, which also
needs a shareable ROMM_BASE_URL (heartbeat NOTIFICATIONS.EMAILS_RESET_LINKS).
- Say a code went out only when the address is new to the channel.
- Match a channel's address whole, so a trailing newline isn't kept.
- Test that forgot-password answers alike and sends the link afterwards,
and document the new cache keys.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit carried only the renames of this change, when staging
the rest failed on a path the rename had already moved. This is the change
itself.
A reset link only ever went to the server log, for an admin to pass on. It
now goes to the user's email address when SMTP is set up, the user has one
and ROMM_BASE_URL is shareable, falling back to the log otherwise or when the
server refuses the message. The link is built from ROMM_BASE_URL alone, never
the request's Host, so a forged header can't aim it at another server; it
goes out after the response, so its timing doesn't reveal whether the
username exists; and a user's inbox gets at most one a minute.
The SMTP sender moves from the notification channels to
handler/email_handler.py now that it has a second caller. The v2 reset form
says the link is on its way when the server sends email.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Trims the comments the earlier passes left long or unwrapped, and documents
the shared `socket_handler.emit_to_user` and the netplay channel split in
the backend architecture notes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Notifications could only come from backend code, and only in the kinds the
web client knows how to translate. Anyone can now send one that carries its
own text.
- A notification can carry its own title, body, icon and in-app link. RomM's
own kinds stay translated; `custom` and any other kind (`argosy.sync_done`)
is shown with its own content.
- POST /api/notifications: anyone with me.write notifies themselves; an admin
can also notify user ids, `admins` or `all`, and is shown as the sender.
RomM's own kinds are reserved, links must stay inside RomM, and `data` is
capped at 4 KB.
- notify()/notify_admins() accept the same title/body/link/icon.
- Frontend: `snackbar.success(msg, { persist: true })` (or
`{ persist: { body, link } }`) also keeps the message in the inbox. The
first of the request's answer or the socket push shows the toast, so it
appears once.
- Documented in BACKEND_ARCHITECTURE and the backend and frontend skills.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-ups on the authorization work.
The listing carried its own copy of the ROM visibility decision. The shared
`assert_rom_visible` already masks a hidden ROM as a missing one, so the route
uses that instead and a private duplicate disappears. Hidden and unknown ids
now answer 404 rather than `200 {}`, which the in-tree client already maps to
no rooms.
The socket module's docstrings are cut to the one sentence each that carries
something the code does not, and the new test helpers are typed, which also
drops an unused `sid` argument from every call site.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The connect-time identity was cached for the life of the socket, so an
account disabled afterwards kept its access until it disconnected. The
signal relay trusted the room id stored on the session, which a departed
socket still carried, so it could keep injecting offers into the room it
had left, and the game data relay had the same stale room. The room
listing answered for asset-read tokens, though what it discloses is
ROM-scoped.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The netplay namespace served /netplay/socket.io with no identity at all: any
client, from any origin, could open a room, join one, and relay WebRTC signals
to any socket id it named, with the ROM id and the player identity supplied
entirely by the client.
The socket now resolves its user from the session cookie once, at connect, into
the server-side socket session, the same way the main /ws namespace does.
open-room requires that user to hold roms.read and to be allowed to see the
ROM being played, which is the gate the ROM endpoints apply. join-room accepts
an anonymous client only when it supplies the room password the owner set, the
invite path a guest uses; otherwise it applies the same ROM gate. WebRTC
signals relay only to peers of the caller's own room.
The connect handler never refuses a connection, so guest joins keep working.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>