mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
fix: SSR branding — use NEXT_PUBLIC_APP_HOST for correct per-chain logo/favicon
- getHostname() reads NEXT_PUBLIC_APP_HOST via getEnvValue during SSR so each explorer instance shows its own branding from first paint - _document.tsx generates dynamic SVG favicon from chain branding
This commit is contained in:
@@ -216,11 +216,13 @@ export const NETWORKS: ReadonlyArray<NetworkEntry> = [
|
||||
},
|
||||
];
|
||||
|
||||
import { getEnvValue } from 'configs/app/utils';
|
||||
|
||||
function getHostname(): string {
|
||||
if (typeof window !== 'undefined') {
|
||||
return window.location.hostname;
|
||||
}
|
||||
return 'explore.lux.network';
|
||||
return getEnvValue('NEXT_PUBLIC_APP_HOST') || 'explore.lux.network';
|
||||
}
|
||||
|
||||
export function getCurrentChain(): ChainEntry {
|
||||
|
||||
+9
-6
@@ -6,6 +6,7 @@ import logRequestFromBot from 'nextjs/utils/logRequestFromBot';
|
||||
import * as serverTiming from 'nextjs/utils/serverTiming';
|
||||
|
||||
import config from 'configs/app';
|
||||
import { getCurrentChain } from 'configs/app/chainRegistry';
|
||||
import * as svgSprite from 'ui/shared/IconSvg';
|
||||
|
||||
const marketplaceFeature = config.features.marketplace;
|
||||
@@ -63,14 +64,16 @@ class MyDocument extends Document {
|
||||
</>
|
||||
) }
|
||||
|
||||
{ /* FAVICON */ }
|
||||
<link rel="icon" type="image/svg+xml" href="/assets/favicon/favicon.svg"/>
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon/favicon-16x16.png"/>
|
||||
{ /* FAVICON — dynamic per-chain SVG, static PNG fallbacks */ }
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/svg+xml"
|
||||
href={ `data:image/svg+xml,${ encodeURIComponent(
|
||||
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">${ getCurrentChain().branding.faviconContent }</svg>`,
|
||||
) }` }
|
||||
/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon/favicon-32x32.png"/>
|
||||
<link rel="icon" type="image/png" sizes="48x48" href="/assets/favicon/favicon-48x48.png"/>
|
||||
<link rel="shortcut icon" href="/assets/favicon/favicon.ico"/>
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/assets/favicon/apple-touch-icon-180x180.png"/>
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/assets/favicon/android-chrome-192x192.png"/>
|
||||
<link rel="preload" as="image" href={ svgSprite.href }/>
|
||||
</Head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user