Files
jeremy 6e94a0c998 feat(hobbs-organizer): v1.4.0 per-TV morning routine (admin TVs tab) + photo app 1.2.1
- Admin TVs tab: wake time/days, YouTube Music playlist, Shield volume per TV,
  pushed via 5-min TV check-ins (/api/tv/config, /api/tv/report, LAN-only)
- com.dayline.photos 1.2.1: MorningActivity (screen on, volume, playlist),
  calendar alarm at wake time, Doze-safe chained check-ins
- Both TVs configured for 06:30 daily with the family playlist

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

24 lines
1.1 KiB
TypeScript

import { clientIp, isAdminNetworkAllowed, json, readJsonBody } from "../../../_lib/auth";
import { readSettings, validTvId } from "../../../_lib/store";
import { recordTvCheckIn } from "../../../_lib/tvs";
export const dynamic = "force-dynamic";
type Report = { device?: string; kind?: string; ok?: boolean; detail?: string; applied?: string; app?: string };
/** The Shield photo app reports the outcome of its morning routine here (shown in admin). */
export async function POST(request: Request) {
if (!isAdminNetworkAllowed(request.headers)) return new Response("Not found", { status: 404 });
const body = await readJsonBody<Report>(request);
const id = validTvId(body?.device);
if (!body || !id) return json({ error: "Missing or invalid device id." }, 400);
const settings = await readSettings();
await recordTvCheckIn(
id,
{ appVersion: body.app, appliedVersion: body.applied, ip: clientIp(request.headers) },
{ kind: body.kind || "event", ok: body.ok === true, detail: body.detail || "" },
new Set(settings.tvs.map((tv) => tv.id)),
);
return json({ ok: true });
}