mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 01:00:34 +08:00
Fix: pound sign handling
This commit is contained in:
parent
bae38ea3a8
commit
8ec28f6260
@ -88,8 +88,6 @@ export const buildCdnDownloadConf = task(require.main === module, __filename)(as
|
||||
steamDomainSetPromise
|
||||
]);
|
||||
|
||||
console.log(JSON.stringify(cdnDomainsList, null, 2));
|
||||
|
||||
// Move S3 domains to download domain set, since S3 files may be large
|
||||
appendArrayInPlace(downloadDomainSet, S3OSSDomains);
|
||||
appendArrayInPlace(downloadDomainSet, steamDomainSet);
|
||||
|
||||
@ -37,12 +37,6 @@ export function processLine(line: string): string | null {
|
||||
*/
|
||||
}
|
||||
|
||||
const otherPoundSign = trimmed.indexOf('#');
|
||||
|
||||
if (otherPoundSign > 0) {
|
||||
return trimmed.slice(0, otherPoundSign).trimEnd();
|
||||
}
|
||||
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
|
||||
@ -168,7 +168,13 @@ export class FileOutput {
|
||||
}
|
||||
|
||||
private async addFromDomainsetPromise(source: MaybePromise<AsyncIterable<string> | Iterable<string> | string[]>) {
|
||||
for await (const line of await source) {
|
||||
for await (let line of await source) {
|
||||
const otherPoundSign = line.lastIndexOf('#');
|
||||
|
||||
if (otherPoundSign > 0) {
|
||||
line = line.slice(0, otherPoundSign).trimEnd();
|
||||
}
|
||||
|
||||
if (line[0] === '.') {
|
||||
this.addDomainSuffix(line, true);
|
||||
} else {
|
||||
@ -187,7 +193,13 @@ export class FileOutput {
|
||||
}
|
||||
|
||||
private async addFromRulesetPromise(source: MaybePromise<AsyncIterable<string> | Iterable<string> | string[]>) {
|
||||
for await (const line of await source) {
|
||||
for await (let line of await source) {
|
||||
const otherPoundSign = line.lastIndexOf('#');
|
||||
|
||||
if (otherPoundSign > 0) {
|
||||
line = line.slice(0, otherPoundSign).trimEnd();
|
||||
}
|
||||
|
||||
const splitted = line.split(',');
|
||||
const type = splitted[0];
|
||||
const value = splitted[1];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user