From 49b20d1b8b13bdee5f46e65881015d0461a8330d Mon Sep 17 00:00:00 2001 From: mortezaei Date: Thu, 30 Jul 2026 16:11:06 +0330 Subject: [PATCH] chore: optimize asset caching, clean up dev UI components, update auth token retrieval, and externalize docker configurations --- next.config.ts | 11 +++++++++++ src/app/layout.tsx | 12 ++++++------ src/lib/http.ts | 6 ++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/next.config.ts b/next.config.ts index 1c1ba19..e74a59d 100644 --- a/next.config.ts +++ b/next.config.ts @@ -80,6 +80,17 @@ const nextConfig: NextConfig = { }, ], }, + { + // Images and icons are not content-hashed, so revalidate instead of + // pinning them for a year. + source: "/assets/:path*", + headers: [ + { + key: "Cache-Control", + value: "public, max-age=86400, stale-while-revalidate=604800", + }, + ], + }, ]; }, }; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index b0fe670..6c3f6b3 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -171,14 +171,14 @@ export default function RootLayout({ -
- -
+ {isDevelopment ? ( +
+ +
+ ) : null}
{children}
- {process.env.NODE_ENV === "development" ? ( - - ) : null} + {isDevelopment ? : null} ); diff --git a/src/lib/http.ts b/src/lib/http.ts index 1ae0a4e..2d4d483 100644 --- a/src/lib/http.ts +++ b/src/lib/http.ts @@ -64,7 +64,7 @@ export const http = axios.create({ withCredentials: true, }); -http.interceptors.request.use(async (config) => { +http.interceptors.request.use((config) => { if (shouldUseProxy() && config.url && !isAbsoluteUrl(config.url)) { config.params = withProxyPathParam(config.params, config.url); config.url = ""; @@ -84,10 +84,8 @@ http.interceptors.request.use(async (config) => { config.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"; config.headers["Pragma"] = "no-cache"; - // Wait for a pending Flutter token injection rather than firing the request - // unauthenticated (or, as before, with a hardcoded test token). const token = - (await authBridge.waitForToken()) ?? + authBridge.getToken() ?? getClientCookie("HABIB_TOKEN") ?? getClientCookie("habib_token");