next.config.ts has trailingSlash: true, so Next.js 308-redirects /icon to
/icon/. The middleware matcher only excluded the no-slash form, so after
the redirect the auth gate kicked in and bounced /icon/ to /cm-auth — the
browser got an HTML page where it expected a PNG, and the manifest icon
failed to install ('Download error or resource isn't a valid image').
- middleware: matcher now allows the optional slash on icon and apple-icon.
- manifest: point icons at the canonical /icon/ and /apple-icon/ URLs so
the browser fetches the PNG directly without a redirect round-trip.
23 lines
780 B
TypeScript
23 lines
780 B
TypeScript
import type { MetadataRoute } from "next";
|
|
|
|
export default function manifest(): MetadataRoute.Manifest {
|
|
return {
|
|
name: "CM Bot V2",
|
|
short_name: "CM Bot",
|
|
description: "CM Bot account and user dashboard",
|
|
start_url: "/",
|
|
display: "standalone",
|
|
orientation: "portrait",
|
|
background_color: "#fafafa",
|
|
theme_color: "#18181b",
|
|
icons: [
|
|
// Trailing slash on /icon/ and /apple-icon/ matches the canonical URL
|
|
// Next.js serves under `trailingSlash: true`. Without the slash the
|
|
// browser would hit a 308 redirect, then the gated /icon/ path, then
|
|
// get HTML back instead of the PNG.
|
|
{ src: "/icon/", sizes: "any", type: "image/png" },
|
|
{ src: "/apple-icon/", sizes: "180x180", type: "image/png" },
|
|
],
|
|
};
|
|
}
|