mediaauth was its own package only because "auth" was already taken by
this package's lower-level Store/User/Role layer. Since mediaauth is no
longer media-family-specific (see the earlier "unified auth proxy"
generalization), it now lives directly in this package instead, renamed
where it collided with existing exports: mediaauth.User -> ProxyUser,
mediaauth.Store -> ProxyStore (this package's own local-account Store is
unrelated and keeps its name). Service/New/NewWithStore/UserFromContext
and the rest keep their names. mediacore.go updated to match.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
A project built via NewWithStore previously had no way to react to
ProjectConfigurator's live authguard_url push (coreconfig.Store.OnUpdate)
the way a project holding its own *authclient.Client directly could via
SetBaseURL - this closes that gap without exposing the client itself.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
shared/backend/auth: adds SchemaOptions.ProjectScoping and Store methods
(SetUserProjects/UserProjects/UserProjectsByUser/IsProjectAllowed,
SetKnownProjects/KnownProjects) backing AuthGuard's new per-user
project-access restriction.
shared/backend/authclient: Client can now identify its calling project to
AuthServer via WithProjectKey (sent as X-Project-Key on every request), so
AuthServer can enforce the restriction above per project.
shared/backend/mediaauth: generalized from a media-family-only package
into the one shared auth-proxy engine every AuthGuard-integrated project
should use. New accepts a projectKey; the login-required/setup-claim
storage it needs is now expressed as a small Store interface
(NewWithStore lets any project's own storage satisfy it, not just the
media family's shared `settings` table, which pgSettingsStore still backs
for existing callers). ManagedUpdateUser/ManagedDeleteUser now resolve
their {id} path param via chi.URLParam OR the stdlib 1.22+ ServeMux's
PathValue, so non-chi consumers work unchanged.
packages/web-ui: UserManagement gains an optional `projects` prop (a
per-account project-access picker), used only by AuthGuard's own admin UI.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Button size variants (sm 2rem, lg 2.875rem), sc-input/sc-select (2.6rem),
and the pagination controls (2.1rem/2.25rem) each rendered at a different
height, so any row mixing them (a select next to a button, a page-size
dropdown next to pagination buttons) was visibly misaligned. Textarea
keeps its own min-height since it's multi-line by design.
The button's top offset was unset, so its absolute-position static
position was recomputed from the flex-wrap layout whenever .sc-nav
wrapped onto its own row on open, causing a visible vertical jump.
Pinning top to the header's mobile padding keeps it stationary.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The select's value was coerced to a string via String(pageSize) while
the <option> values are numbers. Svelte 5 matches a non-bound <select>
value against each option's stored value with Object.is, so "24"
never matched 24 and the dropdown rendered with no option selected.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The service was renamed but comments and a couple of legacy project-name
lists in the shared library still referred to it as MediaKiosk.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The component's markup used sc-pagination* classes that had no
matching rules anywhere in the shared stylesheet, so it rendered
unstyled in every consumer.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Uses the shared Pagination component instead of rendering every
fetched user in one unpaginated list.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Proxy (streaming playback/thumbnails straight through) was left primary-only
when NewMulti was added, but it's a per-file read like Probe/FetchToScratch/
ProbeMedia, not a write - a file living only on a non-primary CarrierNode
instance couldn't actually be played back. Try each configured instance in
order and stream from the first one that doesn't answer with an error,
forwarding the last instance's response (success or error) if none do.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ProjectConfigurator's Projects workspace already lets an operator register more
than one CarrierNode instance (separate storage backends, HA/failover replicas,
or a mix), but every consumer only ever read a single carriernode_url. Add
carriernodeclient.NewMulti (ListFiles merges across instances, Probe/
FetchToScratch/ProbeMedia try each in order, writes stay primary-only),
coreconfig.Info.CarrierNodeURLs for pushed consumers, and
mediacore.CarrierNodeURLs for the 7 services that read settings directly.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The About item falls back to an <a> when no onAbout handler is wired.
The :visited fix only covered post-click state; the unvisited a:link
pseudo-class still beat the .sc-profile-menu-item class in specificity,
making the item look lighter/whiter than the button-based items until
clicked once.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ProjectConfigurator now pushes AuthGuard's/CarrierNode's current URLs to
every project it registers instead of each hardcoding them forever.
coreconfig.Store/Handler is the receiving end any Go service vendors;
authclient.Client.SetBaseURL lets an existing client be retargeted live
when a fresh push arrives, with no restart.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Lets a trusted internal caller (ProjectConfigurator's central "Require
Login" toggle) set a service's auth_required flag directly, without an
admin session - UpdateAccessSettings now delegates to it too.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Documents the hue-spaced palette used to give every project in the
workspace a unique webui primary color: which colors are claimed by
which project, and which remain reserved for future projects.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
AuthPage's password (and, in setup mode, confirm-password) field no
longer forces a non-empty value client-side -- the server already
enforces the real rules (a correct password to log in, >=8 chars to
register/bootstrap), so this only replaces a native browser validation
popup with the server's own error message.
Also bring UserManagement in line with an AuthGuard-only edit that had
drifted ahead of this source (username/email/password relaxed to "at
least one of username/email, password optional" for admin-created
users) so the next consumer sync doesn't silently revert it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
OmniLogger now vendors shared/ (webui, auth, authclient, authproxy), so it
needs to receive updates the same way Core/AuthGuard and the other Go+Svelte
consumers do.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The directory was locked by two stray python http.server processes
and a hung git push waiting on GitHub credentials, all left over from
earlier work in this session - killed with the user's approval, which
freed it up to move like the other three fork projects already had.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The workspace's Central/ and Forks/ parent folders were renamed to
Core/ and Fork/ (singular) - a pure local filesystem reorganization,
git repos don't care about their own absolute path. Updates
sync-consumers.ps1's consumer list and workspace-root detection, plus
doc-comment/README cross-references that hardcoded the old paths.
HordeWorker's entry stays at the old 'Forks/HordeWorker' path for now:
a long-running process holds that directory open, so it couldn't be
moved to Fork/HordeWorker in this pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds mediaauth/mediacore/carriernodeclient/syncsocket packages under
backend/, extracting everything genuinely cross-service (auth, shared
media/tags/playlists/sync/profile routes, the CarrierNode HTTP client,
the playback-sync websocket hub) out of the old media-backend monolith.
The 7 media-family services (CarrierNode, ContentScanner, CraftStudio,
MediaViewer, MediaKiosk, ModerationHub, ProjectConfigurator) each now
have their own independent frontend and backend built on this library,
instead of sharing one generic multi-flavor webui/media-backend
selected by a MEDIA_SERVICE/VITE_MEDIA_APP flag. That generic app and
binary (webui/, media-backend/) are now dead and removed here, along
with their dedicated CI workflows. sync-consumers.ps1 and README.md
updated to describe the new architecture.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds a new persisted "wide page" preference (theme/language-style store,
settings-dialog checkbox, main-content width override) alongside the
existing theme switcher and language selector.
Also completes three project renames throughout the shared source:
MediaAnalyzer -> ContentScanner, MediaTools -> CraftStudio, and
LoggingServer -> OmniLogger, across the Go media-backend service enum,
webui AppId/app-config/project-icons, renamed feature components, and
the sync-consumers.ps1 consumer list.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The configured_central/main rename to CarrierNode only ran when both
lists were still empty, so an already-populated list kept the old
MediaServant entry and gained a duplicate CarrierNode one. Also
migrate the per-project JSON blobs (labels, login, mounts, tab meta)
keyed by the old name so their data isn't orphaned.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Rename MediaConfig -> ProjectConfigurator throughout; drop the Parameters
tab/page; rename the Mounts tab to Projects and restructure it into three
sections: Central services, Main services, Third-party services
- Add a self-describe contract (GET /api/info returning name/tabs/mountTypes)
and a server-side discovery proxy (POST /api/discover-service) so adding a
main service only requires a URL
- Add ProjectConfigurator HA: multiple instances now sync their settings with
each other (GET /api/settings/export, POST /api/settings/sync, a periodic
background puller), last-write-wins per key by updated_at
- Add a generic, project-agnostic file-storage API on CarrierNode
(GET/POST/DELETE /api/mount/{project}/{type}[/*]) driven by the same
configured_mounts data the Projects workspace already writes, usable by any
registered project, not just the media family
- Add last_login_at tracking to the shared auth Store/User (schema, queries,
UpdateLastLogin) and surface it through the shared web-ui ManagedUser type
and UserManagement component
- Retire the "MediaCollection" name: Go module -> repos.gfranz.ch/Gabriel20xx/shared/media-backend,
binary -> mediabackend, session cookie default -> "session", media-webui
merged into webui, media-shared-assets renamed to legacy-assets and pruned
to the one file MediaDesktop still uses
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
User management is now centralized in AuthGuard's webui, so the
per-project Admin dialog (user CRUD + require-login toggle) is
redundant. The require-login toggle will move to ProjectConfigurator
in the future.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Reformat the new scheme-detection test cases with `ruff format` (line
length) so `ruff format --check .` passes in consumers that lint the
whole repo, e.g. Heretic/HordeWorker's CI.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
A bare host:port (e.g. a LAN AuthGuard reachable only over plain HTTP)
was always defaulting to https, so a TLS handshake against a plain-HTTP
AuthGuard failed at the transport level. Now a loopback, RFC1918/RFC4193
private, or link-local host (or a .local name) defaults to http instead;
an explicit http:// or https:// is still always honored as-is.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Extracts a new backend/authproxy package for the AuthGuard-proxy helper
functions (session cookie handling, input normalization, error
translation) that Bitmagnet/GameStream/media-backend/AutoCode/
CollabTable/PubliSafe/SimpleCollection/SyncServer/UnraidMonitor/
OutdoorGames were each independently reimplementing, and repoints all
of them onto it.
Extends packages/web-ui's Button/Badge with the variants media-webui
needed (outline, icon size, primary badge) and promotes EmptyState/
SectionTitle/Metric/StatusWidget/StatusDialog into the shared library,
then migrates media-webui off its own diverged ui/{button,card,badge,
metric} components and local duplicates of the promoted components
onto @gabriel20xx/web-ui, so media-webui is a proper consumer of the
same design system every other project already uses instead of a
parallel fork.
Also removes the dead `desktop`/MediaDesktop service variant from
media-backend and media-webui (MediaDesktop is an Electron client that
never actually runs this stack).
The media-collection family (KioskDisplay, MediaAnalyzer, MediaTools,
MediaViewer, MediaServant, ModerationHub, ProjectConfigurator) shared one
standalone local single-admin auth implementation with no AuthGuard
connection, including its own local "reset admin account" flow - the same
situation the recently-migrated forks were in. Proxies every /auth/... and
/api/auth/... admin-identity operation to AuthGuard via the existing Go
authclient, forwards its Set-Cookie, keeps a local one-time setup-claim flag
(reusing the existing settings table, no schema change), and drops the local
reset flow entirely (only AuthGuard's own web UI keeps one now).
Deliberately left untouched: the separate "moderator manages platform
users" surface (admin_storage.go's mountModeratorRoutes) and the
independent loginRequired/auth_required public-install toggle, both of
which are unrelated to this service's own admin login identity despite
superficially sharing code style/table with the migrated pieces.
AUTHGUARD_URL only needs to name a host/IP now - all four language
clients (Go/Node/Python/Java) assume https:// when no scheme is given,
so a bare value like 192.168.1.50:8080 works instead of failing
outright; an explicit http://scheme is still left alone for local/LAN
deployments.
Java's AuthClient was validate-only; it now mirrors the Go/Node/Python
clients' full surface (register/login/logout/me/totp*/passwordReset*/
managedUsers*/setupStatus) using Jackson for the request/response JSON
this larger surface has to build and parse, since MegaBasterd (this
package's only verified consumer) already depends on Jackson.
margin-bottom: 1rem left too much empty space between the title card
and the cards/content on the page. Reduce to 0.5rem.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Previously each authclient only supported GET /api/session/validate - the
"just gate requests behind a valid session" case. A service that runs its
own login/register/admin-user-management screens proxied to AuthGuard
(GameStream's pattern, now also used by InfiniteVideo and OutdoorGames)
needs much more: register, login, logout, me, totp_enable/verify/disable,
password-reset request/confirm, and managed-user list/create/update/delete.
The Go client already had this full surface from GameStream's original
migration; Python and Node only had validate(), so both gained the same
method set as Go, mirroring its behavior and JSON wire shapes exactly
(register/login/logout return the raw Set-Cookie values to forward,
totp_required surfaces on a 401 from login, etc). Also adds a SetupStatus/
setup_status/setupStatus method (GET /api/setup-status) so a service's own
first-launch flow can tell whether AuthGuard already has an account before
showing its own account-creation form, and adds totp_enabled to the Go
client's PublicUser (AuthGuard has reported it for a while; the client
just hadn't picked it up).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Store.find() (backing FindByIdentifier - used by login - FindByID, and
FindSessionUser, used on every authenticated request) selected 7 columns
but only Scan()'d 6 destinations, missing &user.Role entirely:
find user: find auth user: number of field descriptions must equal
number of destinations, got 7 and 6
This broke essentially all login and session validation, in every project
vendoring this package, against a real Postgres database. It went
undetected because the existing test suite uses a hand-written fake store
in each consumer's own httpapi package that never exercises the real
query/Scan pair - only a real driver round-trip surfaces a
destination-count mismatch like this.
Adds backend/auth/store_integration_test.go (skipped unless DATABASE_URL
is set, so it never runs in default CI) covering create, find-by-identifier,
find-by-id, find-by-session, and list-users against a real database, to
catch this class of regression going forward. Verified against a real
Postgres container: reproduced the exact reported error before the fix,
passes after.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
AuthGuard grew its own web UI (@gabriel20xx/web-ui-based admin dashboard),
so it now vendors the full shared snapshot the same way every other
consumer with a frontend does, not just shared/backend.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Brings this repo's README in line with a shared house style (Tech
Stack table, Repository Layout, Configuration table, Quick Start,
Development, Testing, CI/CD) and fixes staleness accumulated since it
was last written - outdated auth model descriptions, stale directory
names, dead references to removed code, and CI details that no longer
matched the actual workflow files.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
urllib.error.HTTPError's stub declares hdrs: Message (non-optional);
passing None works at runtime but fails strict type checking. Heretic's
lint workflow runs ty over its full tree including the vendored shared/
snapshot, which is what caught this - construct an empty Message()
instead, identical runtime behavior.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The engine/media-backend family (KioskDisplay, MediaAnalyzer,
MediaTools, MediaViewer, MediaServant, ModerationHub,
ProjectConfigurator) mounted this same snapshot via a git submodule at
'engine' instead of 'shared' - which broke in CI, since Gitea Actions'
injected token doesn't cover cross-repo submodule auth for a private
repo. Converting them to the same vendored-copy pattern every other
consumer already uses needed the destination folder name to be
per-project instead of hardcoded to 'shared'.
Also adds MediaDesktop, which previously tried to check out this repo
as a sibling directory in CI (outside the job's workspace root - Gitea
Actions rejects that outright) instead of vendoring a copy.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
packages/media-shared-assets (added earlier, version 2.0.0, with a
vitest devDependency) was never reflected in the root lockfile - it
looks like npm install was never re-run at the workspace root after
the package was added. `npm ci` therefore failed everywhere with
"Missing: @gabriel20xx/media-shared-assets@2.0.0 from lock file" plus
a cascade of missing vitest/chai transitive deps.
This is the shared source of truth every consumer project vendors a
snapshot of via sync-consumers.ps1, so the stale lockfile was breaking
`npm ci` in every consumer's CI too (confirmed via GameStream's Tests
workflow, which has been red since the media-shared-assets sync
landed). Regenerated with `npm install`; verified `npm ci`
(both with and without --omit=dev) and the full lint/test suite
(Node/Svelte, Go x2, Python) all pass clean.
Next: re-sync this fixed shared/ snapshot into every consumer via
sync-consumers.ps1 -Commit -Push.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds Register/Login/Logout/Me/TOTP(Enable/Verify/Disable)/password-reset/
admin-user-management (List/Create/Update/DeleteManagedUser) methods,
APIError, SessionResult, and ForwardCookies - everything a Go service
needs to fully retire its own local auth in favor of proxying to
AuthGuard, not just validate an existing session.
Cookie-forwarding pattern: a service passes AuthGuard's own Set-Cookie
straight through via ForwardCookies rather than minting its own session
token, so the browser holds one real AuthGuard cookie under whatever
AUTH_COOKIE_DOMAIN scope was configured - no double session-mapping,
correct cross-project SSO for free. Documented in the package doc comment.
First real consumer: GameStream's cutover (separate commit, that repo).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Java 8-compatible (not 11+/records as originally suggested) - verified
MegaBasterd's pom.xml compiles this source directly via
build-helper-maven-plugin rather than depending on a packaged jar, and
is pinned to source/target 1.8, so newer APIs would have broken its
real build. Uses HttpURLConnection instead of java.net.http.HttpClient,
a plain final class instead of a record.
No JSON dependency added (defensive regex parsing of AuthGuard's small
fixed response shape) - java-backend has zero runtime dependencies
today and this is the only class that would need one otherwise.
Also added this package's first pom.xml, README.md, and test directory
- none existed before.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Async (asyncpg-consistent with the rest of this package), stdlib-only
HTTP via urllib + asyncio.to_thread (no new dependency for one GET
call). Framework-agnostic by design: read the two real consumers
(HordeWorker's aiohttp webui, Heretic's FastAPI app) and they don't
share a framework, so token_from_request/resolve_user work over plain
headers/cookies mappings rather than shipping a framework adapter.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Lets any Node service validate requests against AuthGuard instead of
maintaining its own local user table - the missing piece needed to
wire AuthGuard into OutdoorGamesPlatform/server-node and any other
Node service, matching what authclient already provides for Go.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Merged from MediaCollection's root README.md before deleting that repo -
the rest of that README (repository layout, docker build commands)
described the now-superseded monorepo structure and would be misleading
to keep verbatim.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The original MediaEngine extraction (later folded into this repo) had
been done BEFORE the owner's decision to revert the MediaViewer/Forge/
etc. rename, and was never re-extracted afterward like the other 7
service repos were - it silently carried stale renamed-era text
(e.g. 'Porter' instead of 'MediaServant') into Go doc comments, WebUI
prose, project-icons.json, and app-config.ts. Re-copied both directories
fresh from the current (correctly reverted) MediaCollection/backend and
MediaCollection/WebUI, then re-applied the go.mod replace-directive fix
and re-added SECURITY_AUDIT.md (also newly migrated from MediaCollection
root - a real deployment security checklist that would otherwise have
been lost when MediaCollection is deleted).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Per owner decision: MediaEngine (the Media product family's Go backend
and SvelteKit frontend, previously its own repo referenced by 7 thin
service repos via git submodule) is folded directly into shared/ as
media-backend/ and media-webui/, rather than staying separate.
media-backend/go.mod's replace directive now points at ../backend (a
true sibling within this repo) instead of a vendored ../shared/backend
copy, since there's no more nested vendoring - it's the real thing.
Also moved MediaEngine's own CI (media-backend-lint.yml,
media-backend-tests.yml) and dev tooling scripts (scripts/media/*,
audit/lint/enforce scripts for the media-backend+media-webui content),
fixing their path assumptions for the new layout, and dropped
scripts/media/sync-shared.mjs (confirmed dead code, and now doubly
obsolete since there's no more vendored shared/ subfolder for it to
check). Added media:* script aliases to package.json for the moved
tooling, namespaced to avoid colliding with this repo's own scripts.
Also fixed sync-consumers.ps1's workspace-root resolution to walk up
until it finds a directory containing both Original/ and Forks/,
instead of assuming shared/ is always a direct child of the workspace
root - it broke when shared/ moved from Web/shared to Web/Central/shared
earlier in this same restructuring. Removed the now-obsolete
Original/MediaEngine entry from its consumer list.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Browser theme CSS/JS assets shared across MediaCollection's client apps,
moved here per owner request to centralize shared components. The
build:theme sync script now lives inside the package itself rather than
assuming a monorepo-root scripts/ sibling; its 'test' script is a no-op
placeholder since the package has no tests of its own yet.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>