mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Update Rules
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
exports.dedupe = ({ fullSet, input }) => {
|
||||
const output = new Set();
|
||||
|
||||
for (const domain of input) {
|
||||
for (const domain2 of fullSet) {
|
||||
for (const domainFromInput of input) {
|
||||
for (const domainFromFullSet of fullSet) {
|
||||
if (
|
||||
domain2.startsWith('.')
|
||||
&& domain2 !== domain
|
||||
domainFromFullSet.startsWith('.')
|
||||
&& domainFromFullSet !== domainFromInput
|
||||
&& (
|
||||
domain.endsWith(domain2)
|
||||
|| `.${domain}` === domain2
|
||||
domainFromInput.endsWith(domainFromFullSet)
|
||||
|| `.${domainFromInput}` === domainFromFullSet
|
||||
)
|
||||
) {
|
||||
output.add(domain);
|
||||
output.add(domainFromInput);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ exports.whitelisted = ({ whiteList, input }) => {
|
||||
return output;
|
||||
};
|
||||
|
||||
exports.dedupeKeywords = ({ keywords, input }) => {
|
||||
exports.dedupeKeywords = ({ keywords, suffixes, input }) => {
|
||||
const output = new Set();
|
||||
|
||||
for (const domain of input) {
|
||||
@@ -45,6 +45,12 @@ exports.dedupeKeywords = ({ keywords, input }) => {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (const suffix of suffixes) {
|
||||
if (domain.endsWith(suffix)) {
|
||||
output.add(domain);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
|
||||
Reference in New Issue
Block a user