mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 21:57:16 +01:00
Made FAVICON_URL a runtime variable. Closes #3412
This commit is contained in:
parent
038d3d6000
commit
6e6c1df858
2 changed files with 5 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { useConfig } from '@/components/hooks';
|
||||
import { FAVICON_URL, GROUPED_DOMAINS } from '@/lib/constants';
|
||||
|
||||
function getHostName(url: string) {
|
||||
|
|
@ -6,11 +7,13 @@ function getHostName(url: string) {
|
|||
}
|
||||
|
||||
export function Favicon({ domain, ...props }) {
|
||||
const config = useConfig();
|
||||
|
||||
if (process.env.privateMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const url = process.env.faviconURL || FAVICON_URL;
|
||||
const url = config?.faviconURL || process.env.faviconURL || FAVICON_URL;
|
||||
const hostName = domain ? getHostName(domain) : null;
|
||||
const domainName = GROUPED_DOMAINS[hostName]?.domain || hostName;
|
||||
const src = hostName ? url.replace(/\{\{\s*domain\s*}}/, domainName) : null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue