mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 01:00:34 +08:00
Rollout deprecation
This commit is contained in:
parent
4e8252730b
commit
292c04dc18
@ -9,6 +9,7 @@ import { domainDeduper } from './lib/domain-deduper';
|
||||
import type { Span } from './trace';
|
||||
import { task } from './trace';
|
||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||
import picocolors from 'picocolors';
|
||||
|
||||
const MAGIC_COMMAND_SKIP = '# $ custom_build_script';
|
||||
const MAGIC_COMMAND_TITLE = '# $ meta_title ';
|
||||
@ -44,6 +45,8 @@ export const buildCommon = task(import.meta.path, async (span) => {
|
||||
promises.push(transformRuleset(span, entry.fullpath(), relativePath));
|
||||
continue;
|
||||
}
|
||||
|
||||
console.error(picocolors.red(`[build-comman] Unknown file: ${relativePath}`));
|
||||
}
|
||||
|
||||
return Promise.all(promises);
|
||||
|
||||
44
Build/build-deprecate-files.ts
Normal file
44
Build/build-deprecate-files.ts
Normal file
@ -0,0 +1,44 @@
|
||||
import { compareAndWriteFile } from './lib/create-file';
|
||||
import { task } from './trace';
|
||||
import path from 'path';
|
||||
|
||||
const DEPRECATED_FILES = [
|
||||
['non_ip/global_plus', 'This file has been merged with non_ip/global'],
|
||||
['domainset/reject_sukka', 'This file has been merged with domainset/reject'],
|
||||
['domainset/reject_phishing', 'This file has been merged with domainset/reject']
|
||||
];
|
||||
|
||||
const outputSurgeDir = path.resolve(import.meta.dir, '../List');
|
||||
const outputClashDir = path.resolve(import.meta.dir, '../Clash');
|
||||
|
||||
export const buildDeprecateFiles = task(import.meta.path, (span) => span.traceChildAsync('create deprecated files', async (childSpan) => {
|
||||
const promises: Array<Promise<unknown>> = [];
|
||||
|
||||
for (const [filePath, description] of DEPRECATED_FILES) {
|
||||
const surgeFile = path.resolve(outputSurgeDir, `${filePath}.conf`);
|
||||
const clashFile = path.resolve(outputClashDir, `${filePath}.txt`);
|
||||
|
||||
console.log({
|
||||
surgeFile,
|
||||
clashFile
|
||||
});
|
||||
|
||||
const content = [
|
||||
'#########################################',
|
||||
'# Sukka\'s Ruleset - Deprecated',
|
||||
`# ${description}`,
|
||||
'################## EOF ##################'
|
||||
];
|
||||
|
||||
promises.push(
|
||||
compareAndWriteFile(childSpan, content, surgeFile),
|
||||
compareAndWriteFile(childSpan, content, clashFile)
|
||||
);
|
||||
}
|
||||
|
||||
return Promise.all(promises);
|
||||
}));
|
||||
|
||||
if (import.meta.main) {
|
||||
buildDeprecateFiles();
|
||||
}
|
||||
@ -41,7 +41,6 @@ export const buildInternalCDNDomains = task(import.meta.path, async (span) => {
|
||||
getGorhillPublicSuffixPromise(),
|
||||
processLocalRuleSet(path.resolve(import.meta.dir, '../List/non_ip/cdn.conf'), proxySet, proxyKeywords),
|
||||
processLocalRuleSet(path.resolve(import.meta.dir, '../List/non_ip/global.conf'), proxySet, proxyKeywords),
|
||||
processLocalRuleSet(path.resolve(import.meta.dir, '../List/non_ip/global_plus.conf'), proxySet, proxyKeywords),
|
||||
processLocalRuleSet(path.resolve(import.meta.dir, '../List/non_ip/my_proxy.conf'), proxySet, proxyKeywords),
|
||||
processLocalRuleSet(path.resolve(import.meta.dir, '../List/non_ip/my_plus.conf'), proxySet, proxyKeywords),
|
||||
processLocalRuleSet(path.resolve(import.meta.dir, '../List/non_ip/stream.conf'), proxySet, proxyKeywords),
|
||||
|
||||
@ -194,10 +194,6 @@ export const buildRejectDomainSet = task(import.meta.path, async (span) => {
|
||||
span,
|
||||
rejectDomainsStats.map(([domain, count]) => `${domain}${' '.repeat(100 - domain.length)}${count}`),
|
||||
path.resolve(import.meta.dir, '../List/internal/reject-stats.txt')
|
||||
),
|
||||
Bun.write(
|
||||
path.resolve(import.meta.dir, '../List/domainset/reject_sukka.conf'),
|
||||
'# The file has been deprecated, its content has been merged into the main `reject` domainset.\n'
|
||||
)
|
||||
]);
|
||||
});
|
||||
|
||||
@ -38,7 +38,6 @@ export const buildSSPanelUIMAppProfile = task(import.meta.path, async (span) =>
|
||||
streamDomains,
|
||||
steamDomains,
|
||||
globalDomains,
|
||||
globalPlusDomains,
|
||||
telegramDomains,
|
||||
lanDomains,
|
||||
domesticCidrs,
|
||||
@ -61,7 +60,6 @@ export const buildSSPanelUIMAppProfile = task(import.meta.path, async (span) =>
|
||||
readFileIntoProcessedArray(path.resolve(import.meta.dir, '../Source/domainset/steam.conf')).then(surgeDomainsetToClashRuleset),
|
||||
// global - domains
|
||||
readFileIntoProcessedArray(path.resolve(import.meta.dir, '../Source/non_ip/global.conf')).then(surgeRulesetToClashClassicalTextRuleset),
|
||||
readFileIntoProcessedArray(path.resolve(import.meta.dir, '../Source/non_ip/global_plus.conf')).then(surgeRulesetToClashClassicalTextRuleset),
|
||||
readFileIntoProcessedArray(path.resolve(import.meta.dir, '../Source/non_ip/telegram.conf')).then(surgeRulesetToClashClassicalTextRuleset),
|
||||
// lan - domains
|
||||
readFileIntoProcessedArray(path.resolve(import.meta.dir, '../Source/non_ip/lan.conf')),
|
||||
@ -99,7 +97,6 @@ export const buildSSPanelUIMAppProfile = task(import.meta.path, async (span) =>
|
||||
steamDomains,
|
||||
[
|
||||
...globalDomains,
|
||||
...globalPlusDomains,
|
||||
...telegramDomains
|
||||
],
|
||||
lanDomains,
|
||||
|
||||
@ -27,6 +27,7 @@ import { downloadMockAssets } from './download-mock-assets';
|
||||
import { buildCloudMounterRules } from './build-cloudmounter-rules';
|
||||
|
||||
import { createSpan, printTraceResult } from './trace';
|
||||
import { buildDeprecateFiles } from './build-deprecate-files';
|
||||
|
||||
(async () => {
|
||||
console.log('Bun version:', Bun.version, Bun.revision);
|
||||
@ -71,6 +72,8 @@ import { createSpan, printTraceResult } from './trace';
|
||||
|
||||
const buildCloudMounterRulesPromise = downloadPreviousBuildPromise.then(() => buildCloudMounterRules(rootSpan));
|
||||
|
||||
const buildDeprecateFilesPromise = downloadPreviousBuildPromise.then(() => buildDeprecateFiles(rootSpan));
|
||||
|
||||
await Promise.all([
|
||||
downloadPreviousBuildPromise,
|
||||
buildCommonPromise,
|
||||
@ -92,6 +95,7 @@ import { createSpan, printTraceResult } from './trace';
|
||||
buildMicrosoftCdnPromise,
|
||||
buildSSPanelUIMAppProfilePromise,
|
||||
buildCloudMounterRulesPromise,
|
||||
buildDeprecateFilesPromise,
|
||||
downloadMockAssetsPromise
|
||||
]);
|
||||
|
||||
|
||||
@ -90,7 +90,6 @@ export const parseGfwList = async () => {
|
||||
|
||||
await Promise.all([
|
||||
runAgainstRuleset(path.resolve(import.meta.dir, '../Source/non_ip/global.conf')),
|
||||
runAgainstRuleset(path.resolve(import.meta.dir, '../Source/non_ip/global_plus.conf')),
|
||||
runAgainstRuleset(path.resolve(import.meta.dir, '../List/non_ip/stream.conf'))
|
||||
]);
|
||||
|
||||
|
||||
@ -549,7 +549,6 @@ rules:
|
||||
```ini
|
||||
RULE-SET,https://ruleset.skk.moe/List/non_ip/domestic.conf,[Replace with your policy]
|
||||
RULE-SET,https://ruleset.skk.moe/List/non_ip/direct.conf,[Replace with your policy]
|
||||
RULE-SET,https://ruleset.skk.moe/List/non_ip/global_plus.conf,[Replace with your policy]
|
||||
RULE-SET,https://ruleset.skk.moe/List/non_ip/global.conf,PROXY
|
||||
RULE-SET,https://ruleset.skk.moe/List/ip/domestic.conf,[Replace with your policy]
|
||||
```
|
||||
@ -572,13 +571,6 @@ rule-providers:
|
||||
interval: 43200
|
||||
url: https://ruleset.skk.moe/Clash/non_ip/direct.txt
|
||||
path: ./sukkaw_ruleset/direct_non_ip.txt
|
||||
global_plus_non_ip:
|
||||
type: http
|
||||
behavior: classical
|
||||
format: text
|
||||
interval: 43200
|
||||
url: https://ruleset.skk.moe/Clash/non_ip/global_plus.txt
|
||||
path: ./sukkaw_ruleset/global_plus_non_ip.txt
|
||||
global_non_ip:
|
||||
type: http
|
||||
behavior: classical
|
||||
@ -597,7 +589,6 @@ rule-providers:
|
||||
rules:
|
||||
- RULE-SET,domestic_non_ip,[Replace with your policy]
|
||||
- RULE-SET,direct_non_ip,[Replace with your policy]
|
||||
- RULE-SET,global_plus_non_ip,[Replace with your policy]
|
||||
- RULE-SET,global_non_ip,[Replace with your policy]
|
||||
- RULE-SET,domestic_ip,[Replace with your policy]
|
||||
```
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
# $ meta_title Sukka's Ruleset - Deprecated
|
||||
# $ meta_description The file has been deprecated, its content has been merged into the main `reject` domainset.
|
||||
@ -1,2 +0,0 @@
|
||||
# $ meta_title Sukka's Ruleset - Deprecated
|
||||
# $ meta_description This file has been merged with global.conf
|
||||
Loading…
x
Reference in New Issue
Block a user