Fold MediaEngine (media-backend, media-webui) into this repo

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>
This commit is contained in:
Gabriel20xxandClaude Sonnet 5 committed 2026-08-31 22:06:29 +02:00
1 parent 79d9461769
commit acde180086
99 files changed
+20488 -1

No files matched your search

@@ -0,0 +1,116 @@
<script lang="ts">
import { page } from '$app/state'
import { Film, Music2, Play } from '@lucide/svelte'
import { get } from '$lib/api'
import EmptyState from '$lib/components/EmptyState.svelte'
import Badge from '$lib/components/ui/badge.svelte'
import Button from '$lib/components/ui/button.svelte'
import Card from '$lib/components/ui/card.svelte'
interface FeedItem {
mediaKey?: string
url?: string
thumbnail?: string
name?: string
filename?: string
mediaType?: string
title?: string | null
category?: string | null
}
let item = $state<FeedItem | null>(null)
let loading = $state(true)
let error = $state('')
let reloadToken = $state(0)
let loadSequence = 0
const exactMedia = $derived(page.url.searchParams.get('video')?.trim() || '')
async function loadFeed(exact: string) {
const sequence = ++loadSequence
loading = true
error = ''
try {
const query = exact ? `?exact=${encodeURIComponent(exact)}` : ''
const response = await get<{ data?: FeedItem }>(`/api/media/random/all${query}`)
if (sequence !== loadSequence) return
item = response.data || null
if (!item) error = 'No media found.'
} catch (reason) {
if (sequence !== loadSequence) return
item = null
error = reason instanceof Error ? reason.message : 'Unable to load the media feed.'
} finally {
if (sequence === loadSequence) loading = false
}
}
$effect(() => {
const exact = exactMedia
const token = reloadToken
void token
void loadFeed(exact)
})
function nextItem() {
if (exactMedia) window.location.href = '/feed'
else reloadToken += 1
}
function isImage(media: FeedItem) {
return media.mediaType === 'static' || media.mediaType === 'image'
}
</script>
<div>
{#if loading}
<div class="media-shimmer mx-auto h-[min(70dvh,48rem)] max-w-4xl rounded-xl border border-border"></div>
{:else if error}
<div class="rounded-md border border-danger/30 bg-danger/10 px-4 py-3 text-sm text-danger">{error}</div>
{:else if !item}
<EmptyState title="No media found" message="The feed will appear once media has been indexed." />
{:else}
<Card class="mx-auto max-w-4xl overflow-hidden p-0">
<div class="relative flex min-h-[min(70dvh,48rem)] items-center justify-center overflow-hidden bg-black">
{#if isImage(item)}
<img
src={item.url || item.thumbnail || ''}
alt={item.title || item.name || item.filename || 'Media'}
class="max-h-[min(70dvh,48rem)] max-w-full object-contain"
/>
{:else if item.url}
<video
src={item.url}
poster={item.thumbnail}
controls
autoplay
playsinline
class="max-h-[min(70dvh,48rem)] max-w-full object-contain"
>
<track kind="captions" srclang="en" label="Captions" src="data:text/vtt,WEBVTT" />
</video>
{:else}
<div class="flex flex-col items-center gap-3 text-muted-fg">
{#if item.mediaType === 'audio'}<Music2 class="size-12" />{:else}<Film class="size-12" />{/if}
<span>Preview unavailable</span>
</div>
{/if}
</div>
<div class="flex flex-col gap-3 border-t border-border p-4 sm:flex-row sm:items-center sm:justify-between">
<div class="min-w-0">
<p class="truncate text-sm font-medium text-fg">
{item.title || item.name || item.filename || 'Untitled media'}
</p>
<div class="mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-fg">
{#if item.mediaType}<Badge tone="neutral">{item.mediaType}</Badge>{/if}
{#if item.category}<span>{item.category}</span>{/if}
{#if item.filename}<span class="truncate">{item.filename}</span>{/if}
</div>
</div>
<Button size="sm" onclick={() => void nextItem()} disabled={loading}><Play />Next item</Button>
</div>
</Card>
{/if}
</div>