Sync shared snapshot from 2e6baaa
This commit is contained in:
1 parent
5ea8551d60
commit
81b62cdc26
34 files changed
+192
-116
No files matched your search
@@ -1,6 +1,7 @@
|
||||
node_modules/
|
||||
packages/*/dist/
|
||||
packages/*/.svelte-kit/
|
||||
webui/.svelte-kit/
|
||||
*.tgz
|
||||
.npm/
|
||||
__pycache__/
|
||||
|
||||
@@ -8,7 +8,7 @@ services, not application-specific SQL or HTTP handlers.
|
||||
- `auth` — shared bcrypt policy, secure token generation/hashing, account/session schema, and account/session persistence.
|
||||
- `authclient` — HTTP client and `net/http` middleware for services that adopt the centralized AuthServer instead of embedding `auth` against their own database.
|
||||
- `migrate` — embedded filesystem adapter for Goose migrations.
|
||||
- `logshipper` — client adapter for LoggingServer (Web/LoggingServer): batches and ships log entries centrally while mirroring the same human-readable output and Debug/Info/Warn/Error/Critical/Audit/*Ctx method surface as each project's local internal/logging package.
|
||||
- `logshipper` — client adapter for OmniLogger (Web/OmniLogger): batches and ships log entries centrally while mirroring the same human-readable output and Debug/Info/Warn/Error/Critical/Audit/*Ctx method surface as each project's local internal/logging package.
|
||||
|
||||
Run `go test ./...` and `go vet ./...` from this directory. The module path is
|
||||
`repos.gfranz.ch/Gabriel20xx/shared/backend`; change it if the shared folder is
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Package logshipper is the client-side adapter for LoggingServer
|
||||
// (Web/LoggingServer), the workspace's centralized log sink. It is the
|
||||
// Package logshipper is the client-side adapter for OmniLogger
|
||||
// (Web/OmniLogger), the workspace's centralized log sink. It is the
|
||||
// logging equivalent of the authclient package added alongside AuthServer:
|
||||
// each service currently owns its own local internal/logging package (see
|
||||
// Original/OutdoorGames/OutdoorGamesServerGo/internal/logging/logging.go for
|
||||
@@ -10,12 +10,12 @@
|
||||
// logging.New(...) call for logshipper.New(...) with no call-site changes,
|
||||
// once the owner decides to migrate a given service.
|
||||
//
|
||||
// No project imports this yet — see LoggingServer/README.md's "Migration
|
||||
// No project imports this yet — see OmniLogger/README.md's "Migration
|
||||
// notes" for the deliberate, per-project follow-up this requires.
|
||||
//
|
||||
// Shipper always writes the same human-readable line to stdout/stderr that
|
||||
// the local loggers write today, in addition to batching entries off to
|
||||
// LoggingServer. Nothing is lost if LoggingServer is never wired up, never
|
||||
// OmniLogger. Nothing is lost if OmniLogger is never wired up, never
|
||||
// reachable, or removed later — this is a mirror, not a replacement, for the
|
||||
// container's own stdout/stderr logs.
|
||||
package logshipper
|
||||
@@ -63,7 +63,7 @@ func levelOf(s string) Level {
|
||||
}
|
||||
}
|
||||
|
||||
// sevName is the canonical, lowercase level name LoggingServer's ingest API
|
||||
// sevName is the canonical, lowercase level name OmniLogger's ingest API
|
||||
// expects (debug/info/warn/error/critical), independent of the uppercase
|
||||
// name used in the local stdout/stderr line.
|
||||
func sevName(sev Level) (upper, lower string) {
|
||||
@@ -92,13 +92,13 @@ const (
|
||||
// Config configures a Shipper. Only BaseURL, IngestToken, and Service are
|
||||
// normally set by a caller; everything else has a workable default.
|
||||
type Config struct {
|
||||
// BaseURL is LoggingServer's base URL, e.g. "http://loggingserver:8090".
|
||||
// BaseURL is OmniLogger's base URL, e.g. "http://omnilogger:8090".
|
||||
// Required.
|
||||
BaseURL string
|
||||
// IngestToken is the shared INGEST_TOKEN bearer secret LoggingServer
|
||||
// requires (see LoggingServer/README.md). Required.
|
||||
// IngestToken is the shared INGEST_TOKEN bearer secret OmniLogger
|
||||
// requires (see OmniLogger/README.md). Required.
|
||||
IngestToken string
|
||||
// Service is this process's service name as reported to LoggingServer,
|
||||
// Service is this process's service name as reported to OmniLogger,
|
||||
// e.g. "playhouse" or "outdoorgames-server-go". Required.
|
||||
Service string
|
||||
|
||||
@@ -110,11 +110,11 @@ type Config struct {
|
||||
// var (debug/info/warn/error/critical/silent). Defaults to "info".
|
||||
Level string
|
||||
// LogAll mirrors the LOG_ALL env var: when true, a verbose JSON context
|
||||
// dump is also printed locally (never sent to LoggingServer differently
|
||||
// dump is also printed locally (never sent to OmniLogger differently
|
||||
// than normal — see Debug/InfoCtx doc comments).
|
||||
LogAll bool
|
||||
|
||||
// FlushInterval is how often buffered entries are sent to LoggingServer.
|
||||
// FlushInterval is how often buffered entries are sent to OmniLogger.
|
||||
// Defaults to 2s.
|
||||
FlushInterval time.Duration
|
||||
// MaxBatchSize triggers an out-of-band flush as soon as the buffer
|
||||
@@ -127,13 +127,13 @@ type Config struct {
|
||||
// Defaults to 2000.
|
||||
BufferCapacity int
|
||||
|
||||
// HTTPClient overrides the client used to POST to LoggingServer.
|
||||
// HTTPClient overrides the client used to POST to OmniLogger.
|
||||
// Defaults to a client with a 5s timeout.
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// wireEntry mirrors LoggingServer's POST /api/logs request shape
|
||||
// (LoggingServer/internal/httpapi.LogEntryInput) field-for-field.
|
||||
// wireEntry mirrors OmniLogger's POST /api/logs request shape
|
||||
// (OmniLogger/internal/httpapi.LogEntryInput) field-for-field.
|
||||
type wireEntry struct {
|
||||
Service string `json:"service"`
|
||||
Level string `json:"level"`
|
||||
@@ -142,7 +142,7 @@ type wireEntry struct {
|
||||
OccurredAt time.Time `json:"occurred_at"`
|
||||
}
|
||||
|
||||
// Shipper batches log entries in memory and flushes them to LoggingServer on
|
||||
// Shipper batches log entries in memory and flushes them to OmniLogger on
|
||||
// a background goroutine, while also behaving like a local
|
||||
// internal/logging.Logger (same method surface, same stdout/stderr output).
|
||||
// A Shipper is safe for concurrent use.
|
||||
@@ -263,7 +263,7 @@ func (s *Shipper) enqueue(entry wireEntry) {
|
||||
}
|
||||
}
|
||||
|
||||
// flush sends every currently buffered entry to LoggingServer in one
|
||||
// flush sends every currently buffered entry to OmniLogger in one
|
||||
// request. Failures are swallowed (beyond a rate-limited local warning) by
|
||||
// design: a host application must never fail, panic, or slow down because
|
||||
// its log sink is unreachable.
|
||||
@@ -302,12 +302,12 @@ func (s *Shipper) flush() {
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
s.warnOnce(fmt.Errorf("logshipper: LoggingServer rejected %d entries: HTTP %d", len(batch), resp.StatusCode))
|
||||
s.warnOnce(fmt.Errorf("logshipper: OmniLogger rejected %d entries: HTTP %d", len(batch), resp.StatusCode))
|
||||
}
|
||||
}
|
||||
|
||||
// warnOnce prints a local stderr warning at most once per minute, no matter
|
||||
// how many sends fail in that window, so an unreachable LoggingServer cannot
|
||||
// how many sends fail in that window, so an unreachable OmniLogger cannot
|
||||
// itself become a log-spam problem.
|
||||
func (s *Shipper) warnOnce(err error) {
|
||||
s.warnMu.Lock()
|
||||
@@ -369,7 +369,7 @@ func (s *Shipper) emit(sev Level, ctx map[string]any, args ...any) {
|
||||
}
|
||||
|
||||
// Unlike the local-only verbose dump above (which scrubs IDs for
|
||||
// readability), the context shipped to LoggingServer is sent unscrubbed:
|
||||
// readability), the context shipped to OmniLogger is sent unscrubbed:
|
||||
// the whole point of centralizing logs is cross-service correlation by
|
||||
// request/user/entity ID, so stripping IDs here would defeat that.
|
||||
var rawCtx json.RawMessage
|
||||
|
||||
@@ -9,7 +9,7 @@ OUTPUT_DIR=../output
|
||||
DOWNLOADS_DIR=../downloads
|
||||
THUMBNAIL_DIR=../thumbnails
|
||||
MODEL_CACHE_DIR=../models
|
||||
WORKFLOWS_DIR=../MediaTools/public/workflows
|
||||
WORKFLOWS_DIR=../CraftStudio/public/workflows
|
||||
FFMPEG_PATH=ffmpeg
|
||||
FFPROBE_PATH=ffprobe
|
||||
YT_DLP_PATH=yt-dlp
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Shared media backend
|
||||
|
||||
The backend is one Go module, shared across every `MEDIA_SERVICE` instance in the workspace. Set `MEDIA_SERVICE` to `viewer`, `tools`, `analyzer`, `config`, `moderator`, `kiosk`, or `carriernode` to select the route set while keeping the same auth, database, migration, file-safety, and worker implementation.
|
||||
The backend is one Go module, shared across every `MEDIA_SERVICE` instance in the workspace. Set `MEDIA_SERVICE` to `viewer`, `craftstudio`, `contentscanner`, `config`, `moderator`, `kiosk`, or `carriernode` to select the route set while keeping the same auth, database, migration, file-safety, and worker implementation.
|
||||
|
||||
From this directory:
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ type Service string
|
||||
|
||||
const (
|
||||
Viewer Service = "viewer"
|
||||
Tools Service = "tools"
|
||||
Analyzer Service = "analyzer"
|
||||
CraftStudio Service = "craftstudio"
|
||||
ContentScanner Service = "contentscanner"
|
||||
ConfigService Service = "config"
|
||||
Moderator Service = "moderator"
|
||||
Kiosk Service = "kiosk"
|
||||
@@ -89,7 +89,7 @@ func Load() (*Config, error) {
|
||||
MediaRoots: roots,
|
||||
InputRoot: filepath.Clean(envOr("INPUT_DIR", "./input")),
|
||||
CopyRoot: filepath.Clean(envOr("UPLOAD_COPY_DIR", "./copy")),
|
||||
WorkflowsRoot: filepath.Clean(envOr("WORKFLOWS_DIR", filepath.Join("..", "MediaTools", "public", "workflows"))),
|
||||
WorkflowsRoot: filepath.Clean(envOr("WORKFLOWS_DIR", filepath.Join("..", "CraftStudio", "public", "workflows"))),
|
||||
ThumbnailRoot: filepath.Clean(envOr("THUMBNAIL_DIR", "./thumbnails")),
|
||||
OutputRoot: filepath.Clean(envOr("OUTPUT_DIR", "./output")),
|
||||
DownloadsRoot: filepath.Clean(envOr("DOWNLOADS_DIR", "./downloads")),
|
||||
@@ -124,10 +124,10 @@ func normalizeService(value string) Service {
|
||||
switch strings.ToLower(strings.TrimSpace(value)) {
|
||||
case "viewer", "mediaviewer":
|
||||
return Viewer
|
||||
case "tools", "mediatools":
|
||||
return Tools
|
||||
case "analyzer", "mediaanalyzer":
|
||||
return Analyzer
|
||||
case "craftstudio":
|
||||
return CraftStudio
|
||||
case "contentscanner":
|
||||
return ContentScanner
|
||||
case "config", "mediaconfig", "projectconfigurator":
|
||||
return ConfigService
|
||||
case "moderator", "mediamoderator":
|
||||
@@ -145,10 +145,10 @@ func serviceName(service Service) string {
|
||||
switch service {
|
||||
case Viewer:
|
||||
return "MediaViewer"
|
||||
case Tools:
|
||||
return "MediaTools"
|
||||
case Analyzer:
|
||||
return "MediaAnalyzer"
|
||||
case CraftStudio:
|
||||
return "CraftStudio"
|
||||
case ContentScanner:
|
||||
return "ContentScanner"
|
||||
case ConfigService:
|
||||
return "ProjectConfigurator"
|
||||
case Moderator:
|
||||
|
||||
@@ -311,7 +311,7 @@ CREATE INDEX IF NOT EXISTS media_analysis_tasks_status_idx ON media_analysis_tas
|
||||
-- to make repeated analysis runs idempotent instead of piling up duplicate tag rows.
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS media_tags_ai_tag_unique ON media_tags (media_key, tag) WHERE user_id IS NULL;
|
||||
|
||||
-- Speeds up the MediaAnalyzer dashboard/pipelines/history/live-status queries: analyzerStats and
|
||||
-- Speeds up the ContentScanner dashboard/pipelines/history/live-status queries: analyzerStats and
|
||||
-- analyzerPipelineBreakdown group active media by type (and join it against thumbnails), and
|
||||
-- analyzerHistory sorts media_worker_jobs by queued_at with no status filter, none of which the
|
||||
-- existing media/media_worker_jobs indexes above actually cover.
|
||||
|
||||
@@ -290,11 +290,11 @@ var serviceTabsByService = map[config.Service][]tabOption{
|
||||
config.Viewer: {
|
||||
{"Library", "/"}, {"Feed", "/feed"}, {"Tags", "/tags"}, {"Playlists", "/playlists"}, {"About", "/about"},
|
||||
},
|
||||
config.Tools: {
|
||||
config.CraftStudio: {
|
||||
{"Generator", "/"}, {"Downloader", "/downloader"}, {"Converter", "/converter"},
|
||||
{"Schedules", "/schedules"}, {"Library", "/library"}, {"About", "/about"},
|
||||
},
|
||||
config.Analyzer: {
|
||||
config.ContentScanner: {
|
||||
{"Dashboard", "/"}, {"Discover", "/discover"}, {"Images", "/images"}, {"Videos", "/videos"},
|
||||
{"Audios", "/audios"}, {"Funscripts", "/funscripts"}, {"Schedules", "/schedules"}, {"About", "/about"},
|
||||
},
|
||||
@@ -310,8 +310,8 @@ var serviceTabsByService = map[config.Service][]tabOption{
|
||||
// mount "type" values each service's own tab accepts when configuring its mounts.
|
||||
var serviceMountTypesByService = map[config.Service][]string{
|
||||
config.Viewer: {"media", "thumbnails", "funscripts"},
|
||||
config.Tools: {"downloads", "generated", "converted", "converter input", "generator input", "generator copy"},
|
||||
config.Analyzer: {"images", "videos", "audios", "funscripts", "models", "thumbnails"},
|
||||
config.CraftStudio: {"downloads", "generated", "converted", "converter input", "generator input", "generator copy"},
|
||||
config.ContentScanner: {"images", "videos", "audios", "funscripts", "models", "thumbnails"},
|
||||
config.Moderator: {"media", "thumbnails"},
|
||||
config.Kiosk: {"media"},
|
||||
config.CarrierNode: {"media", "output"},
|
||||
@@ -538,7 +538,7 @@ func (s *Server) mountMappings(ctx context.Context) map[string]any {
|
||||
// opposed to a project-specific working directory like "downloads", "generated",
|
||||
// "thumbnails", or "models", which have their own dedicated Root config fields instead and
|
||||
// are deliberately left out here. A path is entered under whichever project's tab happens to
|
||||
// need it (MediaAnalyzer's "images"/"videos"/"audios", MediaViewer/MediaKiosk's "media", ...)
|
||||
// need it (ContentScanner's "images"/"videos"/"audios", MediaViewer/MediaKiosk's "media", ...)
|
||||
// but they're all describing locations CarrierNode itself has to walk, since it's the only
|
||||
// service with the volume mounted - see effectiveMediaRoots.
|
||||
var mediaLibraryMountTypes = map[string]bool{
|
||||
@@ -964,7 +964,7 @@ func (s *Server) writeCarrierNodeFiles(w http.ResponseWriter, r *http.Request, r
|
||||
if recent {
|
||||
sort.Slice(files, func(i, j int) bool { return files[i].Mtime > files[j].Mtime })
|
||||
}
|
||||
// Internal callers (e.g. MediaAnalyzer discovery) need to list an entire real-sized library
|
||||
// Internal callers (e.g. ContentScanner discovery) need to list an entire real-sized library
|
||||
// in one pass; the public 1000-item cap stays in place for anyone without the shared secret.
|
||||
maxLimit := 1000
|
||||
if s.cfg.InternalServiceSecret != "" && r.Header.Get("X-Internal-Auth") == s.cfg.InternalServiceSecret {
|
||||
@@ -1175,7 +1175,7 @@ func (s *Server) carrierNodeStore(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// resolveStoreFile is CarrierNode's own local-filesystem lookup for /api/store, which catalogs a
|
||||
// file MediaTools already pushed into one of CarrierNode's mounts (InputRoot, MediaRoots,
|
||||
// file CraftStudio already pushed into one of CarrierNode's mounts (InputRoot, MediaRoots,
|
||||
// DownloadsRoot, OutputRoot) - unlike everything else in this file, it's called with a path that
|
||||
// isn't necessarily under MediaRoots, so it can't just use resolveMediaPath.
|
||||
func (s *Server) resolveStoreFile(value string) (string, error) {
|
||||
|
||||
@@ -1501,7 +1501,7 @@ func hasFunscriptSidecar(filePath string) bool {
|
||||
}
|
||||
|
||||
// funscriptSidecarExists is hasFunscriptSidecar for callers without local filesystem access
|
||||
// (MediaAnalyzer) - it checks for the sidecar on CarrierNode instead of statting a local path.
|
||||
// (ContentScanner) - it checks for the sidecar on CarrierNode instead of statting a local path.
|
||||
func (s *Server) funscriptSidecarExists(ctx context.Context, key string) bool {
|
||||
base := strings.TrimSuffix(key, filepath.Ext(key))
|
||||
for _, candidate := range []string{base + ".funscript", base + ".json"} {
|
||||
|
||||
@@ -433,7 +433,7 @@ type analysisSidecarRequest struct {
|
||||
}
|
||||
|
||||
// callAnalyzerModelsService calls the AnalyzerModels sidecar (a separate process in the same
|
||||
// container, not baked into this binary - see ANALYZER_MODELS_URL and MediaAnalyzer/Dockerfile),
|
||||
// container, not baked into this binary - see ANALYZER_MODELS_URL and ContentScanner/Dockerfile),
|
||||
// the same way executeGeneration already calls out to ComfyUI for image generation. Video frames
|
||||
// are analyzed through the image endpoint since by the time this runs the video has already been
|
||||
// reduced to a still frame.
|
||||
|
||||
@@ -211,9 +211,9 @@ func (s *Server) mountServiceRoutes(r chi.Router) {
|
||||
switch s.cfg.Service {
|
||||
case config.Viewer:
|
||||
s.mountViewerRoutes(r)
|
||||
case config.Tools:
|
||||
case config.CraftStudio:
|
||||
s.mountToolsRoutes(r)
|
||||
case config.Analyzer:
|
||||
case config.ContentScanner:
|
||||
s.mountAnalyzerRoutes(r)
|
||||
case config.ConfigService:
|
||||
s.mountConfigRoutes(r)
|
||||
@@ -337,7 +337,7 @@ func (s *Server) listenAndServe(ctx context.Context) error {
|
||||
|
||||
func (s *Server) Run(ctx context.Context) error {
|
||||
go s.resumeWorkflowJobs(ctx)
|
||||
if s.cfg.Service == config.Analyzer {
|
||||
if s.cfg.Service == config.ContentScanner {
|
||||
go s.runAnalyzerScheduler(ctx)
|
||||
}
|
||||
if s.cfg.Service == config.ConfigService {
|
||||
|
||||
@@ -441,7 +441,7 @@ func firstString(values map[string]any, keys ...string) string {
|
||||
|
||||
// workflowFileCarrierNodePaths mirrors the search order resolveWorkflowFile used to walk locally
|
||||
// (InputRoot, MediaRoots, DownloadsRoot, OutputRoot) but as CarrierNode-side mount prefixes, since
|
||||
// MediaTools no longer has any of those roots mounted on its own filesystem.
|
||||
// CraftStudio no longer has any of those roots mounted on its own filesystem.
|
||||
var workflowFileCarrierNodePaths = []string{"/mount/inputs/", "/media/", "/media/downloads/", "/mount/generated/"}
|
||||
|
||||
// fetchWorkflowFileFromCarrierNode locates a converter input under any of CarrierNode's mounts and
|
||||
|
||||
@@ -1165,7 +1165,7 @@ body.nc-content-scroll-shell:not(.is-feed-stage-active)
|
||||
padding-top: var(--tab-content-top-gap, 0.75rem);
|
||||
}
|
||||
|
||||
/* Semantic worker badges/pills used by MediaAnalyzer history rows. */
|
||||
/* Semantic worker badges/pills used by ContentScanner history rows. */
|
||||
.worker-badge-image,
|
||||
.worker-badge-video,
|
||||
.worker-badge-audio,
|
||||
|
||||
@@ -7,7 +7,7 @@ import { join } from 'path';
|
||||
// now separate repos: MediaModerator, MediaTools, MediaKiosk, MediaViewer). The existsSync guard
|
||||
// below means this currently no-ops safely (nothing to audit) rather than erroring. Left as-is
|
||||
// rather than guessing at a SvelteKit-equivalent audit — remove or repurpose if useful.
|
||||
const projects = ['MediaModerator', 'MediaTools', 'MediaKiosk', 'MediaViewer'];
|
||||
const projects = ['MediaModerator', 'CraftStudio', 'MediaKiosk', 'MediaViewer'];
|
||||
const scriptSrcRe = /<script[^>]+src="([^"]+)"[^>]*>/g;
|
||||
|
||||
projects.forEach(proj => {
|
||||
|
||||
@@ -35,22 +35,22 @@ const sharedThemePath = path.join(
|
||||
const bannedSelectorRules = [
|
||||
{
|
||||
name: 'project-coupled service token',
|
||||
regex: /\b(?:kiosk|viewer|moderator|generator|library|analyzer|downloader|carriernode)-page\b/i,
|
||||
regex: /\b(?:kiosk|viewer|moderator|generator|library|contentscanner|downloader|carriernode)-page\b/i,
|
||||
},
|
||||
{
|
||||
name: 'project-coupled state class token',
|
||||
regex:
|
||||
/\b(?:viewer|kiosk|moderator|generator|library|analyzer|downloader|carriernode)-(?:home|page|stage|mode|active|panel)\b/i,
|
||||
/\b(?:viewer|kiosk|moderator|generator|library|contentscanner|downloader|carriernode)-(?:home|page|stage|mode|active|panel)\b/i,
|
||||
},
|
||||
{
|
||||
name: 'project-prefixed keyframe name',
|
||||
regex:
|
||||
/@keyframes\s+nc-(?:viewer|kiosk|moderator|generator|library|analyzer|downloader|carriernode)/i,
|
||||
/@keyframes\s+nc-(?:viewer|kiosk|moderator|generator|library|contentscanner|downloader|carriernode)/i,
|
||||
},
|
||||
{
|
||||
name: 'project-coupled data attribute',
|
||||
regex:
|
||||
/\[data-(?:kiosk|viewer|moderator|generator|library|analyzer|downloader|carriernode)[^\]]*\]/i,
|
||||
/\[data-(?:kiosk|viewer|moderator|generator|library|contentscanner|downloader|carriernode)[^\]]*\]/i,
|
||||
},
|
||||
{
|
||||
name: 'route-coupled panel selector',
|
||||
|
||||
@@ -84,13 +84,13 @@ function appendContent(targetPath, appendContent) {
|
||||
log('\n── Verification ──');
|
||||
const projects = [
|
||||
{ name: 'MediaModerator', publicDir: 'MediaModerator/public' },
|
||||
{ name: 'MediaTools', publicDir: 'MediaTools/public' },
|
||||
{ name: 'MediaTools Converter', publicDir: 'MediaTools/public/converter' },
|
||||
{ name: 'MediaTools Generator', publicDir: 'MediaTools/generator/public' },
|
||||
{ name: 'MediaTools Downloader', publicDir: 'MediaTools/downloader/public' },
|
||||
{ name: 'CraftStudio', publicDir: 'CraftStudio/public' },
|
||||
{ name: 'CraftStudio Converter', publicDir: 'CraftStudio/public/converter' },
|
||||
{ name: 'CraftStudio Generator', publicDir: 'CraftStudio/generator/public' },
|
||||
{ name: 'CraftStudio Downloader', publicDir: 'CraftStudio/downloader/public' },
|
||||
{ name: 'MediaKiosk', publicDir: 'MediaKiosk/public' },
|
||||
{ name: 'MediaViewer', publicDir: 'MediaViewer/public' },
|
||||
{ name: 'MediaAnalyzer', publicDir: 'MediaAnalyzer/public' },
|
||||
{ name: 'ContentScanner', publicDir: 'ContentScanner/public' },
|
||||
{ name: 'MediaDesktop', publicDir: 'MediaDesktop/public' },
|
||||
];
|
||||
let allOk = true;
|
||||
|
||||
@@ -44,10 +44,10 @@ $consumerProjects = @(
|
||||
New-ConsumerProject 'Forks/HordeWorker'
|
||||
New-ConsumerProject 'Original/OutdoorGames'
|
||||
New-ConsumerProject 'Original/KioskDisplay' -Destination 'engine'
|
||||
New-ConsumerProject 'Original/MediaAnalyzer' -Destination 'engine'
|
||||
New-ConsumerProject 'Original/MediaTools' -Destination 'engine'
|
||||
New-ConsumerProject 'Original/CraftStudio' -Destination 'engine'
|
||||
New-ConsumerProject 'Original/MediaViewer' -Destination 'engine'
|
||||
New-ConsumerProject 'Central/CarrierNode' -Destination 'engine'
|
||||
New-ConsumerProject 'Central/ContentScanner' -Destination 'engine'
|
||||
New-ConsumerProject 'Central/ModerationHub' -Destination 'engine'
|
||||
New-ConsumerProject 'Central/ProjectConfigurator' -Destination 'engine'
|
||||
New-ConsumerProject 'Central/AuthGuard'
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"build": "vite build",
|
||||
"build:all": "node scripts/build-all.mjs",
|
||||
"build:viewer": "node scripts/build-all.mjs viewer",
|
||||
"build:tools": "node scripts/build-all.mjs tools",
|
||||
"build:analyzer": "node scripts/build-all.mjs analyzer",
|
||||
"build:craftstudio": "node scripts/build-all.mjs craftstudio",
|
||||
"build:contentscanner": "node scripts/build-all.mjs contentscanner",
|
||||
"build:config": "node scripts/build-all.mjs config",
|
||||
"build:moderator": "node scripts/build-all.mjs moderator",
|
||||
"build:kiosk": "node scripts/build-all.mjs kiosk",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"viewer": { "name": "MediaViewer", "icon": "play" },
|
||||
"tools": { "name": "MediaTools", "icon": "wand-sparkles" },
|
||||
"analyzer": { "name": "MediaAnalyzer", "icon": "scan-search" },
|
||||
"craftstudio": { "name": "CraftStudio", "icon": "wand-sparkles" },
|
||||
"contentscanner": { "name": "ContentScanner", "icon": "scan-search" },
|
||||
"config": { "name": "ProjectConfigurator", "icon": "settings-2" },
|
||||
"moderator": { "name": "MediaModerator", "icon": "shield-check" },
|
||||
"kiosk": { "name": "MediaKiosk", "icon": "image" },
|
||||
|
||||
@@ -6,8 +6,8 @@ const webUiDir = path.resolve(import.meta.dirname, '..')
|
||||
const enginesDir = path.resolve(webUiDir, '..')
|
||||
const targets = {
|
||||
viewer: 'MediaViewer',
|
||||
tools: 'MediaTools',
|
||||
analyzer: 'MediaAnalyzer',
|
||||
craftstudio: 'CraftStudio',
|
||||
contentscanner: 'ContentScanner',
|
||||
config: 'ProjectConfigurator',
|
||||
moderator: 'MediaModerator',
|
||||
kiosk: 'MediaKiosk',
|
||||
|
||||
@@ -44,10 +44,10 @@ const configs: Record<AppId, AppConfig> = {
|
||||
},
|
||||
],
|
||||
},
|
||||
tools: {
|
||||
id: 'tools',
|
||||
name: 'MediaTools',
|
||||
icon: projectIcon('tools'),
|
||||
craftstudio: {
|
||||
id: 'craftstudio',
|
||||
name: 'CraftStudio',
|
||||
icon: projectIcon('craftstudio'),
|
||||
eyebrow: 'Media workflow studio',
|
||||
description: 'Generate, download, convert, and schedule media jobs in one place.',
|
||||
nav: [
|
||||
@@ -88,10 +88,10 @@ const configs: Record<AppId, AppConfig> = {
|
||||
},
|
||||
],
|
||||
},
|
||||
analyzer: {
|
||||
id: 'analyzer',
|
||||
name: 'MediaAnalyzer',
|
||||
icon: projectIcon('analyzer'),
|
||||
contentscanner: {
|
||||
id: 'contentscanner',
|
||||
name: 'ContentScanner',
|
||||
icon: projectIcon('contentscanner'),
|
||||
eyebrow: 'Processing operations',
|
||||
description: 'Monitor discovery and define per-type processing pipelines and automation queues.',
|
||||
nav: [
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
import { pageActions } from '$lib/stores/page-actions.svelte'
|
||||
import { get, post, put } from '$lib/api'
|
||||
import '$lib/language.svelte'
|
||||
import { layoutState } from '$lib/layout.svelte'
|
||||
import type { AppConfig, AuthState, AuthUser } from '$lib/types'
|
||||
import type { Snippet } from 'svelte'
|
||||
|
||||
@@ -170,7 +171,7 @@
|
||||
username={displayName}
|
||||
/>
|
||||
|
||||
<main class="mx-auto w-full max-w-7xl px-4 pt-4 pb-8">
|
||||
<main class={`mx-auto w-full px-4 pt-4 pb-8 ${layoutState.wide ? '' : 'max-w-7xl'}`}>
|
||||
<PageHeader
|
||||
title={activeNavItem?.label || app.name}
|
||||
description={activeNavItem?.description || app.description}
|
||||
|
||||
File renamed without changes.
+1
-1
@@ -9,7 +9,7 @@
|
||||
status = {},
|
||||
stats = {},
|
||||
loading = false,
|
||||
description = 'Current analyzer worker state.',
|
||||
description = 'Current content-scanning worker state.',
|
||||
}: { status?: Json; stats?: Json; loading?: boolean; description?: string } = $props()
|
||||
|
||||
// discovering/extracting/cleaning all share one backend scan slot (see scanCancel on the Go
|
||||
File renamed without changes.
@@ -2,6 +2,7 @@
|
||||
import { Moon, Sun, SunMoon } from '@lucide/svelte'
|
||||
import { Button, SettingsDialog as SharedSettingsDialog } from '@gabriel20xx/web-ui'
|
||||
import { currentLanguage, languages, setLanguage } from '$lib/language.svelte'
|
||||
import { layoutState } from '$lib/layout.svelte'
|
||||
import { themeState } from '$lib/theme.svelte'
|
||||
|
||||
let {
|
||||
@@ -67,6 +68,15 @@
|
||||
{/each}
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label class="wide-row">
|
||||
<span class="sc-label">Wide page</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={layoutState.wide}
|
||||
onchange={(event) => layoutState.setWide(event.currentTarget.checked)}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</SharedSettingsDialog>
|
||||
|
||||
@@ -79,4 +89,17 @@
|
||||
border: 1px solid var(--sc-border);
|
||||
border-radius: var(--sc-radius-md);
|
||||
}
|
||||
|
||||
.wide-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.wide-row input {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
accent-color: var(--sc-primary);
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state'
|
||||
import { getAppConfig, getPanelForPath, getPathForPanel } from '$lib/app-config'
|
||||
import AnalyzerWorkspace from '$lib/features/AnalyzerWorkspace.svelte'
|
||||
import ContentScannerWorkspace from '$lib/features/ContentScannerWorkspace.svelte'
|
||||
import ConfigWorkspace from '$lib/features/ConfigWorkspace.svelte'
|
||||
import FeedWorkspace from '$lib/features/FeedWorkspace.svelte'
|
||||
import KioskWorkspace from '$lib/features/KioskWorkspace.svelte'
|
||||
@@ -10,10 +10,10 @@
|
||||
import CarrierNodeWorkspace from '$lib/features/CarrierNodeWorkspace.svelte'
|
||||
import TagsWorkspace from '$lib/features/TagsWorkspace.svelte'
|
||||
import VideoPage from '$lib/features/VideoPage.svelte'
|
||||
import ToolsWorkspace from '$lib/features/ToolsWorkspace.svelte'
|
||||
import CraftStudioWorkspace from '$lib/features/CraftStudioWorkspace.svelte'
|
||||
import ViewerWorkspace from '$lib/features/ViewerWorkspace.svelte'
|
||||
|
||||
const analyzerMediaTypePanels: Record<
|
||||
const contentScannerMediaTypePanels: Record<
|
||||
string,
|
||||
{ mediaType: 'image' | 'video' | 'audio' | 'funscript'; label: string }
|
||||
> = {
|
||||
@@ -64,15 +64,15 @@
|
||||
<TagsWorkspace />
|
||||
{:else if app.id === 'viewer'}
|
||||
<ViewerWorkspace {panel} />
|
||||
{:else if app.id === 'analyzer' && panel in analyzerMediaTypePanels}
|
||||
{:else if app.id === 'contentscanner' && panel in contentScannerMediaTypePanels}
|
||||
<MediaTypePipeline
|
||||
mediaType={analyzerMediaTypePanels[panel].mediaType}
|
||||
label={analyzerMediaTypePanels[panel].label}
|
||||
mediaType={contentScannerMediaTypePanels[panel].mediaType}
|
||||
label={contentScannerMediaTypePanels[panel].label}
|
||||
/>
|
||||
{:else if app.id === 'tools'}
|
||||
<ToolsWorkspace {panel} />
|
||||
{:else if app.id === 'analyzer'}
|
||||
<AnalyzerWorkspace {panel} />
|
||||
{:else if app.id === 'craftstudio'}
|
||||
<CraftStudioWorkspace {panel} />
|
||||
{:else if app.id === 'contentscanner'}
|
||||
<ContentScannerWorkspace {panel} />
|
||||
{:else if app.id === 'config'}
|
||||
<ConfigWorkspace />
|
||||
{:else if app.id === 'moderator'}
|
||||
|
||||
@@ -36,14 +36,14 @@
|
||||
'This instance, plus any peer instances for high availability - they sync settings with each other automatically.',
|
||||
},
|
||||
{ base: 'AuthGuard', description: 'Centralized identity: login, sessions, TOTP, admin users.' },
|
||||
{ base: 'LoggingServer', description: 'Centralized log aggregation across every service.' },
|
||||
{ base: 'OmniLogger', description: 'Centralized log aggregation across every service.' },
|
||||
{ base: 'ModerationHub', description: 'Admin console for user and media moderation.' },
|
||||
{ base: 'CarrierNode', description: 'Storage and delivery: mounts, bandwidth, file activity.' },
|
||||
]
|
||||
const CENTRAL_PORTS: Record<string, string> = {
|
||||
projectconfigurator: '3005',
|
||||
authguard: '8080',
|
||||
loggingserver: '8090',
|
||||
omnilogger: '8090',
|
||||
moderationhub: '8090',
|
||||
carriernode: '3003',
|
||||
}
|
||||
@@ -52,7 +52,7 @@
|
||||
const CENTRAL_MOUNT_TYPES: Record<string, string[]> = {
|
||||
projectconfigurator: [],
|
||||
authguard: [],
|
||||
loggingserver: [],
|
||||
omnilogger: [],
|
||||
moderationhub: ['media', 'thumbnails'],
|
||||
carriernode: [],
|
||||
}
|
||||
@@ -643,17 +643,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Best-effort migration from the pre-rename settings shape: MediaConfig -> ProjectConfigurator,
|
||||
// MediaServant -> CarrierNode, and the old flat configured_projects list (which mixed
|
||||
// MediaConfig/MediaServant in with every other project) split into configured_central /
|
||||
// configured_main.
|
||||
// Best-effort migration from each pre-rename settings shape: MediaConfig -> ProjectConfigurator,
|
||||
// MediaServant -> CarrierNode, MediaAnalyzer -> ContentScanner, MediaTools -> CraftStudio,
|
||||
// LoggingServer -> OmniLogger, and the old flat configured_projects list (which mixed all of
|
||||
// these in with every other project) split into configured_central / configured_main.
|
||||
const LEGACY_RENAMES: [string, string][] = [
|
||||
['mediaconfig', 'projectconfigurator'],
|
||||
['mediaservant', 'carriernode'],
|
||||
['analyzer', 'contentscanner'],
|
||||
['mediaanalyzer', 'contentscanner'],
|
||||
['tools', 'craftstudio'],
|
||||
['mediatools', 'craftstudio'],
|
||||
['loggingserver', 'omnilogger'],
|
||||
]
|
||||
const LEGACY_RENAME_LABELS: Record<string, string> = {
|
||||
projectconfigurator: 'ProjectConfigurator',
|
||||
carriernode: 'CarrierNode',
|
||||
contentscanner: 'ContentScanner',
|
||||
craftstudio: 'CraftStudio',
|
||||
omnilogger: 'OmniLogger',
|
||||
}
|
||||
|
||||
// Renames a project name that may still carry a pre-rename base (e.g. "MediaServant" or
|
||||
@@ -1029,7 +1037,7 @@
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<SectionTitle
|
||||
title="Central services"
|
||||
description="ProjectConfigurator (this instance), AuthGuard, LoggingServer, ModerationHub, and CarrierNode. Additional ProjectConfigurator instances sync settings with this one automatically."
|
||||
description="ProjectConfigurator (this instance), AuthGuard, OmniLogger, ModerationHub, and CarrierNode. Additional ProjectConfigurator instances sync settings with this one automatically."
|
||||
/>
|
||||
<Button variant="secondary" size="sm" onclick={() => void syncNow()} disabled={syncing}>
|
||||
<RefreshCw class="size-4" />{syncing ? 'Syncing…' : 'Sync now'}
|
||||
@@ -1064,7 +1072,7 @@
|
||||
<Card class="space-y-5">
|
||||
<SectionTitle
|
||||
title="Main services"
|
||||
description="Product services such as MediaViewer, MediaTools, Bitmagnet, Heretic, and the rest. Enter just a URL - name, tabs, and mount types are detected automatically."
|
||||
description="Product services such as MediaViewer, CraftStudio, Bitmagnet, Heretic, and the rest. Enter just a URL - name, tabs, and mount types are detected automatically."
|
||||
/>
|
||||
<div class="flex flex-col gap-2 sm:flex-row">
|
||||
<input
|
||||
|
||||
+15
-15
@@ -4,9 +4,9 @@
|
||||
import { SvelteSet } from 'svelte/reactivity'
|
||||
import { Badge, Button, Card, EmptyState, Metric, notify, SectionTitle } from '@gabriel20xx/web-ui'
|
||||
import { del, get, post } from '$lib/api'
|
||||
import AnalyzerHistory from '$lib/components/AnalyzerHistory.svelte'
|
||||
import AnalyzerLiveStatus from '$lib/components/AnalyzerLiveStatus.svelte'
|
||||
import AnalyzerPipelineBreakdown from '$lib/components/AnalyzerPipelineBreakdown.svelte'
|
||||
import ContentScannerHistory from '$lib/components/ContentScannerHistory.svelte'
|
||||
import ContentScannerLiveStatus from '$lib/components/ContentScannerLiveStatus.svelte'
|
||||
import ContentScannerPipelineBreakdown from '$lib/components/ContentScannerPipelineBreakdown.svelte'
|
||||
import { cn } from '$lib/utils/cn'
|
||||
|
||||
type Json = Record<string, unknown>
|
||||
@@ -49,7 +49,7 @@
|
||||
for (const type of DISCOVER_TYPES) selectedPipelineTypes.add(type.key)
|
||||
}
|
||||
|
||||
// Mirrors the pipeline stages modeled everywhere else (AnalyzerPipelineBreakdown, the per-type
|
||||
// Mirrors the pipeline stages modeled everywhere else (ContentScannerPipelineBreakdown, the per-type
|
||||
// Images/Videos/Audios/Funscripts tabs): discover, extract metadata, generate thumbnails, and
|
||||
// run AI analysis. Each maps to its own backend action, scoped by the selected media types.
|
||||
const PIPELINE_ACTIONS: { key: 'discover' | 'metadata' | 'thumbnails' | 'analyze'; label: string; endpoint: string }[] = [
|
||||
@@ -190,7 +190,7 @@
|
||||
schedules = Array.isArray(rawSchedules) ? (rawSchedules as Json[]) : []
|
||||
} catch (reason) {
|
||||
if (generation !== loadGeneration) return
|
||||
error = reason instanceof Error ? reason.message : 'Unable to load analyzer state.'
|
||||
error = reason instanceof Error ? reason.message : 'Unable to load content-scanning state.'
|
||||
} finally {
|
||||
if (!background) loading = false
|
||||
}
|
||||
@@ -414,7 +414,7 @@
|
||||
variant="success"
|
||||
/><Metric label="Errors" value={numeric('errors', numeric('failed'))} detail="Needs attention" variant="danger" />
|
||||
</div>
|
||||
<AnalyzerPipelineBreakdown pipeline={asRecord(stats.pipeline)} />
|
||||
<ContentScannerPipelineBreakdown pipeline={asRecord(stats.pipeline)} />
|
||||
<div class="grid gap-4 lg:grid-cols-[minmax(0,1.25fr)_minmax(280px,.75fr)]">
|
||||
<Card class="space-y-5"
|
||||
><SectionTitle
|
||||
@@ -458,9 +458,9 @@
|
||||
>
|
||||
</div>
|
||||
</Card>
|
||||
<AnalyzerLiveStatus {status} {stats} {loading} description="Last response from the analyzer service." />
|
||||
<ContentScannerLiveStatus {status} {stats} {loading} description="Last response from the content-scanning service." />
|
||||
</div>
|
||||
<AnalyzerHistory
|
||||
<ContentScannerHistory
|
||||
title="Recent processing history"
|
||||
description="Every discovered, extracted, and analyzed element is recorded here."
|
||||
/>
|
||||
@@ -483,7 +483,7 @@
|
||||
variant="success"
|
||||
/><Metric label="Errors" value={numeric('errors', numeric('failed'))} detail="Needs attention" variant="danger" />
|
||||
</div>
|
||||
<AnalyzerLiveStatus {status} {stats} {loading} description="Current analyzer schedule and worker state." />
|
||||
<ContentScannerLiveStatus {status} {stats} {loading} description="Current content-scanning schedule and worker state." />
|
||||
<Card class="space-y-5"
|
||||
><SectionTitle
|
||||
title="New schedule"
|
||||
@@ -539,7 +539,7 @@
|
||||
<Card class="space-y-5"
|
||||
><SectionTitle
|
||||
title="Schedules"
|
||||
description="Recurring analyzer jobs and their current state."
|
||||
description="Recurring content-scanning jobs and their current state."
|
||||
/>{#if schedules.length === 0}<EmptyState
|
||||
title="No automation schedules"
|
||||
message="Create one above; it will appear here with its next run."
|
||||
@@ -549,7 +549,7 @@
|
||||
>
|
||||
<div class="min-w-0">
|
||||
<p class="truncate text-sm font-medium text-fg">
|
||||
{String(schedule.name || schedule.tool || 'Analyzer schedule')}
|
||||
{String(schedule.name || schedule.tool || 'Content scan schedule')}
|
||||
</p>
|
||||
<p class="mt-1 text-xs text-muted-fg">
|
||||
{String(schedule.tool || '—')} · every {String(schedule.intervalMinutes ?? '?')}m · Next run: {String(
|
||||
@@ -572,9 +572,9 @@
|
||||
</div>{/each}
|
||||
</div>{/if}</Card
|
||||
>
|
||||
<AnalyzerHistory
|
||||
<ContentScannerHistory
|
||||
title="Processing history"
|
||||
description="Elements processed while scheduled analyzer work runs."
|
||||
description="Elements processed while scheduled content-scanning work runs."
|
||||
/>
|
||||
{:else}
|
||||
<div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
|
||||
@@ -610,9 +610,9 @@
|
||||
</p>
|
||||
</div></Card
|
||||
>
|
||||
<AnalyzerLiveStatus {status} {stats} {loading} description="Current discovery run, including the file it's on." />
|
||||
<ContentScannerLiveStatus {status} {stats} {loading} description="Current discovery run, including the file it's on." />
|
||||
</div>
|
||||
<AnalyzerHistory
|
||||
<ContentScannerHistory
|
||||
title="Discovery history"
|
||||
description="Discovered elements, statuses, and results."
|
||||
/>
|
||||
File renamed without changes.
@@ -4,7 +4,7 @@
|
||||
import { SvelteSet } from 'svelte/reactivity'
|
||||
import { Button, Card, Metric, notify, SectionTitle } from '@gabriel20xx/web-ui'
|
||||
import { get, post } from '$lib/api'
|
||||
import AnalyzerHistory from '$lib/components/AnalyzerHistory.svelte'
|
||||
import ContentScannerHistory from '$lib/components/ContentScannerHistory.svelte'
|
||||
import PipelineFlowDiagram from '$lib/components/PipelineFlowDiagram.svelte'
|
||||
import { cn } from '$lib/utils/cn'
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
})),
|
||||
)
|
||||
|
||||
// Mirrors AnalyzerWorkspace.svelte's dashboard "Pipeline controls" panel, scoped to this one
|
||||
// Mirrors ContentScannerWorkspace.svelte's dashboard "Pipeline controls" panel, scoped to this one
|
||||
// page's fixed media type instead of a type selector. Selection is deliberately never reset on
|
||||
// tab switch (same as the dashboard's own selection) - runSelectedStages filters by both
|
||||
// selection and applicability, so a stage picked on one tab that doesn't apply to another
|
||||
@@ -273,7 +273,7 @@
|
||||
// walk/probe files synchronously) and can't run at once - discovery already re-probes
|
||||
// metadata for the exact same files as a side effect, so when both are picked, discovery
|
||||
// wins and the separate metadata call is skipped rather than failing with a conflict.
|
||||
// Mirrors AnalyzerWorkspace.svelte's runSelectedPipeline.
|
||||
// Mirrors ContentScannerWorkspace.svelte's runSelectedPipeline.
|
||||
const runDiscover = selectedStages.has('discover')
|
||||
const stages = availableStageActions.filter(
|
||||
(action) => selectedStages.has(action.key) && !(action.key === 'metadata' && runDiscover),
|
||||
@@ -478,7 +478,7 @@
|
||||
{/if}
|
||||
</Card>
|
||||
|
||||
<AnalyzerHistory
|
||||
<ContentScannerHistory
|
||||
{mediaType}
|
||||
title={`Recent ${label.toLowerCase()} history`}
|
||||
description="Elements of this media type processed by the pipeline."
|
||||
|
||||
@@ -457,7 +457,7 @@
|
||||
Loading media…
|
||||
</p>{:else if media.length === 0}<EmptyState
|
||||
title="No catalog media found"
|
||||
message="MediaAnalyzer outputs will appear once the catalog synchronization has data."
|
||||
message="ContentScanner outputs will appear once the catalog synchronization has data."
|
||||
/>{:else}<div class="overflow-x-auto">
|
||||
<table class="w-full min-w-[720px] text-left">
|
||||
<thead
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import { browser } from '$app/environment'
|
||||
|
||||
const storageKey = 'shared-webui-wide-layout'
|
||||
|
||||
function getStoredWide(): boolean {
|
||||
if (!browser) return false
|
||||
|
||||
try {
|
||||
return localStorage.getItem(storageKey) === 'true'
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
let wide = $state<boolean>(getStoredWide())
|
||||
|
||||
function applyWide(next: boolean) {
|
||||
if (browser) document.documentElement.toggleAttribute('data-wide-layout', next)
|
||||
}
|
||||
|
||||
function setWide(next: boolean) {
|
||||
wide = next
|
||||
if (!browser) return
|
||||
|
||||
applyWide(wide)
|
||||
try {
|
||||
localStorage.setItem(storageKey, String(wide))
|
||||
} catch {
|
||||
// Ignore storage failures; the current page can still use the selected layout width.
|
||||
}
|
||||
}
|
||||
|
||||
if (browser) applyWide(wide)
|
||||
|
||||
export const layoutState = {
|
||||
get wide() {
|
||||
return wide
|
||||
},
|
||||
setWide,
|
||||
toggle() {
|
||||
setWide(!wide)
|
||||
},
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
export type AppId = 'viewer' | 'tools' | 'analyzer' | 'config' | 'moderator' | 'kiosk' | 'carriernode'
|
||||
export type AppId = 'viewer' | 'craftstudio' | 'contentscanner' | 'config' | 'moderator' | 'kiosk' | 'carriernode'
|
||||
|
||||
export type ProjectIconName =
|
||||
'image' | 'monitor-play' | 'play' | 'scan-search' | 'server' | 'settings-2' | 'shield-check' | 'wand-sparkles'
|
||||
|
||||
Reference in new issue
Block a user