mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-15 10:40:33 +08:00
Fix dedupe
This commit is contained in:
parent
2c2d9c119e
commit
1f8786c229
@ -5,6 +5,8 @@ const Piscina = require('piscina');
|
||||
const fullsetDomainStartsWithADot = Piscina.workerData
|
||||
const totalLen = fullsetDomainStartsWithADot.length;
|
||||
|
||||
const DOT = '.';
|
||||
|
||||
// const log = isCI ? () => { } : console.log.bind(console);
|
||||
/**
|
||||
* @param {{ chunk: string[] }} param0
|
||||
@ -25,17 +27,23 @@ module.exports = ({ chunk }) => {
|
||||
const domainFromFullSetLen = domainStartsWithADotAndFromFullSet.length;
|
||||
|
||||
if (domainFromInputLen < domainFromFullSetLen) {
|
||||
if (domainFromInputLen + 1 === domainFromFullSetLen) {
|
||||
// !domainFromInput.starsWith('.') && `.${domainFromInput}` === domainFromFullSet
|
||||
if (domainFromInputChunk.charCodeAt(0) !== 46 && domainFromInputChunk.endsWith(domainStartsWithADotAndFromFullSet)) {
|
||||
outputToBeRemoved[i] = 1;
|
||||
// log(domainFromInputChunk, domainStartsWithADotAndFromFullSet)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (domainFromInputLen + 1 !== domainFromFullSetLen) {
|
||||
break;
|
||||
}
|
||||
} else if (domainFromInputLen > domainFromFullSetLen && domainFromInputChunk.endsWith(domainStartsWithADotAndFromFullSet)) {
|
||||
|
||||
// !domainFromInput.starsWith('.') && `.${domainFromInput}` === domainFromFullSet
|
||||
if (
|
||||
domainFromInputChunk[0] !== DOT
|
||||
&& domainStartsWithADotAndFromFullSet.endsWith(domainFromInputChunk)
|
||||
) {
|
||||
outputToBeRemoved[i] = 1;
|
||||
// log(domainFromInputChunk, domainStartsWithADotAndFromFullSet)
|
||||
break;
|
||||
}
|
||||
} else if (
|
||||
domainFromInputLen > domainFromFullSetLen
|
||||
&& domainFromInputChunk.endsWith(domainStartsWithADotAndFromFullSet)
|
||||
) {
|
||||
outputToBeRemoved[i] = 1;
|
||||
// log(domainFromInputChunk, domainStartsWithADotAndFromFullSet)
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user