mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 01:00:34 +08:00
Feat: ability to handle inline comment
This commit is contained in:
parent
fe7278c7fa
commit
373f862c6d
@ -88,6 +88,8 @@ 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);
|
||||
|
||||
@ -63,6 +63,7 @@ function processFile(span: Span, sourcePath: string) {
|
||||
let sgmodulePathname: string | null = null;
|
||||
|
||||
try {
|
||||
let l: string | null = '';
|
||||
for await (const line of readFileByLine(sourcePath)) {
|
||||
if (line.startsWith(MAGIC_COMMAND_SKIP)) {
|
||||
return $skip;
|
||||
@ -83,7 +84,7 @@ function processFile(span: Span, sourcePath: string) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const l = processLine(line);
|
||||
l = processLine(line);
|
||||
if (l) {
|
||||
lines.push(l);
|
||||
}
|
||||
|
||||
@ -45,9 +45,11 @@ export function fetchRemoteTextByLine(url: string, processLine = false): Promise
|
||||
|
||||
export async function readFileIntoProcessedArray(file: string /* | FileHandle */) {
|
||||
const results = [];
|
||||
let processed: string | null = '';
|
||||
for await (const line of readFileByLine(file)) {
|
||||
if (processLine(line)) {
|
||||
results.push(line);
|
||||
processed = processLine(line);
|
||||
if (processed) {
|
||||
results.push(processed);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
|
||||
@ -37,6 +37,12 @@ export function processLine(line: string): string | null {
|
||||
*/
|
||||
}
|
||||
|
||||
const otherPoundSign = trimmed.indexOf('#');
|
||||
|
||||
if (otherPoundSign > 0) {
|
||||
return trimmed.slice(0, otherPoundSign).trimEnd();
|
||||
}
|
||||
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
|
||||
@ -9,8 +9,9 @@ export default async function runAgainstSourceFile(
|
||||
/** Secret keyword collection, only use for special purpose */
|
||||
keywordSet?: Set<string> | null
|
||||
) {
|
||||
let l: string | null = '';
|
||||
for await (const line of readFileByLine(filePath)) {
|
||||
const l = processLine(line);
|
||||
l = processLine(line);
|
||||
if (!l) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -50,8 +50,10 @@ async function dedupeFile(file: string, whitelist: HostnameSmolTrie) {
|
||||
|
||||
const trie = new HostnameTrie();
|
||||
|
||||
let line: string | null = '';
|
||||
|
||||
for await (const l of readFileByLine(file)) {
|
||||
const line = processLine(l);
|
||||
line = processLine(l);
|
||||
|
||||
if (!line) {
|
||||
if (l.startsWith('# $ skip_dedupe_src')) {
|
||||
|
||||
@ -3217,8 +3217,7 @@ s-cdnstatic.svc.litv.tv
|
||||
jsmodule.svc.litv.tv
|
||||
bulletin.svc.litv.tv
|
||||
static.svc.litv.tv
|
||||
# Amazon S3
|
||||
fino.svc.litv.tv
|
||||
fino.svc.litv.tv # Amazon S3
|
||||
player.svc.litv.tv
|
||||
|
||||
# >> General CDN
|
||||
@ -4804,9 +4803,6 @@ images.findagrave.com
|
||||
cdn.streamlabs.com
|
||||
sp.streamlabs.com
|
||||
images.blockscan.com
|
||||
# AWS S3
|
||||
cdn.highporn.net
|
||||
img.highporn.net
|
||||
apim.m3pd.com
|
||||
eomd1.fembeqq.xyz
|
||||
.anyhentai.com
|
||||
@ -4844,3 +4840,5 @@ cms.worldpokerdeals.com
|
||||
assets.hackmd.io
|
||||
images.mooncloud.top
|
||||
pmecdn.protonweb.com
|
||||
cdn.highporn.net # AWS S3
|
||||
img.highporn.net
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user