feat(media): primary media storage, growth goals, retention and delivery tools
CI / build (push) Has been cancelled
CI / build (push) Has been cancelled
Event photos and videos are now stored only on the NFS/local share named in Settings -> Media storage. Uploads, photo editing, video processing and the per-event filing step refuse to run until that share is configured and writable, so nothing is silently written inside the container. Video originals, renditions, posters and sidecars share one folder on the share. Also adds volunteer growth goals with a mentor queue, an admin retention and storage sweep with a cron entry point, cached gallery thumbnails with per-folder ZIP downloads, a server-rendered booth-sheet PDF, and in-app confirm/release for every upcoming assignment. Service reminders now ignore the one-off event reminder rule, which had been queueing an extra bogus reminder for each published service. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
Clock3,
|
||||
FileImage,
|
||||
Film,
|
||||
HardDrive,
|
||||
Image as ImageIcon,
|
||||
Play,
|
||||
} from "lucide-react";
|
||||
@@ -12,10 +13,8 @@ import type { SystemRole } from "@/auth/roles";
|
||||
import { listEventsForUser } from "@/db/events";
|
||||
import { listMediaPhotosForEvents } from "@/db/media";
|
||||
import { listEventVideosForEvents } from "@/db/videos";
|
||||
import {
|
||||
checkArchiveDestination,
|
||||
getStorageSettings,
|
||||
} from "@/db/storage-settings";
|
||||
import { getStorageSettings } from "@/db/storage-settings";
|
||||
import { mediaStorage } from "@/lib/media-storage";
|
||||
import { formatVideoDuration } from "@/lib/event-videos";
|
||||
import { isBrowserRenderablePhoto } from "@/lib/event-photos";
|
||||
import { mediaOrigin } from "@/lib/media-url";
|
||||
@@ -64,7 +63,19 @@ export default async function MediaPage() {
|
||||
listMediaPhotosForEvents(eventIds),
|
||||
getStorageSettings(),
|
||||
]);
|
||||
const archiveStatus = await checkArchiveDestination(storage);
|
||||
const archiveStatus = await mediaStorage();
|
||||
const archiveUsedBytes =
|
||||
archiveStatus.ok &&
|
||||
archiveStatus.totalBytes !== null &&
|
||||
archiveStatus.freeBytes !== null
|
||||
? Math.max(0, archiveStatus.totalBytes - archiveStatus.freeBytes)
|
||||
: null;
|
||||
const archiveUsedPercent =
|
||||
archiveUsedBytes !== null &&
|
||||
archiveStatus.ok &&
|
||||
archiveStatus.totalBytes
|
||||
? Math.min(100, Math.round((archiveUsedBytes / archiveStatus.totalBytes) * 100))
|
||||
: null;
|
||||
const canManage = hasPermission(role, "schedule.publish");
|
||||
const videoCards = videos.map((video) => videoView(video, origin));
|
||||
|
||||
@@ -79,6 +90,44 @@ export default async function MediaPage() {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{archiveStatus.ok && (
|
||||
<section className="space-y-2 rounded-lg border border-border bg-muted/30 p-3">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<p className="flex items-center gap-1.5 text-sm font-medium">
|
||||
<HardDrive className="h-4 w-4" aria-hidden="true" />
|
||||
Original media storage
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{archiveStatus.settings.nfsShare} ·{" "}
|
||||
{archiveStatus.settings.archiveFolder}
|
||||
</p>
|
||||
</div>
|
||||
{archiveUsedBytes !== null && archiveStatus.totalBytes !== null ? (
|
||||
<>
|
||||
<div
|
||||
className="h-2 overflow-hidden rounded-full bg-muted"
|
||||
role="img"
|
||||
aria-label={`Media storage ${archiveUsedPercent}% used`}
|
||||
>
|
||||
<div
|
||||
className="h-full bg-primary"
|
||||
style={{ width: `${archiveUsedPercent ?? 0}%` }}
|
||||
/>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{bytesLabel(archiveUsedBytes)} used of{" "}
|
||||
{bytesLabel(archiveStatus.totalBytes)} ·{" "}
|
||||
{bytesLabel(archiveStatus.freeBytes ?? 0)} free
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Free space could not be read from this filesystem.
|
||||
</p>
|
||||
)}
|
||||
</section>
|
||||
)}
|
||||
|
||||
<section className="space-y-3">
|
||||
<div className="flex flex-wrap items-end justify-between gap-2">
|
||||
<div>
|
||||
@@ -87,8 +136,8 @@ export default async function MediaPage() {
|
||||
Videos
|
||||
</h2>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Camera originals live on the NFS archive; playback uses a generated
|
||||
MP4.
|
||||
Camera originals are stored on the media storage share; playback
|
||||
uses a generated MP4.
|
||||
</p>
|
||||
</div>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
@@ -102,7 +151,7 @@ export default async function MediaPage() {
|
||||
title: event.title,
|
||||
}))}
|
||||
canManage={canManage}
|
||||
archiveReady={archiveStatus.ready}
|
||||
archiveReady={archiveStatus.ok}
|
||||
/>
|
||||
|
||||
{videoCards.length === 0 ? (
|
||||
|
||||
Reference in New Issue
Block a user