API Updates
Deploy / deploy (push) Successful in 3m3s

This commit is contained in:
twotalesanimation
2026-07-08 14:38:56 +02:00
parent d40ca8eb55
commit afcef02409
9 changed files with 399 additions and 4 deletions
+11 -4
View File
@@ -2,10 +2,17 @@ import { NextResponse } from "next/server";
import { auth } from "@/auth";
import { db } from "@/lib/db";
export async function GET() {
const session = await auth();
if (!session?.user) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
export async function GET(req: Request) {
// Accept either a logged-in session or the shared display API key
const displayKey = process.env.DISPLAY_API_KEY;
const providedKey = req.headers.get("x-display-key");
const isDisplayDevice = displayKey && providedKey === displayKey;
if (!isDisplayDevice) {
const session = await auth();
if (!session?.user) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
}
const [