c89010a4f1
Uniform stock management for healthcare linen rooms: the coordinator app, the phone counter and the staff app, for your own server. Built from f976bd5 on 2026-09-15. Licensed under the Functional Source License (FSL-1.1-ALv2).
16 lines
854 B
TypeScript
16 lines
854 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { currentUser } from "@/lib/session";
|
|
import { prisma } from "@/lib/db";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
/** Serves the signed-in user's facility logo (stored as a data URL). */
|
|
export async function GET() {
|
|
const user = await currentUser();
|
|
if (!user) return new NextResponse(null, { status: 401 });
|
|
const fac = await prisma.facility.findUnique({ where: { id: user.facilityId }, select: { logoData: true } });
|
|
const m = /^data:(image\/(?:png|jpeg|jpg|gif|webp));base64,([A-Za-z0-9+/=]+)$/.exec(fac?.logoData || "");
|
|
if (!m) return new NextResponse(null, { status: 404 });
|
|
return new NextResponse(Buffer.from(m[2], "base64"), { headers: { "content-type": m[1], "cache-control": "private, no-cache", "x-content-type-options": "nosniff", "content-security-policy": "sandbox" } });
|
|
}
|