diff --git a/src/server.ts b/src/server.ts index 15528c3cc..0db53d4db 100644 --- a/src/server.ts +++ b/src/server.ts @@ -112,6 +112,14 @@ const serve = async () => { attachAnkifySessionProxy(app, server, ankifySessionValidate); app.use('/templates', express.static(templateDir)); + // Hashed Vite output under /assets/* is content-addressed and immutable. + app.use( + '/assets', + express.static(`${BUILD_DIR}/assets`, { + immutable: true, + maxAge: '1y', + }) + ); app.use(express.static(BUILD_DIR)); // API Documentation diff --git a/web/index.html b/web/index.html index e2dfd02e3..297f1b8c9 100644 --- a/web/index.html +++ b/web/index.html @@ -103,20 +103,22 @@ } } - + @@ -135,30 +137,33 @@ - - + + - - + diff --git a/web/src/components/NavigationBar/NavigationBar.tsx b/web/src/components/NavigationBar/NavigationBar.tsx index 30d592e67..1eb72f7b5 100644 --- a/web/src/components/NavigationBar/NavigationBar.tsx +++ b/web/src/components/NavigationBar/NavigationBar.tsx @@ -12,7 +12,9 @@ function NavigationBar({ isLoggedIn }: Readonly) { const [active, setActive] = useState(false); const path = globalThis.location.pathname; const theme = useTheme(); - const logoSrc = theme === 'light' ? '/mascot/navbar-logo.png' : '/mascot/Notion 1.png'; + const isLight = theme === 'light'; + const logoSrc = isLight ? '/mascot/navbar-logo.png' : '/mascot/Notion 1.png'; + const logoWidth = isLight ? 103 : 33; const isResolved = isLoggedIn !== undefined; @@ -20,7 +22,13 @@ function NavigationBar({ isLoggedIn }: Readonly) {