Allow alternate host url in tracker.

This commit is contained in:
Mike Cao 2020-08-31 20:25:31 -07:00
parent aec012fb79
commit cebd3fd924
3 changed files with 9 additions and 5 deletions

View file

@ -1,11 +1,11 @@
export function removeTrailingSlash(url) {
return url.length > 1 && url.endsWith('/') ? url.slice(0, -1) : url;
return url && url.length > 1 && url.endsWith('/') ? url.slice(0, -1) : url;
}
export function getDomainName(str) {
try {
return new URL(str).hostname;
} catch {
} catch (e) {
return str;
}
}