Files
appco_dist/.output/server/chunks/routes/manifest.webmanifest.get.mjs
T
2026-02-01 21:53:26 +03:30

53 lines
1.6 KiB
JavaScript

import { d as defineEventHandler, b as getRequestHost, a as getCachedConfig, c as setResponseHeader } from '../nitro/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'node:crypto';
import 'vue';
import 'node:url';
import 'consola';
import 'fast-xml-parser';
import 'ipx';
const manifest_webmanifest_get = defineEventHandler(async (event) => {
const host = getRequestHost(event);
const config = await getCachedConfig(host);
const name = (config == null ? void 0 : config.appNameEn) || "App Name";
const shortName = (config == null ? void 0 : config.appNameEn) || "App";
const description = (config == null ? void 0 : config.description) || "Best Shopping App";
const iconSrc = (config == null ? void 0 : config.storageLogo) ? `${config.storageLogo}/pwa-icon-192.png` : "/pwa-icon-192.png";
const manifest = {
name,
short_name: shortName,
description,
id: "/",
start_url: "/",
display: "standalone",
orientation: "portrait-primary",
background_color: "#ffffff",
theme_color: "#ffffff",
icons: [
{
src: iconSrc,
sizes: "192x192",
type: "image/png",
purpose: "any maskable"
},
{
// اینجا فرض میکنیم فایل 512 هم کنار 192 هست
src: iconSrc.replace("192", "512"),
sizes: "512x512",
type: "image/png",
purpose: "any maskable"
}
]
};
setResponseHeader(event, "Content-Type", "application/manifest+json");
return manifest;
});
export { manifest_webmanifest_get as default };