Add Discovery Videos feature

Let users upload videos, tag them with one or more entries, and watch
them from a new Discovery Videos page.

Backend:
- Add Video and VideoEntry models and relations
- Add video controller and /video routes
- Add video thumbnail generation service (ffmpeg-static)
- Add video upload storage location and config

Frontend:
- Add DiscoveryVideosPage with sidebar link and route
- Add AddVideoDialog, VideoDropzone, EntryMultiSelect, VideoCard
  and VideoPlayerDialog components
- Add discoveryVideos API client and useDiscoveryVideos hook
- Add format helpers, video types and normalizers
- Add skeleton for the page

Docs:
- Document the feature in docs-vault
This commit is contained in:
X4Lo committed 2026-11-03 15:57:53 +00:00
1 parent 4d88747649
commit eb3a12f6cb
41 files changed
+2163 -15

No files matched your search

+14
View File
@@ -28,5 +28,19 @@ export const getMediaUrl = (
file: string,
) => `${API_BASE_URL}/media/${category}/${type}/${size}/${file}`;
export const getVideoStreamUrl = (id: number) => {
const token = useAuthStore.getState().token;
return `${API_BASE_URL}/discovery-videos/${id}/stream${
token ? `?token=${encodeURIComponent(token)}` : ''
}`;
};
export const getVideoThumbnailUrl = (id: number) => {
const token = useAuthStore.getState().token;
return `${API_BASE_URL}/discovery-videos/${id}/thumbnail${
token ? `?token=${encodeURIComponent(token)}` : ''
}`;
};
export const getTmdbImageUrl = (path: string, size = 'w342') =>
`https://image.tmdb.org/t/p/${size}${path}`;
+11
View File
@@ -0,0 +1,11 @@
export function formatBytes(bytes: number): string {
if (!bytes || bytes <= 0) return "0 B";
const units = ["B", "KB", "MB", "GB", "TB"];
let value = bytes;
let unit = 0;
while (value >= 1024 && unit < units.length - 1) {
value /= 1024;
unit += 1;
}
return `${value.toFixed(unit === 0 ? 0 : 1)} ${units[unit]}`;
}
+20 -1
View File
@@ -10,7 +10,7 @@
* - Genres come as string arrays from the backend mapper
*/
import type { Entry, Collection, Media, Credit, Genre } from "@/types";
import type { Entry, Collection, Media, Credit, Genre, DiscoveryVideo } from "@/types";
/* ---------- Media ---------- */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -87,6 +87,25 @@ export function normalizeEntry(raw: any): Entry {
};
}
/* ---------- Discovery Video ---------- */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function normalizeDiscoveryVideo(raw: any): DiscoveryVideo {
return {
id: raw.id,
title: raw.title,
description: raw.description ?? null,
filename: raw.filename,
original_name: raw.original_name ?? raw.originalName ?? "",
mime_type: raw.mime_type ?? raw.mimeType ?? "",
size: raw.size ?? 0,
duration: raw.duration ?? null,
thumbnail_path: raw.thumbnail_path ?? raw.thumbnailPath ?? null,
createdAt: raw.createdAt,
updatedAt: raw.updatedAt,
entries: raw.entries ? raw.entries.map(normalizeEntry) : undefined,
};
}
/* ---------- Collection ---------- */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function normalizeCollection(raw: any): Collection {