@@ -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 [
|
||||
|
||||
Reference in New Issue
Block a user