mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 01:00:34 +08:00
Refactor: adjust adguardhome output
This commit is contained in:
parent
78eb1f1c48
commit
ea6a4a0dc3
@ -1,6 +1,6 @@
|
||||
import { parseFelixDnsmasqFromResp } from './lib/parse-dnsmasq';
|
||||
import { task } from './trace';
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import { SHARED_DESCRIPTION } from './constants/description';
|
||||
import { createMemoizedPromise } from './lib/memo-promise';
|
||||
import { DomainsetOutput } from './lib/create-file';
|
||||
import { $fetch } from './lib/make-fetch-happen';
|
||||
|
||||
@ -2,7 +2,7 @@ import path from 'node:path';
|
||||
import { fetchRemoteTextByLine, readFileIntoProcessedArray } from './lib/fetch-text-by-line';
|
||||
import { HostnameTrie } from './lib/trie';
|
||||
import { task } from './trace';
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import { SHARED_DESCRIPTION } from './constants/description';
|
||||
import { appendArrayInPlace } from './lib/append-array-in-place';
|
||||
import { SOURCE_DIR } from './constants/dir';
|
||||
import { processLine } from './lib/process-line';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { DOMAINS, PROCESS_NAMES } from '../Source/non_ip/cloudmounter';
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import { SHARED_DESCRIPTION } from './constants/description';
|
||||
import { task } from './trace';
|
||||
import { RulesetOutput } from './lib/create-file';
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ import { readFileByLine } from './lib/fetch-text-by-line';
|
||||
import { processLine } from './lib/process-line';
|
||||
import type { Span } from './trace';
|
||||
import { task } from './trace';
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import { SHARED_DESCRIPTION } from './constants/description';
|
||||
import { fdir as Fdir } from 'fdir';
|
||||
import { appendArrayInPlace } from './lib/append-array-in-place';
|
||||
import { SOURCE_DIR } from './constants/dir';
|
||||
|
||||
@ -6,7 +6,7 @@ import type { DNSMapping } from '../Source/non_ip/direct';
|
||||
import { readFileIntoProcessedArray } from './lib/fetch-text-by-line';
|
||||
import { compareAndWriteFile } from './lib/create-file';
|
||||
import { task } from './trace';
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import { SHARED_DESCRIPTION } from './constants/description';
|
||||
import { createMemoizedPromise } from './lib/memo-promise';
|
||||
import * as yaml from 'yaml';
|
||||
import { appendArrayInPlace } from './lib/append-array-in-place';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { task } from './trace';
|
||||
import { fetchRemoteTextByLine } from './lib/fetch-text-by-line';
|
||||
import { HostnameSmolTrie } from './lib/trie';
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import { SHARED_DESCRIPTION } from './constants/description';
|
||||
import { createMemoizedPromise } from './lib/memo-promise';
|
||||
import { extractDomainsFromFelixDnsmasq } from './lib/parse-dnsmasq';
|
||||
import { RulesetOutput } from './lib/create-file';
|
||||
|
||||
@ -11,14 +11,13 @@ import { task } from './trace';
|
||||
// tldts-experimental is way faster than tldts, but very little bit inaccurate
|
||||
// (since it is hashes based). But the result is still deterministic, which is
|
||||
// enough when creating a simple stat of reject hosts.
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import { SHARED_DESCRIPTION } from './constants/description';
|
||||
import { getPhishingDomains } from './lib/get-phishing-domains';
|
||||
|
||||
import { setAddFromArray } from './lib/set-add-from-array';
|
||||
import { appendArrayInPlace } from './lib/append-array-in-place';
|
||||
import { OUTPUT_INTERNAL_DIR, SOURCE_DIR } from './constants/dir';
|
||||
import { DomainsetOutput } from './lib/create-file';
|
||||
import { withBannerArray } from './lib/misc';
|
||||
|
||||
export const buildRejectDomainSet = task(require.main === module, __filename)(async (span) => {
|
||||
const rejectBaseDescription = [
|
||||
@ -155,10 +154,16 @@ export const buildRejectDomainSet = task(require.main === module, __filename)(as
|
||||
),
|
||||
compareAndWriteFile(
|
||||
span,
|
||||
withBannerArray(
|
||||
'Sukka\'s Ruleset - Blocklist for AdGuardHome',
|
||||
rejectBaseDescription,
|
||||
new Date(),
|
||||
appendArrayInPlace(
|
||||
[
|
||||
'! Title: Sukka\'s Ruleset - Blocklist for AdGuardHome',
|
||||
'! Last modified: ' + new Date().toUTCString(),
|
||||
'! Expires: 6 hours',
|
||||
'! License: https://github.com/SukkaW/Surge/blob/master/LICENSE',
|
||||
'! Homepage: https://github.com/SukkaW/Surge',
|
||||
'! Description: The domainset supports AD blocking, tracking protection, privacy protection, anti-phishing, anti-mining',
|
||||
'!'
|
||||
],
|
||||
rejectOutput.adguardhome(filterRuleWhitelistDomainSets)
|
||||
),
|
||||
path.join(OUTPUT_INTERNAL_DIR, 'reject-adguardhome.txt')
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import path from 'node:path';
|
||||
import { createReadlineInterfaceFromResponse, readFileIntoProcessedArray } from './lib/fetch-text-by-line';
|
||||
import { task } from './trace';
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import { SHARED_DESCRIPTION } from './constants/description';
|
||||
import { isProbablyIpv4, isProbablyIpv6 } from './lib/is-fast-ip';
|
||||
import { fsFetchCache, getFileContentHash } from './lib/cache-filesystem';
|
||||
import { processLine } from './lib/process-line';
|
||||
|
||||
@ -7,7 +7,7 @@ import { DOMESTICS, DOH_BOOTSTRAP } from '../Source/non_ip/domestic';
|
||||
import * as yaml from 'yaml';
|
||||
import { OUTPUT_INTERNAL_DIR, OUTPUT_MODULES_DIR } from './constants/dir';
|
||||
import { appendArrayInPlace } from './lib/append-array-in-place';
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import { SHARED_DESCRIPTION } from './constants/description';
|
||||
import { createGetDnsMappingRule } from './build-domestic-direct-lan-ruleset-dns-mapping-module';
|
||||
|
||||
const HOSTNAMES = [
|
||||
|
||||
@ -3,7 +3,7 @@ import path from 'node:path';
|
||||
import { getHostname } from 'tldts-experimental';
|
||||
import { task } from './trace';
|
||||
import { $fetch } from './lib/make-fetch-happen';
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import { SHARED_DESCRIPTION } from './constants/description';
|
||||
import { readFileIntoProcessedArray } from './lib/fetch-text-by-line';
|
||||
|
||||
import { DomainsetOutput } from './lib/create-file';
|
||||
|
||||
@ -3,7 +3,7 @@ import type { Span } from './trace';
|
||||
import { task } from './trace';
|
||||
|
||||
import { ALL, NORTH_AMERICA, EU, HK, TW, JP, KR } from '../Source/stream';
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import { SHARED_DESCRIPTION } from './constants/description';
|
||||
import { RulesetOutput } from './lib/create-file';
|
||||
|
||||
export function createRulesetForStreamService(span: Span,
|
||||
|
||||
@ -3,7 +3,7 @@ import { createReadlineInterfaceFromResponse } from './lib/fetch-text-by-line';
|
||||
import { isProbablyIpv4, isProbablyIpv6 } from './lib/is-fast-ip';
|
||||
import { processLine } from './lib/process-line';
|
||||
import { task } from './trace';
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import { SHARED_DESCRIPTION } from './constants/description';
|
||||
import { createMemoizedPromise } from './lib/memo-promise';
|
||||
import { RulesetOutput } from './lib/create-file';
|
||||
import { $fetch } from './lib/make-fetch-happen';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user