Files
shared/media-webui/src/lib/app-config.ts
T
Gabriel20xxandClaude Sonnet 5 38a349eb52 Fix media-backend/media-webui: re-copy from post-revert MediaCollection
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>
2026-08-31 22:19:58 +02:00

287 lines
8.0 KiB
TypeScript

import projectIcons from '../../project-icons.json'
import type { AppConfig, AppId } from './types'
import type { ProjectIconName } from './types'
function projectIcon(id: AppId): ProjectIconName {
return projectIcons[id].icon as ProjectIconName
}
const configs: Record<AppId, AppConfig> = {
viewer: {
id: 'viewer',
name: 'MediaViewer',
icon: projectIcon('viewer'),
eyebrow: 'Immersive media library',
description: 'Browse, search, and play your media collection from one calm workspace.',
nav: [
{
label: 'Library',
panel: 'library',
path: '/',
icon: 'gallery-horizontal-end',
description: 'Browse, search, and play your media collection.',
},
{
label: 'Feed',
panel: 'view',
path: '/feed',
icon: 'monitor-play',
description: 'View a focused stream of media from your collection.',
},
{
label: 'Tags',
panel: 'tags',
path: '/tags',
icon: 'tags',
description: 'Explore media by tags and related items.',
},
{
label: 'Playlists',
panel: 'playlists',
path: '/playlists',
icon: 'list-video',
description: 'Organize media into playlists for convenient playback.',
},
],
},
tools: {
id: 'tools',
name: 'MediaTools',
icon: projectIcon('tools'),
eyebrow: 'Media workflow studio',
description: 'Generate, download, convert, and schedule media jobs in one place.',
nav: [
{
label: 'Generator',
panel: 'generator',
path: '/',
icon: 'wand-sparkles',
description: 'Generate new media and monitor generation jobs.',
},
{
label: 'Downloader',
panel: 'downloader',
path: '/downloader',
icon: 'cloud-download',
description: 'Download media from configured sources.',
},
{
label: 'Converter',
panel: 'converter',
path: '/converter',
icon: 'refresh-cw',
description: 'Convert media between supported formats.',
},
{
label: 'Schedules',
panel: 'schedules',
path: '/schedules',
icon: 'activity',
description: 'Schedule recurring media tools and maintenance jobs.',
},
{
label: 'Library',
panel: 'library',
path: '/library',
icon: 'image',
description: 'Inspect media produced by the tools workspace.',
},
],
},
analyzer: {
id: 'analyzer',
name: 'MediaAnalyzer',
icon: projectIcon('analyzer'),
eyebrow: 'Processing operations',
description: 'Monitor discovery and define per-type processing pipelines and automation queues.',
nav: [
{
label: 'Dashboard',
panel: 'dashboard',
path: '/',
icon: 'layout-dashboard',
description: 'Monitor processing queues, progress, and recent history.',
},
{
label: 'Discover',
panel: 'discover',
path: '/discover',
icon: 'folder-open',
description: 'Discover and register media from configured locations.',
},
{
label: 'Images',
panel: 'images',
path: '/images',
icon: 'image',
description: 'Define the image pipeline: thumbnails, metadata extraction, and AI analysis.',
},
{
label: 'Videos',
panel: 'videos',
path: '/videos',
icon: 'monitor-play',
description: 'Define the video pipeline: thumbnails, metadata extraction, and AI analysis.',
},
{
label: 'Audios',
panel: 'audios',
path: '/audios',
icon: 'audio-lines',
description: 'Define the audio pipeline: thumbnails, metadata extraction, and AI analysis.',
},
{
label: 'Funscripts',
panel: 'funscripts',
path: '/funscripts',
icon: 'scroll-text',
description: 'Define the funscript pipeline: thumbnails, metadata extraction, and AI analysis.',
},
{
label: 'Schedules',
panel: 'schedules',
path: '/schedules',
icon: 'activity',
description: 'Configure recurring analyzer operations.',
},
],
},
config: {
id: 'config',
name: 'MediaConfig',
icon: projectIcon('config'),
eyebrow: 'Platform configuration',
description: 'Connect services, configure mounts, and tune shared processing parameters.',
nav: [
{
label: 'Mounts',
panel: 'mounts',
path: '/',
icon: 'hard-drive',
description: 'Configure collection mounts and connected storage.',
},
{
label: 'Parameters',
panel: 'parameters',
path: '/parameters',
icon: 'sliders-horizontal',
description: 'Tune shared processing and service parameters.',
},
],
},
moderator: {
id: 'moderator',
name: 'MediaModerator',
icon: projectIcon('moderator'),
eyebrow: 'Administration and safety',
description: 'Review users, media, tags, visibility, and platform health.',
nav: [
{
label: 'Dashboard',
panel: 'dashboard',
path: '/',
icon: 'bar-chart-3',
description: 'Review moderation activity and platform health.',
},
{
label: 'Users',
panel: 'users',
path: '/users',
icon: 'users',
description: 'Manage accounts, roles, and access.',
},
{
label: 'Media',
panel: 'media',
path: '/media',
icon: 'shield-check',
description: 'Review media visibility and moderation status.',
},
],
},
kiosk: {
id: 'kiosk',
name: 'MediaKiosk',
icon: projectIcon('kiosk'),
eyebrow: 'Ambient display',
description: 'Show the latest collection output in a focused, full-screen canvas.',
nav: [
{
label: 'Kiosk',
panel: 'kiosk',
path: '/',
icon: 'monitor-play',
description: 'Show the latest collection output in a focused display.',
},
],
},
servant: {
id: 'servant',
name: 'MediaServant',
icon: projectIcon('servant'),
eyebrow: 'Storage and delivery',
description: 'Inspect mounts, file activity, bandwidth, and media delivery health.',
nav: [
{
label: 'Overview',
panel: 'overview',
path: '/',
icon: 'server',
description: 'Inspect storage, delivery, and service health.',
},
{
label: 'Files',
panel: 'files',
path: '/files',
icon: 'folder-open',
description: 'Review recent files and media activity.',
},
],
},
desktop: {
id: 'desktop',
name: 'MediaViewer Desktop',
icon: projectIcon('desktop'),
eyebrow: 'Connected player',
description: 'Control playback, funscripts, and connected devices from your desktop.',
nav: [
{
label: 'Player',
panel: 'player',
path: '/',
icon: 'monitor-play',
description: 'Control playback and connected desktop devices.',
},
{
label: 'Devices',
panel: 'devices',
path: '/devices',
icon: 'box',
description: 'Manage connected playback and funscript devices.',
},
],
},
}
export function getAppConfig(id: string): AppConfig {
return configs[(id as AppId) in configs ? (id as AppId) : 'viewer']
}
function normalizePathname(pathname: string): string {
const normalized = String(pathname || '/').replace(/\/+$/, '')
return normalized || '/'
}
export function getPanelForPath(app: AppConfig, pathname: string): string {
const normalizedPath = normalizePathname(pathname)
const matchingItem = app.nav.find((item) => {
if (item.path === '/') return normalizedPath === '/'
return normalizedPath === item.path || normalizedPath.startsWith(`${item.path}/`)
})
return matchingItem?.panel || app.nav[0]?.panel || ''
}
export function getPathForPanel(app: AppConfig, panel: string): string {
return app.nav.find((item) => item.panel === panel)?.path || app.nav[0]?.path || '/'
}