Files
cobble/src/utils/name-pwa-manifest.ts
T
tbenandClaude Opus 5.5 3b7c05bfa0 Name each install, fix the notification badge, switch to Archivo
- Settings > General: an App name (super admin) for the installed app.
  The manifest's name/short_name, the iOS head tags and the loading
  page's title use it, so two installs on one phone can be told apart.
- Notifications get a real badge (white stone silhouette): Android masks
  the badge by alpha, so the opaque app icon showed as a square.
- The loading and offline pages load the app's font.
- The font is now Archivo (variable, one request for every weight),
  matching the marketing site.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 10:17:40 +01:00

28 lines
818 B
TypeScript

import { SiteData } from "@/src/data/site-data";
type Params = {
manifest: Record<string, unknown>;
install_name?: string | null;
};
/**
* The generated manifest with the install's own name, so the launcher
* tells two installs apart. `short_name` (the label under the icon) is the
* name alone; `name` adds `SiteName` unless the name already says it.
* Unnamed, the manifest is unchanged.
*/
export default function namePwaManifest({ manifest, install_name }: Params) {
const name = install_name?.trim();
if (!name) return manifest;
const site_name = SiteData["SiteName"];
const says_site_name = name.toLowerCase().includes(site_name.toLowerCase());
return {
...manifest,
name: says_site_name ? name : `${name} - ${site_name}`,
short_name: name,
};
}