Use hostname instead of domain name in tracker filter list

Co-authored-by: Chocobo1 <Chocobo1@users.noreply.github.com>

PR #19062.
Closes #19035.
This commit is contained in:
tearfur
2023-06-05 19:57:37 +08:00
committed by GitHub
parent a5e8af5070
commit 2e87e6e0df
2 changed files with 8 additions and 28 deletions

View File

@@ -62,18 +62,14 @@ namespace
QString getHost(const QString &url)
{
// We want the domain + tld. Subdomains should be disregarded
// If failed to parse the domain or IP address, original input should be returned
// We want the hostname.
// If failed to parse the domain, original input should be returned
const QString host = QUrl(url).host();
if (host.isEmpty())
return url;
// host is in IP format
if (!QHostAddress(host).isNull())
return host;
return host.section(u'.', -2, -1);
return host;
}
const QString NULL_HOST = u""_qs;