- Remove .prettierrc (dead config, Biome replaces Prettier) - Rename lighthouserc.json to lighthouserc.cjs with module.exports for ESM compat - Add logger.warn to empty catch blocks in auth, register, site-settings, prisma-cache, redis, security, rate-limit - Unify ActionResult type: action-helper.ts uses 'ok' consistent with safe-action-shared.ts - Add noUnusedLocals + noUnusedParameters to tsconfig + fix 25 pre-existing unused vars - Replace barrel export src/types/index.ts with direct @/types/common imports - Make trustHost conditional (development only) in auth.ts - Add pre-flight URL validation to update-Nitrov3.sh to catch image.library.url misconfigurations - Improve NITRO_IMAGE_LIBRARY_URL content validation in pre-flight & post-compute checks
28 lines
964 B
TypeScript
28 lines
964 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";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
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 });
|
|
}
|
|
}
|