mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-08-24 17:56:27 +00:00
fix(extension): support Google Drive video frames
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
function hostnameMatchesDomain(hostname, domain) {
|
||||
const normalizedHostname = String(hostname || '').toLowerCase();
|
||||
const normalizedDomain = String(domain || '').toLowerCase();
|
||||
return normalizedDomain
|
||||
&& (normalizedHostname === normalizedDomain
|
||||
|| normalizedHostname.endsWith(`.${normalizedDomain}`));
|
||||
}
|
||||
|
||||
export function isTabUrlFiltered(url, blacklistDomains, allowlistDomains = []) {
|
||||
const urlString = String(url || '');
|
||||
|
||||
try {
|
||||
const hostname = new URL(urlString).hostname.toLowerCase();
|
||||
if (allowlistDomains.some(domain => hostnameMatchesDomain(hostname, domain))) {
|
||||
return false;
|
||||
}
|
||||
return blacklistDomains.some(domain => hostnameMatchesDomain(hostname, domain));
|
||||
} catch {
|
||||
const normalizedUrl = urlString.toLowerCase();
|
||||
return blacklistDomains.some(domain => normalizedUrl.includes(String(domain).toLowerCase()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user