fix build for liara
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import sharp from "sharp";
|
||||
|
||||
@@ -6,10 +7,12 @@ export const revalidate = 0;
|
||||
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
{ params }: { params: Promise<{ name: string }> }
|
||||
{ params }: { params: Promise<{ name: string }> },
|
||||
) {
|
||||
try {
|
||||
const { name } = await params;
|
||||
console.log("name", name);
|
||||
|
||||
const searchParams = request.nextUrl.searchParams;
|
||||
const logoUrl = searchParams.get("url");
|
||||
const size = parseInt(searchParams.get("size") || "192");
|
||||
@@ -40,8 +43,9 @@ export async function GET(
|
||||
fit: "contain",
|
||||
background: { r: 0, g: 0, b: 0, alpha: 0 },
|
||||
});
|
||||
const outputBuffer = await processedImage.png().toBuffer();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const outputBuffer: any = await processedImage.png().toBuffer();
|
||||
|
||||
return new NextResponse(outputBuffer, {
|
||||
headers: {
|
||||
"Content-Type": "image/png",
|
||||
@@ -76,13 +80,12 @@ export async function GET(
|
||||
});
|
||||
|
||||
// تبدیل به PNG و برگرداندن
|
||||
const outputBuffer = await processedImage.png().toBuffer();
|
||||
const outputBuffer: any = await processedImage.png().toBuffer();
|
||||
|
||||
return new NextResponse(outputBuffer, {
|
||||
headers: {
|
||||
"Content-Type": "image/png",
|
||||
"Cache-Control":
|
||||
"public, max-age=31536000, immutable",
|
||||
"Cache-Control": "public, max-age=31536000, immutable",
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -90,4 +93,3 @@ export async function GET(
|
||||
return new NextResponse("Internal Server Error", { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user