Every language's AuthGuard client/service used "no URL at construction"
to mean "auth disabled forever" - a live SetBaseUrl/setBaseUrl push from
ProjectConfigurator could only ever retarget an *already-enabled* client,
never turn one on for the first time. That made AUTHGUARD_URL a de-facto
required env var everywhere, even though ProjectConfigurator can push it
live after startup.
- Go: shared/backend/auth's New/NewWithStore now default to a "pending"
Service (still enabled, fails closed until a URL arrives) instead of
disabled when authGuardURL is empty; add an explicit Disabled() option
for the genuine standalone/local-dev opt-out.
- Python/Node/Java: add setBaseUrl/set_base_url to each AuthClient so a
client built with an empty base URL can be retargeted in place once a
URL is pushed, the same as the Go client already supported.
- Python/Node: add a coreconfig module (Info/Store), the framework-agnostic
equivalent of shared/backend/coreconfig (Go), for services in those
languages to receive ProjectConfigurator's core-services push at all.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Extracted from three near-identical bespoke implementations (Heretic,
HordeWorker, InfiniteVideo), each ~800-1000 lines hand-rolling the same
status/setup/login/logout/TOTP/admin-user-CRUD proxy around AuthClient.
build_auth_router(get_client, get_store) returns a ready-to-mount
APIRouter matching shared/backend/auth (Go)'s Service response shapes.
Gated behind an optional `fastapi` extra so the rest of this
framework-agnostic package is unaffected. 18 new tests, including a
regression test for a real bug this had (request models nested inside
build_auth_router silently broke under `from __future__ import
annotations`, misrouting every JSON body as a missing query param).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Mirrors Go's authclient.WithProjectKey: each client now accepts a
project_key/projectKey and sends it as X-Project-Key on every request,
so AuthGuard can enforce per-user project-access restriction for
consumers written in these languages too.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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>