Files
hobbs-iac/tv app/Hobbs-Family-Organizer-Self-Hosted-v1.0.0/app/api/photos/img/[dir]/[file]/route.ts
T
jeremy c2e5c1d9dc feat(hobbs-organizer): v1.2.0 photo frame (/photo) with Google Photos shared albums
- /photo full-screen slideshow (crossfade, blurred backdrop or fill, shuffle, date)
- admin Photos tab: add shared-album links (check, sync now, status/stale warnings),
  slideshow options, browser-resized uploads
- 6-hourly album sync scraping the share page (Library API no longer exposes
  user albums), caches 1920px + 64px copies in /data/photos
- /api/health/photos -> 503 when an album has not synced for 48h
- history/restore covers photo settings; min admin password length 6

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E9NnVEico3WvFxLyjy1iW3
2026-11-04 19:18:02 -06:00

18 lines
774 B
TypeScript

import { readFile } from "node:fs/promises";
import { photoFilePath, validPhotoDir, validPhotoFile } from "../../../../../_lib/photos";
export const dynamic = "force-dynamic";
export async function GET(_request: Request, { params }: { params: Promise<{ dir: string; file: string }> }) {
const { dir, file } = await params;
if (!validPhotoDir(dir) || !validPhotoFile(file)) return new Response("Not found", { status: 404 });
try {
const data = await readFile(photoFilePath(dir, file));
return new Response(new Uint8Array(data), {
headers: { "Content-Type": "image/jpeg", "Cache-Control": "public, max-age=31536000, immutable", "Content-Length": String(data.byteLength) },
});
} catch {
return new Response("Not found", { status: 404 });
}
}