1
0
Fork 0
mirror of https://gitbruv.vercel.app/api/git/bruv/gitbruv.git synced 2025-12-20 23:24:09 +01:00
This commit is contained in:
Ahmet Kilinc 2025-12-20 12:07:05 +00:00
parent 4249f028aa
commit 468781e311
20 changed files with 84 additions and 185 deletions

View file

@ -2,4 +2,3 @@ import { auth } from "@/lib/auth";
import { toNextJsHandler } from "better-auth/next-js";
export const { POST, GET } = toNextJsHandler(auth);

View file

@ -1,22 +1,19 @@
import { NextRequest, NextResponse } from "next/server";
import { r2Get } from "@/lib/r2";
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ filename: string }> }
) {
export async function GET(request: NextRequest, { params }: { params: Promise<{ filename: string }> }) {
const { filename } = await params;
const key = `avatars/${filename}`;
const data = await r2Get(key);
if (!data) {
return new NextResponse(null, { status: 404 });
}
const ext = filename.split(".").pop()?.toLowerCase();
let contentType = "image/png";
if (ext === "jpg" || ext === "jpeg") {
contentType = "image/jpeg";
} else if (ext === "gif") {
@ -32,4 +29,3 @@ export async function GET(
},
});
}