Implement image management enhancements: add functionality to relocate legacy images during startup, update image handling in show metadata, and refactor related API endpoints to utilize the new image storage system. Adjust database schema to support image references and update UI components for improved image selection and display.

This commit is contained in:
Leonid Pershin
2026-07-25 11:43:17 +03:00
parent 149cd153b9
commit a970eae7d2
30 changed files with 1231 additions and 172 deletions
+5 -5
View File
@@ -7,7 +7,7 @@ import { cn } from '@/shared/lib/cn'
import { Badge } from '@/shared/ui/badge'
import { Button } from '@/shared/ui/button'
import { ChannelPlayer } from './ChannelPlayer'
import { episodeStillUrl, getEpg, listChannels, showPosterUrl, watchChannel } from './api'
import { episodeStillUrl, getEpg, imageUrl, listChannels, watchChannel } from './api'
function formatTime(iso: string) {
return new Date(iso).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
@@ -89,9 +89,9 @@ export function AirPage() {
selected === channel.slug && 'border-primary text-primary',
)}
>
{channel.currentShowHasPoster && channel.currentShowId ? (
{channel.currentShowPosterImageId ? (
<img
src={showPosterUrl(channel.currentShowId)}
src={imageUrl(channel.currentShowPosterImageId)}
alt=""
className="h-10 w-7 shrink-0 rounded object-cover"
/>
@@ -144,9 +144,9 @@ export function AirPage() {
alt=""
className="hidden h-24 w-40 shrink-0 rounded object-cover sm:block"
/>
) : currentEntry?.showHasPoster && current.showId ? (
) : currentEntry?.showPosterImageId ? (
<img
src={showPosterUrl(current.showId)}
src={imageUrl(currentEntry.showPosterImageId)}
alt=""
className="hidden h-24 w-16 shrink-0 rounded object-cover sm:block"
/>
+4 -3
View File
@@ -1,10 +1,11 @@
import { apiRequest } from '@/shared/api/client'
import type { PublicChannelDto, PublicEpgEntryDto } from '@/shared/api/types'
/** Ссылки на локальные постер шоу / кадр серии (публичные эндпоинты метаданных). */
export function showPosterUrl(showId: string) {
return `/api/metadata/shows/${showId}/poster`
/** Ссылка на изображение общего реестра (постеры) — по id из публичных DTO. */
export function imageUrl(imageId: string) {
return `/api/images/${imageId}`
}
/** Кадр серии (пока по-старому — публичный эндпоинт метаданных). */
export function episodeStillUrl(episodeId: string) {
return `/api/metadata/episodes/${episodeId}/still`
}