mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Refactor: minor changes
This commit is contained in:
@@ -28,9 +28,7 @@ export const buildCommon = task(import.meta.main, import.meta.path)(async (span)
|
|||||||
// if (dirName === 'domainset' || dirName === 'ip' || dirName === 'non_ip') {
|
// if (dirName === 'domainset' || dirName === 'ip' || dirName === 'non_ip') {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
// console.error(picocolors.red(`[build-comman] Unknown dir: ${dirPath}`));
|
||||||
// console.error(picocolors.red(`[build-comman] Unknown dir: ${dirPath}`));
|
|
||||||
|
|
||||||
// return true;
|
// return true;
|
||||||
// })
|
// })
|
||||||
.filter((filepath, isDirectory) => {
|
.filter((filepath, isDirectory) => {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const HOSTNAMES = [
|
|||||||
|
|
||||||
export const buildAlwaysRealIPModule = task(import.meta.main, import.meta.path)(async (span) => {
|
export const buildAlwaysRealIPModule = task(import.meta.main, import.meta.path)(async (span) => {
|
||||||
// Intranet, Router Setup, and mant more
|
// Intranet, Router Setup, and mant more
|
||||||
const dataset = ([Object.entries(DIRECTS), Object.entries(LANS)]);
|
const dataset = [Object.entries(DIRECTS), Object.entries(LANS)];
|
||||||
const surge = dataset.flatMap(data => data.flatMap(([, { domains }]) => domains.flatMap((domain) => [`*.${domain}`, domain])));
|
const surge = dataset.flatMap(data => data.flatMap(([, { domains }]) => domains.flatMap((domain) => [`*.${domain}`, domain])));
|
||||||
const clash = dataset.flatMap(data => data.flatMap(([, { domains }]) => domains.map((domain) => `+.${domain}`)));
|
const clash = dataset.flatMap(data => data.flatMap(([, { domains }]) => domains.map((domain) => `+.${domain}`)));
|
||||||
|
|
||||||
|
|||||||
@@ -434,28 +434,41 @@ function parse($line: string, gorhill: PublicSuffixList, result: [string, ParseT
|
|||||||
let sliceStart = 0;
|
let sliceStart = 0;
|
||||||
let sliceEnd: number | undefined;
|
let sliceEnd: number | undefined;
|
||||||
|
|
||||||
if (line[2] === '|') { // line.startsWith('@@|')
|
switch (line[2]) {
|
||||||
sliceStart = 3;
|
case '|':
|
||||||
whiteIncludeAllSubDomain = false;
|
// line.startsWith('@@|')
|
||||||
|
sliceStart = 3;
|
||||||
|
whiteIncludeAllSubDomain = false;
|
||||||
|
|
||||||
if (line[3] === '|') { // line.startsWith('@@||')
|
if (line[3] === '|') { // line.startsWith('@@||')
|
||||||
sliceStart = 4;
|
sliceStart = 4;
|
||||||
|
whiteIncludeAllSubDomain = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '.': { // line.startsWith('@@.')
|
||||||
|
sliceStart = 3;
|
||||||
whiteIncludeAllSubDomain = true;
|
whiteIncludeAllSubDomain = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else if (line[2] === '.') { // line.startsWith('@@.')
|
|
||||||
sliceStart = 3;
|
case ':': {
|
||||||
whiteIncludeAllSubDomain = true;
|
/**
|
||||||
} else if (
|
* line.startsWith('@@://')
|
||||||
/**
|
*
|
||||||
* line.startsWith('@@://')
|
* `@@://googleadservices.com^|`
|
||||||
*
|
* `@@://www.googleadservices.com^|`
|
||||||
* `@@://googleadservices.com^|`
|
*/
|
||||||
* `@@://www.googleadservices.com^|`
|
if (line[3] === '/' && line[4] === '/') {
|
||||||
*/
|
whiteIncludeAllSubDomain = false;
|
||||||
line[2] === ':' && line[3] === '/' && line[4] === '/'
|
sliceStart = 5;
|
||||||
) {
|
}
|
||||||
whiteIncludeAllSubDomain = false;
|
break;
|
||||||
sliceStart = 5;
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lineEndsWithCaretOrCaretVerticalBar) {
|
if (lineEndsWithCaretOrCaretVerticalBar) {
|
||||||
|
|||||||
Reference in New Issue
Block a user