Support blacklist with port

This commit is contained in:
Shin'ya Ueoka 2019-04-17 20:49:47 +09:00
parent 938fe9f752
commit 1bd2bf1ae3
2 changed files with 9 additions and 2 deletions

View file

@ -4,9 +4,9 @@ const includes = (blacklist, url) => {
let u = new URL(url);
return blacklist.some((item) => {
if (!item.includes('/')) {
return re.fromWildcard(item).test(u.hostname);
return re.fromWildcard(item).test(u.host);
}
return re.fromWildcard(item).test(u.hostname + u.pathname);
return re.fromWildcard(item).test(u.host + u.pathname);
});
};