diff --git a/next.config.mjs b/next.config.mjs index cf73096cff5f..64529518ce59 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -65,6 +65,83 @@ const nextConfig = { return config; }, + + async headers() { + return [ + { + source: '/icons/(.*).(png|jpe?g|gif|svg|ico|webp)', + headers: [ + { + key: 'Cache-Control', + value: 'public, max-age=31536000, immutable', + }, + ], + }, + { + source: '/images/(.*).(png|jpe?g|gif|svg|ico|webp)', + headers: [ + { + key: 'Cache-Control', + value: 'public, max-age=31536000, immutable', + }, + ], + }, + { + source: '/videos/(.*).(mp4|webm|ogg|avi|mov|wmv|flv|mkv)', + headers: [ + { + key: 'Cache-Control', + value: 'public, max-age=31536000, immutable', + }, + ], + }, + { + source: '/screenshots/(.*).(png|jpe?g|gif|svg|ico|webp)', + headers: [ + { + key: 'Cache-Control', + value: 'public, max-age=31536000, immutable', + }, + ], + }, + { + source: '/og/(.*).(png|jpe?g|gif|svg|ico|webp)', + headers: [ + { + key: 'Cache-Control', + value: 'public, max-age=31536000, immutable', + }, + ], + }, + { + source: '/favicon.ico', + headers: [ + { + key: 'Cache-Control', + value: 'public, max-age=31536000, immutable', + }, + ], + }, + { + source: '/favicon-32x32.ico', + headers: [ + { + key: 'Cache-Control', + value: 'public, max-age=31536000, immutable', + }, + ], + }, + { + source: '/apple-touch-icon.png', + headers: [ + { + key: 'Cache-Control', + value: 'public, max-age=31536000, immutable', + }, + ], + }, + ]; + }, }; const noWrapper = (config) => config; @@ -126,4 +203,4 @@ const withSentry = ) : noWrapper; -export default withBundleAnalyzer(withPWA(withSentry(nextConfig))); +export default withBundleAnalyzer(withPWA(withSentry(nextConfig))); \ No newline at end of file diff --git a/package.json b/package.json index aedcd304329b..010418b8f733 100644 --- a/package.json +++ b/package.json @@ -107,9 +107,9 @@ "@khmyznikov/pwa-install": "^0.3.9", "@lobehub/chat-plugin-sdk": "^1.32.3", "@lobehub/chat-plugins-gateway": "^1.9.0", - "@lobehub/icons": "^1.22.1", + "@lobehub/icons": "^1.23.0", "@lobehub/tts": "^1.24.1", - "@lobehub/ui": "^1.141.2", + "@lobehub/ui": "^1.142.4", "@microsoft/fetch-event-source": "^2.0.1", "@neondatabase/serverless": "^0.9.3", "@next/third-parties": "^14.2.3", diff --git a/public/manifest.json b/public/manifest.json index ebb5e301be49..0fca79133299 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,5 +1,6 @@ { "background_color": "#000000", + "cache_busting_mode": "all", "categories": ["productivity", "design", "development", "education"], "description": "Personal LLM productivity tool, brings you the best user experience of ChatGPT, OLLaMA, Gemini, Claude WebUI. Customize AI assistant features flexibly according to personalized needs to solve problems, enhance productivity, and explore future workflow in LobeChat.", "display": "standalone", @@ -10,34 +11,48 @@ "handle_links": "auto", "icons": [ { - "src": "/icons/icon-192x192.png", + "src": "/icons/icon-192x192.png?v=1", "sizes": "192x192", "type": "image/png", - "purpose": "any" + "purpose": "any", + "cache_busting_mode": "query", + "max_age": 31536000, + "immutable": "true" }, { - "src": "/icons/icon-192x192.maskable.png", + "src": "/icons/icon-192x192.maskable.png?v=1", "sizes": "192x192", "type": "image/png", - "purpose": "maskable" + "purpose": "maskable", + "cache_busting_mode": "query", + "max_age": 31536000, + "immutable": "true" }, { - "src": "/icons/icon-512x512.png", + "src": "/icons/icon-512x512.png?v=1", "sizes": "512x512", "type": "image/png", - "purpose": "any" + "purpose": "any", + "cache_busting_mode": "query", + "max_age": 31536000, + "immutable": "true" }, { - "src": "/icons/icon-512x512.maskable.png", + "src": "/icons/icon-512x512.maskable.png?v=1", "sizes": "512x512", "type": "image/png", - "purpose": "maskable" + "purpose": "maskable", + "cache_busting_mode": "query", + "max_age": 31536000, + "immutable": "true" } ], "id": "lobe-chat", + "immutable": "true", "launch_handler": { "client_mode": ["navigate-existing", "auto"] }, + "max_age": 31536000, "name": "LobeChat", "orientation": "portrait", "related_applications": [ @@ -49,64 +64,94 @@ "scope": "/", "screenshots": [ { - "src": "/screenshots/shot-1.mobile.png", + "src": "/screenshots/shot-1.mobile.png?v=1", "sizes": "640x1138", "type": "image/png", - "form_factor": "narrow" + "form_factor": "narrow", + "cache_busting_mode": "query", + "max_age": 31536000, + "immutable": "true" }, { - "src": "/screenshots/shot-2.mobile.png", + "src": "/screenshots/shot-2.mobile.png?v=1", "sizes": "640x1138", "type": "image/png", - "form_factor": "narrow" + "form_factor": "narrow", + "cache_busting_mode": "query", + "max_age": 31536000, + "immutable": "true" }, { - "src": "/screenshots/shot-3.mobile.png", + "src": "/screenshots/shot-3.mobile.png?v=1", "sizes": "640x1138", "type": "image/png", - "form_factor": "narrow" + "form_factor": "narrow", + "cache_busting_mode": "query", + "max_age": 31536000, + "immutable": "true" }, { - "src": "/screenshots/shot-4.mobile.png", + "src": "/screenshots/shot-4.mobile.png?v=1", "sizes": "640x1138", "type": "image/png", - "form_factor": "narrow" + "form_factor": "narrow", + "cache_busting_mode": "query", + "max_age": 31536000, + "immutable": "true" }, { - "src": "/screenshots/shot-5.mobile.png", + "src": "/screenshots/shot-5.mobile.png?v=1", "sizes": "640x1138", "type": "image/png", - "form_factor": "narrow" + "form_factor": "narrow", + "cache_busting_mode": "query", + "max_age": 31536000, + "immutable": "true" }, { - "src": "/screenshots/shot-1.desktop.png", + "src": "/screenshots/shot-1.desktop.png?v=1", "sizes": "1280x676", "type": "image/png", - "form_factor": "wide" + "form_factor": "wide", + "cache_busting_mode": "query", + "max_age": 31536000, + "immutable": "true" }, { - "src": "/screenshots/shot-2.desktop.png", + "src": "/screenshots/shot-2.desktop.png?v=1", "sizes": "1280x676", "type": "image/png", - "form_factor": "wide" + "form_factor": "wide", + "cache_busting_mode": "query", + "max_age": 31536000, + "immutable": "true" }, { - "src": "/screenshots/shot-3.desktop.png", + "src": "/screenshots/shot-3.desktop.png?v=1", "sizes": "1280x676", "type": "image/png", - "form_factor": "wide" + "form_factor": "wide", + "cache_busting_mode": "query", + "max_age": 31536000, + "immutable": "true" }, { - "src": "/screenshots/shot-4.desktop.png", + "src": "/screenshots/shot-4.desktop.png?v=1", "sizes": "1280x676", "type": "image/png", - "form_factor": "wide" + "form_factor": "wide", + "cache_busting_mode": "query", + "max_age": 31536000, + "immutable": "true" }, { - "src": "/screenshots/shot-5.desktop.png", + "src": "/screenshots/shot-5.desktop.png?v=1", "sizes": "1280x676", "type": "image/png", - "form_factor": "wide" + "form_factor": "wide", + "cache_busting_mode": "query", + "max_age": 31536000, + "immutable": "true" } ], "short_name": "LobeChat", diff --git a/src/app/metadata.ts b/src/app/metadata.ts index f6498413dd80..9604d6361bd4 100644 --- a/src/app/metadata.ts +++ b/src/app/metadata.ts @@ -21,9 +21,9 @@ export const generateMetadata = async (): Promise => { }, description: t('chat.description'), icons: { - apple: '/apple-touch-icon.png', - icon: '/favicon.ico', - shortcut: '/favicon-32x32.ico', + apple: '/apple-touch-icon.png?v=1', + icon: '/favicon.ico?v=1', + shortcut: '/favicon-32x32.ico?v=1', }, manifest: noManifest ? undefined : '/manifest.json', metadataBase: new URL(SITE_URL), @@ -33,7 +33,7 @@ export const generateMetadata = async (): Promise => { { alt: t('chat.title'), height: 640, - url: '/og/cover.png', + url: '/og/cover.png?v=1', width: 1200, }, ], @@ -50,7 +50,7 @@ export const generateMetadata = async (): Promise => { twitter: { card: 'summary_large_image', description: t('chat.description'), - images: ['/og/cover.png'], + images: ['/og/cover.png?v=1'], site: '@lobehub', title: t('chat.title'), }, diff --git a/src/features/Setting/Footer.tsx b/src/features/Setting/Footer.tsx index d2aff6991b84..feedb30a318a 100644 --- a/src/features/Setting/Footer.tsx +++ b/src/features/Setting/Footer.tsx @@ -65,7 +65,7 @@ const Footer = memo(() => { } + cover={} desc={t('footer.star.desc')} okText={t('footer.star.action')} onCancel={() => setOpenStar(false)} @@ -78,7 +78,7 @@ const Footer = memo(() => { /> } + cover={} desc={t('footer.feedback.desc')} okText={t('footer.feedback.action')} onCancel={() => setOpenFeedback(false)} diff --git a/src/server/metadata.ts b/src/server/metadata.ts index e203ab2fec3a..3008c2b12060 100644 --- a/src/server/metadata.ts +++ b/src/server/metadata.ts @@ -7,7 +7,7 @@ export class Meta { public generate({ description = 'LobeChat offers you the best ChatGPT, OLLaMA, Gemini, Claude WebUI user experience', title, - image = '/og/cover.png', + image = '/og/cover.png?v=1', url, type = 'website', tags,