mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 08:37:13 +01:00
Domain validation. Filter domain from referrers.
This commit is contained in:
parent
a9765c7ea7
commit
5a4cde854a
13 changed files with 51 additions and 23 deletions
11
lib/url.js
Normal file
11
lib/url.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export function removeTrailingSlash(url) {
|
||||
return url.length > 1 && url.endsWith('/') ? url.slice(0, -1) : url;
|
||||
}
|
||||
|
||||
export function getDomainName(str) {
|
||||
try {
|
||||
return new URL(str).hostname;
|
||||
} catch {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue