feat: per-album hero image – picker from album assets, fullbleed banner on detail page

This commit is contained in:
ralksta
2026-05-30 15:33:43 +02:00
parent af5da8f316
commit 19c3727afc
9 changed files with 287 additions and 30 deletions

View File

@@ -102,6 +102,7 @@ export function getConfig(): AppConfig {
albumOverrides: {},
albumDescriptions: {},
albumPasswords: {},
albumHeroImages: {},
cacheTtl: env.CACHE_TTL * 1000,
rateLimitRpm: env.RATE_LIMIT_RPM,
trustedProxies: env.TRUSTED_PROXIES,
@@ -115,11 +116,12 @@ export function getConfig(): AppConfig {
const albumOverrides: Record<string, string> = {};
const albumDescriptions: Record<string, string> = {};
const albumPasswords: Record<string, string> = {};
const albumHeroImages: Record<string, string> = {};
function processAlbumEntry(
entry:
| string
| Record<string, string | { title: string; description?: string; password?: string }>,
| Record<string, string | { title: string; description?: string; password?: string; heroImage?: string }>,
context: string,
): string {
if (typeof entry === 'string') {
@@ -134,6 +136,7 @@ export function getConfig(): AppConfig {
if (value.title) albumOverrides[validatedUuid] = value.title;
if (value.description) albumDescriptions[validatedUuid] = value.description;
if (value.password) albumPasswords[validatedUuid] = value.password;
if (value.heroImage) albumHeroImages[validatedUuid] = value.heroImage;
}
return validatedUuid;
}
@@ -283,6 +286,7 @@ export function getConfig(): AppConfig {
albumOverrides,
albumDescriptions,
albumPasswords,
albumHeroImages,
cacheTtl: env.CACHE_TTL * 1000,
rateLimitRpm: env.RATE_LIMIT_RPM,
trustedProxies: env.TRUSTED_PROXIES,

View File

@@ -97,34 +97,34 @@ export interface AppConfig {
albumOverrides: Record<string, string>;
albumDescriptions: Record<string, string>;
albumPasswords: Record<string, string>;
albumHeroImages: Record<string, string>;
cacheTtl: number;
rateLimitRpm: number;
trustedProxies: string[];
needsSetup?: boolean;
}
export interface AlbumEntryObject {
title: string;
description?: string;
password?: string;
heroImage?: string;
}
export interface GalleryYaml {
hero?: string | string[];
albums?: Array<
string | Record<string, string | { title: string; description?: string; password?: string }>
>;
albums?: Array<string | Record<string, string | AlbumEntryObject>>;
subpages?:
| Record<string, string[] | Array<string | Record<string, string>>>
| Array<{
name: string;
title?: string;
subtitle?: string;
albums?: Array<
| string
| Record<string, string | { title: string; description?: string; password?: string }>
>;
albums?: Array<string | Record<string, string | AlbumEntryObject>>;
sections?: Array<{
title: string;
description?: string;
albums: Array<
| string
| Record<string, string | { title: string; description?: string; password?: string }>
>;
albums: Array<string | Record<string, string | AlbumEntryObject>>;
}>;
password?: string;
grid?: {