fix favicon delivery and cache invalidation
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
import { buildFallbackIconResponse, getDynamicSiteIconUrls } from "@/lib/site-icons";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const revalidate = 0;
|
||||
|
||||
export async function GET() {
|
||||
const iconUrls = await getDynamicSiteIconUrls();
|
||||
|
||||
if (iconUrls.faviconAssetUrl) {
|
||||
const response = NextResponse.redirect(iconUrls.faviconAssetUrl, 307);
|
||||
|
||||
response.headers.set("Cache-Control", "no-store, max-age=0");
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
return buildFallbackIconResponse(iconUrls.siteName, 180);
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB |
@@ -0,0 +1,20 @@
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
import { buildFallbackIconResponse, getDynamicSiteIconUrls } from "@/lib/site-icons";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const revalidate = 0;
|
||||
|
||||
export async function GET() {
|
||||
const iconUrls = await getDynamicSiteIconUrls();
|
||||
|
||||
if (iconUrls.faviconAssetUrl) {
|
||||
const response = NextResponse.redirect(iconUrls.faviconAssetUrl, 307);
|
||||
|
||||
response.headers.set("Cache-Control", "no-store, max-age=0");
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
return buildFallbackIconResponse(iconUrls.siteName, 32);
|
||||
}
|
||||
@@ -1,11 +1,17 @@
|
||||
import type { Metadata } from "next";
|
||||
import { unstable_noStore as noStore } from "next/cache";
|
||||
import { getLocale } from "next-intl/server";
|
||||
import { ThemeProvider } from "@/components/theme-provider";
|
||||
import { buildAppMetadata } from "@/lib/metadata";
|
||||
import { getDirection } from "@/lib/locale";
|
||||
import "./globals.css";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const revalidate = 0;
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
noStore();
|
||||
|
||||
return buildAppMetadata();
|
||||
}
|
||||
|
||||
@@ -14,6 +20,8 @@ export default async function RootLayout({
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
noStore();
|
||||
|
||||
const locale = await getLocale().catch(() => "de");
|
||||
|
||||
return (
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { MetadataRoute } from "next";
|
||||
|
||||
import { getDynamicSiteIconUrls } from "@/lib/site-icons";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const revalidate = 0;
|
||||
|
||||
export default async function manifest(): Promise<MetadataRoute.Manifest> {
|
||||
const iconUrls = await getDynamicSiteIconUrls();
|
||||
|
||||
return {
|
||||
name: iconUrls.siteName,
|
||||
short_name: iconUrls.siteName,
|
||||
icons: [
|
||||
{
|
||||
src: iconUrls.appleIconHref,
|
||||
sizes: "180x180",
|
||||
type: "image/png",
|
||||
},
|
||||
{
|
||||
src: iconUrls.faviconHref,
|
||||
sizes: "32x32",
|
||||
type: "image/x-icon",
|
||||
},
|
||||
],
|
||||
display: "standalone",
|
||||
background_color: "#ffffff",
|
||||
theme_color: "#111827",
|
||||
};
|
||||
}
|
||||
@@ -13,6 +13,7 @@ type MediaFileRouteProps = {
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
const CONTENT_TYPES: Record<string, string> = {
|
||||
".ico": "image/x-icon",
|
||||
".jpg": "image/jpeg",
|
||||
".jpeg": "image/jpeg",
|
||||
".png": "image/png",
|
||||
|
||||
Reference in New Issue
Block a user