Dashboard Verbessert

This commit is contained in:
Moritz Utcke
2024-02-27 00:13:31 +07:00
parent 1a60fbd345
commit 196accdb59
5 changed files with 55 additions and 16 deletions

View File

@@ -0,0 +1,26 @@
import { createCaller } from "#lib/caller";
import { APIRoute } from "astro";
export const get: APIRoute = async ({params, cookies}) => {
const { uid } = params;
if (!uid) {
return new Response("No uid provided", { status: 400 });
}
const caller = createCaller({ cookies })
const image = await caller.v1.bilder.getBase64({ uid })
if (!image) {
return new Response("No image found", { status: 404 });
}
const buffer = Buffer.from(image.base64, "base64");
return new Response(buffer, {
headers: {
"Content-Type": "image/webp"
}
});
}