mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
PR Feedback: Simplify subdomain extraction
This commit is contained in:
parent
d50d0faabe
commit
aa908a1c57
@ -230,6 +230,6 @@ export function truncateTextAtCharIndex(text, charIndex, replacement = '...') {
|
||||
*/
|
||||
export function getSubdomain() {
|
||||
let { host } = window.location;
|
||||
let matchedHost = host.match(/(([^.]+)\.)?(.*)\.(.*)/);
|
||||
return matchedHost[2] || 'www';
|
||||
let tokens = host.split('.');
|
||||
return tokens.length > 2 ? tokens[0] : 'www';
|
||||
}
|
Loading…
Reference in New Issue
Block a user