mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Chore: make ESLint Happy
This commit is contained in:
@@ -6,33 +6,33 @@ import { ALL, NORTH_AMERICA, EU, HK, TW, JP, KR } from '../Source/stream';
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import { RulesetOutput } from './lib/create-file';
|
||||
|
||||
export const createRulesetForStreamService = (
|
||||
span: Span,
|
||||
export function createRulesetForStreamService(span: Span,
|
||||
fileId: string, title: string,
|
||||
streamServices: Array<import('../Source/stream').StreamService>
|
||||
) => span.traceChildAsync(fileId, async (childSpan) => Promise.all([
|
||||
streamServices: Array<import('../Source/stream').StreamService>) {
|
||||
return span.traceChildAsync(fileId, async (childSpan) => Promise.all([
|
||||
// Domains
|
||||
new RulesetOutput(childSpan, fileId, 'non_ip')
|
||||
.withTitle(`Sukka's Ruleset - Stream Services: ${title}`)
|
||||
.withDescription([
|
||||
...SHARED_DESCRIPTION,
|
||||
'',
|
||||
...streamServices.map((i) => `- ${i.name}`)
|
||||
])
|
||||
.addFromRuleset(streamServices.flatMap((i) => i.rules))
|
||||
.write(),
|
||||
// IP
|
||||
new RulesetOutput(childSpan, fileId, 'ip')
|
||||
.withTitle(`Sukka's Ruleset - Stream Services IPs: ${title}`)
|
||||
.withDescription([
|
||||
...SHARED_DESCRIPTION,
|
||||
'',
|
||||
...streamServices.map((i) => `- ${i.name}`)
|
||||
])
|
||||
.bulkAddCIDR4NoResolve(streamServices.flatMap(i => i.ip?.v4 ?? []))
|
||||
.bulkAddCIDR6NoResolve(streamServices.flatMap(i => i.ip?.v6 ?? []))
|
||||
.write()
|
||||
]));
|
||||
new RulesetOutput(childSpan, fileId, 'non_ip')
|
||||
.withTitle(`Sukka's Ruleset - Stream Services: ${title}`)
|
||||
.withDescription([
|
||||
...SHARED_DESCRIPTION,
|
||||
'',
|
||||
...streamServices.map((i) => `- ${i.name}`)
|
||||
])
|
||||
.addFromRuleset(streamServices.flatMap((i) => i.rules))
|
||||
.write(),
|
||||
// IP
|
||||
new RulesetOutput(childSpan, fileId, 'ip')
|
||||
.withTitle(`Sukka's Ruleset - Stream Services IPs: ${title}`)
|
||||
.withDescription([
|
||||
...SHARED_DESCRIPTION,
|
||||
'',
|
||||
...streamServices.map((i) => `- ${i.name}`)
|
||||
])
|
||||
.bulkAddCIDR4NoResolve(streamServices.flatMap(i => i.ip?.v4 ?? []))
|
||||
.bulkAddCIDR6NoResolve(streamServices.flatMap(i => i.ip?.v6 ?? []))
|
||||
.write()
|
||||
]));
|
||||
}
|
||||
|
||||
export const buildStreamService = task(require.main === module, __filename)(async (span) => Promise.all([
|
||||
createRulesetForStreamService(span, 'stream', 'All', ALL),
|
||||
|
||||
Reference in New Issue
Block a user