load fast
Build and Deploy Docker Images / build_and_deploy (push) Has been cancelled

This commit is contained in:
hamid zarghami
2026-06-06 09:08:38 +03:30
parent ace6a0b288
commit e68543f869
12 changed files with 255 additions and 248 deletions
+42 -29
View File
@@ -4,6 +4,46 @@ import { getRestaurant } from "../lib/getRestaurant";
export const dynamic = "force-dynamic";
export const revalidate = 0;
function buildManifestIcons(name: string, logo?: string | null) {
const default192 = "/icons/web-app-manifest-192x192.png";
const default512 = "/icons/web-app-manifest-512x512.png";
if (logo && logo.trim() !== "") {
const logo192 = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=192`;
const logo512 = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=512`;
return [
{
src: logo192,
sizes: "192x192",
type: "image/png",
purpose: "any",
},
{
src: logo512,
sizes: "512x512",
type: "image/png",
purpose: "any",
},
];
}
return [
{
src: default192,
sizes: "192x192",
type: "image/png",
purpose: "any",
},
{
src: default512,
sizes: "512x512",
type: "image/png",
purpose: "any",
},
];
}
export async function GET(
request: Request,
{ params }: { params: Promise<{ name: string }> }
@@ -13,21 +53,7 @@ export async function GET(
const restaurant = await getRestaurant(name);
const themeColor = restaurant.menuColor || "#F4F5F9";
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 icons = buildManifestIcons(name, restaurant.logo);
const manifest = {
name: restaurant.name,
@@ -75,20 +101,7 @@ export async function GET(
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",
},
],
icons: buildManifestIcons(name),
};
return NextResponse.json(manifest, {