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
This commit is contained in:
2026-11-04 19:18:02 -06:00
parent 8715589cbb
commit c2e5c1d9dc
24 changed files with 1215 additions and 27 deletions
@@ -0,0 +1,27 @@
import { json, readJsonBody, requireAdmin } from "../../../../_lib/auth";
import { MAX_PHOTOS_PER_ALBUM, scrapeAlbum } from "../../../../_lib/photos";
import { validAlbumUrl } from "../../../../_lib/store";
export const dynamic = "force-dynamic";
/** Reads a share link without saving it: album title and how many photos/videos it has. */
export async function POST(request: Request) {
const denied = await requireAdmin(request, { mutating: true });
if (denied) return denied;
const body = await readJsonBody<{ shareUrl?: string }>(request);
const shareUrl = validAlbumUrl(body?.shareUrl);
if (!shareUrl) return json({ ok: false, error: "Not a Google Photos share link." }, 400);
try {
const album = await scrapeAlbum(shareUrl);
const videos = album.items.filter((item) => item.video).length;
return json({
ok: true,
title: album.title,
photos: album.items.length - videos,
videos,
truncated: album.hasMorePages || album.items.length - videos > MAX_PHOTOS_PER_ALBUM,
});
} catch (error) {
return json({ ok: false, error: error instanceof Error ? error.message : "Could not read the album." });
}
}