mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 10:01:54 +08:00
Output hostname size of sgmodule build
This commit is contained in:
@@ -115,7 +115,6 @@ export abstract class RuleOutput<TPreprocessed = unknown> {
|
||||
}
|
||||
|
||||
private async addFromDomainsetPromise(source: AsyncIterable<string> | Iterable<string> | 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<TPreprocessed = unknown> {
|
||||
}
|
||||
|
||||
private async addFromRulesetPromise(source: AsyncIterable<string> | 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) {
|
||||
const splitted = line.split(',');
|
||||
const type = splitted[0];
|
||||
@@ -303,13 +301,14 @@ export abstract class RuleOutput<TPreprocessed = unknown> {
|
||||
|
||||
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)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -262,12 +262,14 @@ export class RulesetOutput extends RuleOutput<Preprocessed> {
|
||||
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(', ')
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user