diff --git a/Build/build-sgmodule-redirect.ts b/Build/build-sgmodule-redirect.ts index 235aa1ec..f061048d 100644 --- a/Build/build-sgmodule-redirect.ts +++ b/Build/build-sgmodule-redirect.ts @@ -31,8 +31,6 @@ const REDIRECT_MIRROR_HEADER = [ ['gapis.geekzu.org/g-fonts/', 'https://fonts.gstatic.com/'], ['gapis.geekzu.org/g-themes/', 'https://themes.googleusercontent.com/'], ['sdn.geekzu.org/', 'https://secure.gravatar.com/'], - // cravatar - ['cravatar.cn/', 'https://secure.gravatar.com/'], // libravatar ['seccdn.libravatar.org/gravatarproxy/', 'https://secure.gravatar.com/'], // ghproxy @@ -53,16 +51,14 @@ const REDIRECT_MIRROR_HEADER = [ ['cdn.gitmirror.com/', 'https://cdn.statically.io/'], // FastGit ['raw.fastgit.org/', 'https://raw.githubusercontent.com/'], - ['assets.fastgit.org/', 'https://github.githubassets.com/'], + // ['assets.fastgit.org/', 'https://github.githubassets.com/'], // jsDelivr ['fastly.jsdelivr.net/', 'https://cdn.jsdelivr.net/'], ['gcore.jsdelivr.net/', 'https://cdn.jsdelivr.net/'], + ['testingcf.jsdelivr.net/', 'https://cdn.jsdelivr.net/'], // JSDMirror ['cdn.jsdmirror.com/', 'https://cdn.jsdelivr.net/'], ['cdn.jsdmirror.cn/', 'https://cdn.jsdelivr.net/'], - // ops.ci - ['jsdelivr.ops.ci/', 'https://cdn.jsdelivr.net/'], - ['fonts.ops.ci/', 'https://fonts.googleapis.com/'], // onmicrosoft.cn ['jsd.onmicrosoft.cn/', 'https://cdn.jsdelivr.net/'], ['npm.onmicrosoft.cn/', 'https://unpkg.com/'], @@ -79,9 +75,7 @@ const REDIRECT_MIRROR_HEADER = [ ['fastly-polyfill.net/', 'https://cdnjs.cloudflare.com/polyfill/'], // BootCDN has been controlled by a malicious actor and being used to spread malware ['cdn.bootcss.com/', 'https://cdnjs.cloudflare.com/ajax/libs/'], - ['cdn.bootcdn.net/', 'https://cdnjs.cloudflare.com/ajax/libs/'], - ['cdn.bootcdn.com/', 'https://cdnjs.cloudflare.com/ajax/libs/'], ['cdn.staticfile.net/', 'https://cdnjs.cloudflare.com/ajax/libs/'], ['cdn.staticfile.org/', 'https://cdnjs.cloudflare.com/ajax/libs/'], // Misc @@ -148,7 +142,7 @@ const REDIRECT_FAKEWEBSITES = [ export const buildRedirectModule = task(require.main === module, __filename)(async (span) => { const domains = Array.from(new Set([ ...REDIRECT_MIRROR_HEADER.map(([from]) => getHostname(from, { detectIp: false })), - ...REDIRECT_FAKEWEBSITES.flatMap(([from]) => [from, `www.${from}`]), + ...REDIRECT_FAKEWEBSITES.flatMap(([from]) => [from, `*.${from}`]), ...REDIRECT_MIRROR_307.map(([from]) => getHostname(from, { detectIp: false })) ])).filter(isTruthy); @@ -156,7 +150,7 @@ export const buildRedirectModule = task(require.main === module, __filename)(asy span, [ '#!name=[Sukka] URL Redirect', - `#!desc=Last Updated: ${new Date().toISOString()}`, + `#!desc=Last Updated: ${new Date().toISOString()} Size: ${domains.length}`, '', '[MITM]', `hostname = %APPEND% ${domains.join(', ')}`, diff --git a/Build/lib/rules/base.ts b/Build/lib/rules/base.ts index bacc72f6..5e1a02d8 100644 --- a/Build/lib/rules/base.ts +++ b/Build/lib/rules/base.ts @@ -115,7 +115,6 @@ export abstract class RuleOutput { } private async addFromDomainsetPromise(source: AsyncIterable | Iterable | string[]) { - // eslint-disable-next-line @typescript-eslint/await-thenable -- https://github.com/typescript-eslint/typescript-eslint/issues/10080 for await (const line of source) { if (line[0] === '.') { this.addDomainSuffix(line); @@ -131,7 +130,6 @@ export abstract class RuleOutput { } private async addFromRulesetPromise(source: AsyncIterable | Iterable) { - // eslint-disable-next-line @typescript-eslint/await-thenable -- https://github.com/typescript-eslint/typescript-eslint/issues/10080 for await (const line of source) { const splitted = line.split(','); const type = splitted[0]; @@ -303,13 +301,14 @@ export abstract class RuleOutput { if (this.mitmSgmodule) { const sgmodule = this.mitmSgmodule(); - const sgMOdulePath = this.mitmSgmodulePath ?? path.join(this.type, this.id + '.sgmodule'); + const sgModulePath = this.mitmSgmodulePath ?? path.join(this.type, this.id + '.sgmodule'); + if (sgmodule) { promises.push( compareAndWriteFile( this.span, sgmodule, - path.join(OUTPUT_MODULES_DIR, sgMOdulePath) + path.join(OUTPUT_MODULES_DIR, sgModulePath) ) ); } diff --git a/Build/lib/rules/ruleset.ts b/Build/lib/rules/ruleset.ts index 38cc1c8b..32ba4133 100644 --- a/Build/lib/rules/ruleset.ts +++ b/Build/lib/rules/ruleset.ts @@ -262,12 +262,14 @@ export class RulesetOutput extends RuleOutput { console.table(parsedFailures); } + const hostnames = Array.from(new Set(parsed.map(i => i[1]))); + return [ '#!name=[Sukka] Surge Reject MITM', - '#!desc=为 URL Regex 规则组启用 MITM', + `#!desc=为 URL Regex 规则组启用 MITM (size: ${hostnames.length})`, '', '[MITM]', - 'hostname = %APPEND% ' + Array.from(new Set(parsed.map(i => i[1]))).join(', ') + 'hostname = %APPEND% ' + hostnames.join(', ') ]; } }