mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-13 17:50: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
|
steamDomainSetPromise
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
console.log(JSON.stringify(cdnDomainsList, null, 2));
|
||||||
|
|
||||||
// Move S3 domains to download domain set, since S3 files may be large
|
// Move S3 domains to download domain set, since S3 files may be large
|
||||||
appendArrayInPlace(downloadDomainSet, S3OSSDomains);
|
appendArrayInPlace(downloadDomainSet, S3OSSDomains);
|
||||||
appendArrayInPlace(downloadDomainSet, steamDomainSet);
|
appendArrayInPlace(downloadDomainSet, steamDomainSet);
|
||||||
|
|||||||
@ -63,6 +63,7 @@ function processFile(span: Span, sourcePath: string) {
|
|||||||
let sgmodulePathname: string | null = null;
|
let sgmodulePathname: string | null = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
let l: string | null = '';
|
||||||
for await (const line of readFileByLine(sourcePath)) {
|
for await (const line of readFileByLine(sourcePath)) {
|
||||||
if (line.startsWith(MAGIC_COMMAND_SKIP)) {
|
if (line.startsWith(MAGIC_COMMAND_SKIP)) {
|
||||||
return $skip;
|
return $skip;
|
||||||
@ -83,7 +84,7 @@ function processFile(span: Span, sourcePath: string) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const l = processLine(line);
|
l = processLine(line);
|
||||||
if (l) {
|
if (l) {
|
||||||
lines.push(l);
|
lines.push(l);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,9 +45,11 @@ export function fetchRemoteTextByLine(url: string, processLine = false): Promise
|
|||||||
|
|
||||||
export async function readFileIntoProcessedArray(file: string /* | FileHandle */) {
|
export async function readFileIntoProcessedArray(file: string /* | FileHandle */) {
|
||||||
const results = [];
|
const results = [];
|
||||||
|
let processed: string | null = '';
|
||||||
for await (const line of readFileByLine(file)) {
|
for await (const line of readFileByLine(file)) {
|
||||||
if (processLine(line)) {
|
processed = processLine(line);
|
||||||
results.push(line);
|
if (processed) {
|
||||||
|
results.push(processed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results;
|
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;
|
return trimmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,9 @@ export default async function runAgainstSourceFile(
|
|||||||
/** Secret keyword collection, only use for special purpose */
|
/** Secret keyword collection, only use for special purpose */
|
||||||
keywordSet?: Set<string> | null
|
keywordSet?: Set<string> | null
|
||||||
) {
|
) {
|
||||||
|
let l: string | null = '';
|
||||||
for await (const line of readFileByLine(filePath)) {
|
for await (const line of readFileByLine(filePath)) {
|
||||||
const l = processLine(line);
|
l = processLine(line);
|
||||||
if (!l) {
|
if (!l) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,8 +50,10 @@ async function dedupeFile(file: string, whitelist: HostnameSmolTrie) {
|
|||||||
|
|
||||||
const trie = new HostnameTrie();
|
const trie = new HostnameTrie();
|
||||||
|
|
||||||
|
let line: string | null = '';
|
||||||
|
|
||||||
for await (const l of readFileByLine(file)) {
|
for await (const l of readFileByLine(file)) {
|
||||||
const line = processLine(l);
|
line = processLine(l);
|
||||||
|
|
||||||
if (!line) {
|
if (!line) {
|
||||||
if (l.startsWith('# $ skip_dedupe_src')) {
|
if (l.startsWith('# $ skip_dedupe_src')) {
|
||||||
|
|||||||
@ -3217,8 +3217,7 @@ s-cdnstatic.svc.litv.tv
|
|||||||
jsmodule.svc.litv.tv
|
jsmodule.svc.litv.tv
|
||||||
bulletin.svc.litv.tv
|
bulletin.svc.litv.tv
|
||||||
static.svc.litv.tv
|
static.svc.litv.tv
|
||||||
# Amazon S3
|
fino.svc.litv.tv # Amazon S3
|
||||||
fino.svc.litv.tv
|
|
||||||
player.svc.litv.tv
|
player.svc.litv.tv
|
||||||
|
|
||||||
# >> General CDN
|
# >> General CDN
|
||||||
@ -4804,9 +4803,6 @@ images.findagrave.com
|
|||||||
cdn.streamlabs.com
|
cdn.streamlabs.com
|
||||||
sp.streamlabs.com
|
sp.streamlabs.com
|
||||||
images.blockscan.com
|
images.blockscan.com
|
||||||
# AWS S3
|
|
||||||
cdn.highporn.net
|
|
||||||
img.highporn.net
|
|
||||||
apim.m3pd.com
|
apim.m3pd.com
|
||||||
eomd1.fembeqq.xyz
|
eomd1.fembeqq.xyz
|
||||||
.anyhentai.com
|
.anyhentai.com
|
||||||
@ -4844,3 +4840,5 @@ cms.worldpokerdeals.com
|
|||||||
assets.hackmd.io
|
assets.hackmd.io
|
||||||
images.mooncloud.top
|
images.mooncloud.top
|
||||||
pmecdn.protonweb.com
|
pmecdn.protonweb.com
|
||||||
|
cdn.highporn.net # AWS S3
|
||||||
|
img.highporn.net
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user