mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 09:10:35 +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 type { Span } from './trace';
|
||||||
import { task } from './trace';
|
import { task } from './trace';
|
||||||
import { SHARED_DESCRIPTION } from './lib/constants';
|
import { SHARED_DESCRIPTION } from './lib/constants';
|
||||||
|
import picocolors from 'picocolors';
|
||||||
|
|
||||||
const MAGIC_COMMAND_SKIP = '# $ custom_build_script';
|
const MAGIC_COMMAND_SKIP = '# $ custom_build_script';
|
||||||
const MAGIC_COMMAND_TITLE = '# $ meta_title ';
|
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));
|
promises.push(transformRuleset(span, entry.fullpath(), relativePath));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.error(picocolors.red(`[build-comman] Unknown file: ${relativePath}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all(promises);
|
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(),
|
getGorhillPublicSuffixPromise(),
|
||||||
processLocalRuleSet(path.resolve(import.meta.dir, '../List/non_ip/cdn.conf'), proxySet, proxyKeywords),
|
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.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_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/my_plus.conf'), proxySet, proxyKeywords),
|
||||||
processLocalRuleSet(path.resolve(import.meta.dir, '../List/non_ip/stream.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,
|
span,
|
||||||
rejectDomainsStats.map(([domain, count]) => `${domain}${' '.repeat(100 - domain.length)}${count}`),
|
rejectDomainsStats.map(([domain, count]) => `${domain}${' '.repeat(100 - domain.length)}${count}`),
|
||||||
path.resolve(import.meta.dir, '../List/internal/reject-stats.txt')
|
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,
|
streamDomains,
|
||||||
steamDomains,
|
steamDomains,
|
||||||
globalDomains,
|
globalDomains,
|
||||||
globalPlusDomains,
|
|
||||||
telegramDomains,
|
telegramDomains,
|
||||||
lanDomains,
|
lanDomains,
|
||||||
domesticCidrs,
|
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),
|
readFileIntoProcessedArray(path.resolve(import.meta.dir, '../Source/domainset/steam.conf')).then(surgeDomainsetToClashRuleset),
|
||||||
// global - domains
|
// 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.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),
|
readFileIntoProcessedArray(path.resolve(import.meta.dir, '../Source/non_ip/telegram.conf')).then(surgeRulesetToClashClassicalTextRuleset),
|
||||||
// lan - domains
|
// lan - domains
|
||||||
readFileIntoProcessedArray(path.resolve(import.meta.dir, '../Source/non_ip/lan.conf')),
|
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,
|
steamDomains,
|
||||||
[
|
[
|
||||||
...globalDomains,
|
...globalDomains,
|
||||||
...globalPlusDomains,
|
|
||||||
...telegramDomains
|
...telegramDomains
|
||||||
],
|
],
|
||||||
lanDomains,
|
lanDomains,
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import { downloadMockAssets } from './download-mock-assets';
|
|||||||
import { buildCloudMounterRules } from './build-cloudmounter-rules';
|
import { buildCloudMounterRules } from './build-cloudmounter-rules';
|
||||||
|
|
||||||
import { createSpan, printTraceResult } from './trace';
|
import { createSpan, printTraceResult } from './trace';
|
||||||
|
import { buildDeprecateFiles } from './build-deprecate-files';
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
console.log('Bun version:', Bun.version, Bun.revision);
|
console.log('Bun version:', Bun.version, Bun.revision);
|
||||||
@ -71,6 +72,8 @@ import { createSpan, printTraceResult } from './trace';
|
|||||||
|
|
||||||
const buildCloudMounterRulesPromise = downloadPreviousBuildPromise.then(() => buildCloudMounterRules(rootSpan));
|
const buildCloudMounterRulesPromise = downloadPreviousBuildPromise.then(() => buildCloudMounterRules(rootSpan));
|
||||||
|
|
||||||
|
const buildDeprecateFilesPromise = downloadPreviousBuildPromise.then(() => buildDeprecateFiles(rootSpan));
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
downloadPreviousBuildPromise,
|
downloadPreviousBuildPromise,
|
||||||
buildCommonPromise,
|
buildCommonPromise,
|
||||||
@ -92,6 +95,7 @@ import { createSpan, printTraceResult } from './trace';
|
|||||||
buildMicrosoftCdnPromise,
|
buildMicrosoftCdnPromise,
|
||||||
buildSSPanelUIMAppProfilePromise,
|
buildSSPanelUIMAppProfilePromise,
|
||||||
buildCloudMounterRulesPromise,
|
buildCloudMounterRulesPromise,
|
||||||
|
buildDeprecateFilesPromise,
|
||||||
downloadMockAssetsPromise
|
downloadMockAssetsPromise
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@ -90,7 +90,6 @@ export const parseGfwList = async () => {
|
|||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
runAgainstRuleset(path.resolve(import.meta.dir, '../Source/non_ip/global.conf')),
|
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'))
|
runAgainstRuleset(path.resolve(import.meta.dir, '../List/non_ip/stream.conf'))
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@ -549,7 +549,6 @@ rules:
|
|||||||
```ini
|
```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/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/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/non_ip/global.conf,PROXY
|
||||||
RULE-SET,https://ruleset.skk.moe/List/ip/domestic.conf,[Replace with your policy]
|
RULE-SET,https://ruleset.skk.moe/List/ip/domestic.conf,[Replace with your policy]
|
||||||
```
|
```
|
||||||
@ -572,13 +571,6 @@ rule-providers:
|
|||||||
interval: 43200
|
interval: 43200
|
||||||
url: https://ruleset.skk.moe/Clash/non_ip/direct.txt
|
url: https://ruleset.skk.moe/Clash/non_ip/direct.txt
|
||||||
path: ./sukkaw_ruleset/direct_non_ip.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:
|
global_non_ip:
|
||||||
type: http
|
type: http
|
||||||
behavior: classical
|
behavior: classical
|
||||||
@ -597,7 +589,6 @@ rule-providers:
|
|||||||
rules:
|
rules:
|
||||||
- RULE-SET,domestic_non_ip,[Replace with your policy]
|
- RULE-SET,domestic_non_ip,[Replace with your policy]
|
||||||
- RULE-SET,direct_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,global_non_ip,[Replace with your policy]
|
||||||
- RULE-SET,domestic_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