fix docker

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-02-11 22:04:48 +01:00
parent 8c2bf59b3e
commit 497b05eb32
2 changed files with 19 additions and 5 deletions

View File

@@ -1,8 +1,19 @@
import referrers from '../referrers';
export function parseReferrer(url?: string) {
const { hostname } = new URL(url || '');
const match = referrers[hostname];
function getHostname(url: string | undefined) {
if (!url) {
return '';
}
try {
return new URL(url).hostname;
} catch (e) {
return '';
}
}
export function parseReferrer(url: string | undefined) {
const match = referrers[getHostname(url)];
console.log('Parsing referrer', url);
console.log('Match', match);