pwa icon
Build and Deploy Docker Images / build_and_deploy (push) Has been cancelled

This commit is contained in:
hamid zarghami
2026-06-06 14:42:18 +03:30
parent 1ce80f551c
commit c9d152fbaf
8 changed files with 35 additions and 27 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+4 -4
View File
@@ -23,25 +23,25 @@
}, },
"icons": [ "icons": [
{ {
"src": "/api/pwa-icon/192", "src": "/icons/logo192.png",
"type": "image/png", "type": "image/png",
"sizes": "192x192", "sizes": "192x192",
"purpose": "any" "purpose": "any"
}, },
{ {
"src": "/api/pwa-icon/512", "src": "/icons/logo512.png",
"type": "image/png", "type": "image/png",
"sizes": "512x512", "sizes": "512x512",
"purpose": "any" "purpose": "any"
}, },
{ {
"src": "/api/pwa-icon/192", "src": "/icons/logo192.png",
"type": "image/png", "type": "image/png",
"sizes": "192x192", "sizes": "192x192",
"purpose": "maskable" "purpose": "maskable"
}, },
{ {
"src": "/api/pwa-icon/512", "src": "/icons/logo512.png",
"type": "image/png", "type": "image/png",
"sizes": "512x512", "sizes": "512x512",
"purpose": "maskable" "purpose": "maskable"
+5
View File
@@ -14,6 +14,10 @@ export async function GET(
request: NextRequest, request: NextRequest,
{ params }: { params: Promise<{ name: string }> }, { params }: { params: Promise<{ name: string }> },
) { ) {
// Restaurant logo processing disabled redirect to static PWA icon
return NextResponse.redirect(new URL(PWA_ICON_192, request.url), 302);
/* Restaurant logo processing uncomment to re-enable dynamic PWA icons
try { try {
await params; await params;
@@ -91,4 +95,5 @@ export async function GET(
console.error("Error processing logo:", error); console.error("Error processing logo:", error);
return NextResponse.redirect(new URL(DEFAULT_ICON, request.url), 302); return NextResponse.redirect(new URL(DEFAULT_ICON, request.url), 302);
} }
*/
} }
+10 -10
View File
@@ -9,17 +9,17 @@ export async function buildRestaurantMetadata(name: string): Promise<Metadata> {
try { try {
const restaurant = await getRestaurant(name); const restaurant = await getRestaurant(name);
const title = restaurant.seoTitle || restaurant.name; const title = restaurant.seoTitle || restaurant.name;
const logo = restaurant.logo; // Restaurant logo disabled using static PWA icons (logo192.png / logo512.png)
// const logo = restaurant.logo;
// if (logo && logo.trim() !== "") {
// iconUrl = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=192`;
// icon192Url = iconUrl;
// icon512Url = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=512`;
// }
let iconUrl = defaultIcon; const iconUrl = defaultIcon;
let icon192Url = defaultIcon; const icon192Url = defaultIcon;
let icon512Url = defaultIcon512; const icon512Url = defaultIcon512;
if (logo && logo.trim() !== "") {
iconUrl = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=192`;
icon192Url = iconUrl;
icon512Url = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=512`;
}
return { return {
title, title,
+7 -6
View File
@@ -5,12 +5,13 @@ import { getRestaurant } from "../lib/getRestaurant";
export const dynamic = "force-dynamic"; export const dynamic = "force-dynamic";
export const revalidate = 0; export const revalidate = 0;
function buildManifestIcons(name: string, logo?: string | null) { function buildManifestIcons(_name: string, _logo?: string | null) {
if (logo && logo.trim() !== "") { // Restaurant logo disabled using static PWA icons (logo192.png / logo512.png)
const logo192 = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=192`; // if (logo && logo.trim() !== "") {
const logo512 = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=512`; // const logo192 = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=192`;
return buildPwaManifestIcons(logo192, logo512); // const logo512 = `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=512`;
} // return buildPwaManifestIcons(logo192, logo512);
// }
return buildPwaManifestIcons(); return buildPwaManifestIcons();
} }
+7 -5
View File
@@ -47,11 +47,13 @@ export default function RestaurantHeadManager() {
upsertLink("manifest", `/${name}/manifest.webmanifest`); upsertLink("manifest", `/${name}/manifest.webmanifest`);
const logo = restaurant.logo?.trim(); // Restaurant logo disabled using static PWA icons (logo192.png / logo512.png)
const iconUrl = // const logo = restaurant.logo?.trim();
logo && logo !== "" // const iconUrl =
? `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=192` // logo && logo !== ""
: PWA_ICON_192; // ? `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=192`
// : PWA_ICON_192;
const iconUrl = PWA_ICON_192;
upsertLink("icon", iconUrl); upsertLink("icon", iconUrl);
upsertLink("apple-touch-icon", iconUrl); upsertLink("apple-touch-icon", iconUrl);
+2 -2
View File
@@ -1,5 +1,5 @@
export const PWA_ICON_192 = '/api/pwa-icon/192'; export const PWA_ICON_192 = '/icons/logo192.png';
export const PWA_ICON_512 = '/api/pwa-icon/512'; export const PWA_ICON_512 = '/icons/logo512.png';
export function buildPwaManifestIcons(logo192?: string, logo512?: string) { export function buildPwaManifestIcons(logo192?: string, logo512?: string) {
const icon192 = logo192 ?? PWA_ICON_192; const icon192 = logo192 ?? PWA_ICON_192;