Files
EpicNext-Cms/src/app/api/radio/auto-play/route.ts
T
openhands dc8fb8a6ed feat: speed up admin clone import and enable Cache Components
- Clone import: defer FurnitureData.json writes and append all entries in a
  single batched write instead of one read-modify-write per item, removing
  the main serialization bottleneck for large batches.
- Clone import: raise SSE batch concurrency cap from 5 to 10 and bump the
  clone client/route default from 2 to 6.
- Add a flush hook to runSseBatch so callers can batch deferred work before
  batch_complete is emitted, and surface flush errors as an error event.
- Enable Next.js Cache Components (instant: false opt-out) and silence the
  related build warnings in next.config.ts.
- Switch isomorphic-dompurify to dompurify and refresh dependencies.
2026-08-05 11:10:16 +02:00

26 lines
923 B
TypeScript

// Public REST: whether the radio player should auto-play on load. Reads the
// radio_auto_play website setting (the key the admin radio settings page
// writes), falling back to the legacy radio_autoplay alias if present. Booleans
// are stored as the strings '1' / '0'. Returns { autoplay: boolean }.
import { apiJson } from "@/lib/api";
import { siteSettings } from "@/lib/services/site-settings";
function truthy(value: string | null | undefined): boolean {
if (value === undefined || value === null) return false;
const s = value.trim().toLowerCase();
return s === "1" || s === "true";
}
export async function GET(_req: Request) {
try {
const values = await siteSettings.getMany([
"radio_auto_play",
"radio_autoplay",
]);
const autoplay = truthy(values.radio_auto_play ?? values.radio_autoplay);
return apiJson({ autoplay });
} catch {
return apiJson({ autoplay: false }, { status: 200 });
}
}