mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 21:57:16 +01:00
Grouped referrers.
This commit is contained in:
parent
fd4a405779
commit
84193a4ec5
6 changed files with 175 additions and 71 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import { GROUPED_DOMAINS } from '@/lib/constants';
|
||||
|
||||
function getHostName(url: string) {
|
||||
const match = url.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?([^:/\n?=]+)/im);
|
||||
return match && match.length > 1 ? match[1] : null;
|
||||
|
|
@ -9,16 +11,11 @@ export function Favicon({ domain, ...props }) {
|
|||
}
|
||||
|
||||
const hostName = domain ? getHostName(domain) : null;
|
||||
const src = hostName
|
||||
? `https://icons.duckduckgo.com/ip3/${GROUPED_DOMAINS[hostName]?.domain || hostName}.ico`
|
||||
: null;
|
||||
|
||||
return hostName ? (
|
||||
<img
|
||||
src={`https://icons.duckduckgo.com/ip3/${hostName}.ico`}
|
||||
width={16}
|
||||
height={16}
|
||||
alt=""
|
||||
{...props}
|
||||
/>
|
||||
) : null;
|
||||
return hostName ? <img src={src} width={16} height={16} alt="" {...props} /> : null;
|
||||
}
|
||||
|
||||
export default Favicon;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue