This commit is contained in:
@@ -13,44 +13,21 @@ export async function GET(
|
||||
const restaurant = await getRestaurant(name);
|
||||
|
||||
const themeColor = restaurant.menuColor || "#F4F5F9";
|
||||
const logo = restaurant.logo;
|
||||
|
||||
const icons = [];
|
||||
if (logo && logo.trim() !== "") {
|
||||
// استفاده از API route برای تبدیل لوگو به مربع
|
||||
const logo192Url = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=192`;
|
||||
const logo512Url = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=512`;
|
||||
|
||||
icons.push(
|
||||
{
|
||||
src: logo192Url,
|
||||
sizes: "192x192",
|
||||
type: "image/png",
|
||||
purpose: "any",
|
||||
},
|
||||
{
|
||||
src: logo512Url,
|
||||
sizes: "512x512",
|
||||
type: "image/png",
|
||||
purpose: "any",
|
||||
}
|
||||
);
|
||||
} else {
|
||||
icons.push(
|
||||
{
|
||||
src: "/icons/web-app-manifest-192x192.png",
|
||||
sizes: "192x192",
|
||||
type: "image/png",
|
||||
purpose: "any",
|
||||
},
|
||||
{
|
||||
src: "/icons/web-app-manifest-512x512.png",
|
||||
sizes: "512x512",
|
||||
type: "image/png",
|
||||
purpose: "any",
|
||||
}
|
||||
);
|
||||
}
|
||||
const icons = [
|
||||
{
|
||||
src: "/icons/web-app-manifest-192x192.png",
|
||||
sizes: "192x192",
|
||||
type: "image/png",
|
||||
purpose: "any",
|
||||
},
|
||||
{
|
||||
src: "/icons/web-app-manifest-512x512.png",
|
||||
sizes: "512x512",
|
||||
type: "image/png",
|
||||
purpose: "any",
|
||||
},
|
||||
];
|
||||
|
||||
const manifest = {
|
||||
name: restaurant.name,
|
||||
@@ -83,6 +60,45 @@ export async function GET(
|
||||
return new NextResponse("Restaurant not found", { status: 404 });
|
||||
}
|
||||
|
||||
return new NextResponse("Internal Server Error", { status: 500 });
|
||||
const { name } = await params;
|
||||
const manifest = {
|
||||
name,
|
||||
short_name: name,
|
||||
description: `منوی ${name}`,
|
||||
start_url: `/${name}`,
|
||||
scope: `/${name}`,
|
||||
id: `/${name}`,
|
||||
display: "standalone",
|
||||
display_override: ["fullscreen", "minimal-ui", "browser"],
|
||||
background_color: "#F4F5F9",
|
||||
theme_color: "#F4F5F9",
|
||||
orientation: "portrait",
|
||||
dir: "rtl",
|
||||
lang: "fa-IR",
|
||||
icons: [
|
||||
{
|
||||
src: "/icons/web-app-manifest-192x192.png",
|
||||
sizes: "192x192",
|
||||
type: "image/png",
|
||||
purpose: "any",
|
||||
},
|
||||
{
|
||||
src: "/icons/web-app-manifest-512x512.png",
|
||||
sizes: "512x512",
|
||||
type: "image/png",
|
||||
purpose: "any",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
return NextResponse.json(manifest, {
|
||||
headers: {
|
||||
"Content-Type": "application/manifest+json",
|
||||
"Cache-Control":
|
||||
"no-store, no-cache, must-revalidate, proxy-revalidate",
|
||||
Pragma: "no-cache",
|
||||
Expires: "0",
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user