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": [
{
"src": "/api/pwa-icon/192",
"src": "/icons/logo192.png",
"type": "image/png",
"sizes": "192x192",
"purpose": "any"
},
{
"src": "/api/pwa-icon/512",
"src": "/icons/logo512.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "any"
},
{
"src": "/api/pwa-icon/192",
"src": "/icons/logo192.png",
"type": "image/png",
"sizes": "192x192",
"purpose": "maskable"
},
{
"src": "/api/pwa-icon/512",
"src": "/icons/logo512.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
+5
View File
@@ -14,6 +14,10 @@ export async function GET(
request: NextRequest,
{ 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 {
await params;
@@ -91,4 +95,5 @@ export async function GET(
console.error("Error processing logo:", error);
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 {
const restaurant = await getRestaurant(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;
let icon192Url = defaultIcon;
let 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`;
}
const iconUrl = defaultIcon;
const icon192Url = defaultIcon;
const icon512Url = defaultIcon512;
return {
title,
+7 -6
View File
@@ -5,12 +5,13 @@ import { getRestaurant } from "../lib/getRestaurant";
export const dynamic = "force-dynamic";
export const revalidate = 0;
function buildManifestIcons(name: string, logo?: string | null) {
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 buildPwaManifestIcons(logo192, logo512);
}
function buildManifestIcons(_name: string, _logo?: string | null) {
// Restaurant logo disabled using static PWA icons (logo192.png / logo512.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 buildPwaManifestIcons(logo192, logo512);
// }
return buildPwaManifestIcons();
}
+7 -5
View File
@@ -47,11 +47,13 @@ export default function RestaurantHeadManager() {
upsertLink("manifest", `/${name}/manifest.webmanifest`);
const logo = restaurant.logo?.trim();
const iconUrl =
logo && logo !== ""
? `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=192`
: PWA_ICON_192;
// Restaurant logo disabled using static PWA icons (logo192.png / logo512.png)
// const logo = restaurant.logo?.trim();
// const iconUrl =
// logo && logo !== ""
// ? `/${name}/api/logo?url=${encodeURIComponent(logo)}&size=192`
// : PWA_ICON_192;
const iconUrl = PWA_ICON_192;
upsertLink("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_512 = '/api/pwa-icon/512';
export const PWA_ICON_192 = '/icons/logo192.png';
export const PWA_ICON_512 = '/icons/logo512.png';
export function buildPwaManifestIcons(logo192?: string, logo512?: string) {
const icon192 = logo192 ?? PWA_ICON_192;