mirror of
https://github.com/SukkaW/Surge.git
synced 2026-02-02 12:01:53 +08:00
Fix filter
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
exports.dedupe = ({ fullSet, input }) => {
|
||||
const output = new Set();
|
||||
const outputToBeRemoved = new Set();
|
||||
|
||||
for (const domainFromInput of input) {
|
||||
for (const domainFromFullSet of fullSet) {
|
||||
@@ -11,47 +11,47 @@ exports.dedupe = ({ fullSet, input }) => {
|
||||
|| `.${domainFromInput}` === domainFromFullSet
|
||||
)
|
||||
) {
|
||||
output.add(domainFromInput);
|
||||
outputToBeRemoved.add(domainFromInput);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
return outputToBeRemoved;
|
||||
};
|
||||
|
||||
exports.whitelisted = ({ whiteList, input }) => {
|
||||
const output = new Set();
|
||||
const outputToBeRemoved = new Set();
|
||||
|
||||
for (const domain of input) {
|
||||
for (const white of whiteList) {
|
||||
if (domain.includes(white) || white.includes(domain)) {
|
||||
output.add(domain);
|
||||
outputToBeRemoved.add(domain);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
return outputToBeRemoved;
|
||||
};
|
||||
|
||||
exports.dedupeKeywords = ({ keywords, suffixes, input }) => {
|
||||
const output = new Set();
|
||||
const outputToBeRemoved = new Set();
|
||||
|
||||
for (const domain of input) {
|
||||
for (const keyword of keywords) {
|
||||
if (domain.includes(keyword) || keyword.includes(domain)) {
|
||||
output.add(domain);
|
||||
outputToBeRemoved.add(domain);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (const suffix of suffixes) {
|
||||
if (domain.endsWith(suffix)) {
|
||||
output.add(domain);
|
||||
outputToBeRemoved.add(domain);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
return outputToBeRemoved;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user