@@ -219,12 +219,12 @@ function convertProxy(p: Proxy): SingboxOutbound | null {
219219}
220220
221221const COUNTRY_GROUPS : Array < { tag : string ; re : RegExp } > = [
222- { tag : '🇭🇰 香港 ' , re : / H K _ \d + / } ,
223- { tag : '🇯🇵 日本 ' , re : / J P _ \d + / } ,
224- { tag : '🇺🇸 美国 ' , re : / U S _ \d + / } ,
225- { tag : '🇨🇳 台湾 ' , re : / T W _ \d + / } ,
226- { tag : '🇸🇬 新加坡 ' , re : / S G _ \d + / } ,
227- { tag : '🇰🇷 韩国 ' , re : / K R _ \d + / } ,
222+ { tag : '🇭🇰 香港节点 ' , re : / H K _ \d + / } ,
223+ { tag : '🇯🇵 日本节点 ' , re : / J P _ \d + / } ,
224+ { tag : '🇺🇲 美国节点 ' , re : / U S _ \d + / } ,
225+ { tag : '🇨🇳 台湾节点 ' , re : / T W _ \d + / } ,
226+ { tag : '🇸🇬 狮城节点 ' , re : / S G _ \d + / } ,
227+ { tag : '🇰🇷 韩国节点 ' , re : / K R _ \d + / } ,
228228] ;
229229
230230function mihomoToSingbox ( proxies : Proxy [ ] ) : Record < string , unknown > {
@@ -258,18 +258,24 @@ function mihomoToSingbox(proxies: Proxy[]): Record<string, unknown> {
258258
259259 const autoGroup : SingboxOutbound = {
260260 type : 'urltest' ,
261- tag : 'auto ' ,
261+ tag : '♻️ 自动选择 ' ,
262262 outbounds : allTags ,
263263 url : 'https://www.gstatic.com/generate_204' ,
264264 interval : '3m' ,
265265 tolerance : 50 ,
266266 } ;
267267
268+ const manualGroup : SingboxOutbound = {
269+ type : 'selector' ,
270+ tag : '🔀 手动切换' ,
271+ outbounds : [ ...allTags , 'direct' ] ,
272+ } ;
273+
268274 const selector : SingboxOutbound = {
269275 type : 'selector' ,
270- tag : 'proxy ' ,
271- outbounds : [ 'auto ' , ... groupTags , ...allTags , 'direct' ] ,
272- default : 'auto ' ,
276+ tag : '🚀 代理入口 ' ,
277+ outbounds : [ '♻️ 自动选择 ' , '🔀 手动切换' , ...groupTags , 'direct' ] ,
278+ default : '♻️ 自动选择 ' ,
273279 } ;
274280
275281 return {
@@ -279,7 +285,7 @@ function mihomoToSingbox(proxies: Proxy[]): Record<string, unknown> {
279285 } ,
280286 dns : {
281287 servers : [
282- { tag : 'dns_proxy' , address : 'https://1.1.1.1/dns-query' , address_resolver : 'dns_resolver' , strategy : 'ipv4_only' , detour : 'proxy ' } ,
288+ { tag : 'dns_proxy' , address : 'https://1.1.1.1/dns-query' , address_resolver : 'dns_resolver' , strategy : 'ipv4_only' , detour : '🚀 代理入口 ' } ,
283289 { tag : 'dns_direct' , address : 'https://dns.alidns.com/dns-query' , address_resolver : 'dns_resolver' , strategy : 'ipv4_only' , detour : 'direct' } ,
284290 { tag : 'dns_resolver' , address : '223.5.5.5' , detour : 'direct' } ,
285291 { tag : 'dns_block' , address : 'rcode://success' } ,
@@ -306,6 +312,7 @@ function mihomoToSingbox(proxies: Proxy[]): Record<string, unknown> {
306312 outbounds : [
307313 selector ,
308314 autoGroup ,
315+ manualGroup ,
309316 ...countryGroups ,
310317 { type : 'direct' , tag : 'direct' } ,
311318 { type : 'block' , tag : 'block' } ,
@@ -319,16 +326,16 @@ function mihomoToSingbox(proxies: Proxy[]): Record<string, unknown> {
319326 { rule_set : 'geosite-category-ads-all' , outbound : 'block' } ,
320327 { rule_set : 'geosite-cn' , outbound : 'direct' } ,
321328 { rule_set : 'geoip-cn' , outbound : 'direct' } ,
322- { rule_set : 'geosite-geolocation-!cn' , outbound : 'proxy ' } ,
329+ { rule_set : 'geosite-geolocation-!cn' , outbound : '🚀 代理入口 ' } ,
323330 ] ,
324331 rule_set : [
325- { tag : 'geosite-cn' , type : 'remote' , format : 'binary' , url : 'https://raw.githubusercontent.com/ MetaCubeX/meta-rules-dat/ sing/geo/geosite/cn.srs' , download_detour : 'direct' } ,
326- { tag : 'geosite-geolocation-!cn' , type : 'remote' , format : 'binary' , url : 'https://raw.githubusercontent.com/ MetaCubeX/meta-rules-dat/ sing/geo/geosite/geolocation-!cn.srs' , download_detour : 'direct' } ,
327- { tag : 'geosite-category-ads-all' , type : 'remote' , format : 'binary' , url : 'https://raw.githubusercontent.com/ MetaCubeX/meta-rules-dat/ sing/geo/geosite/category-ads-all.srs' , download_detour : 'direct' } ,
328- { tag : 'geoip-cn' , type : 'remote' , format : 'binary' , url : 'https://raw.githubusercontent.com/ MetaCubeX/meta-rules-dat/ sing/geo/geoip/cn.srs' , download_detour : 'direct' } ,
332+ { tag : 'geosite-cn' , type : 'remote' , format : 'binary' , url : 'https://testingcf.jsdelivr.net/gh/ MetaCubeX/meta-rules-dat@ sing/geo/geosite/cn.srs' , download_detour : 'direct' } ,
333+ { tag : 'geosite-geolocation-!cn' , type : 'remote' , format : 'binary' , url : 'https://testingcf.jsdelivr.net/gh/ MetaCubeX/meta-rules-dat@ sing/geo/geosite/geolocation-!cn.srs' , download_detour : 'direct' } ,
334+ { tag : 'geosite-category-ads-all' , type : 'remote' , format : 'binary' , url : 'https://testingcf.jsdelivr.net/gh/ MetaCubeX/meta-rules-dat@ sing/geo/geosite/category-ads-all.srs' , download_detour : 'direct' } ,
335+ { tag : 'geoip-cn' , type : 'remote' , format : 'binary' , url : 'https://testingcf.jsdelivr.net/gh/ MetaCubeX/meta-rules-dat@ sing/geo/geoip/cn.srs' , download_detour : 'direct' } ,
329336 ] ,
330337 auto_detect_interface : true ,
331- final : 'proxy ' ,
338+ final : '🚀 代理入口 ' ,
332339 } ,
333340 } ;
334341}
@@ -345,6 +352,41 @@ function fixAiRules(rules: string[]): string[] {
345352 return rules . map ( fixAiName ) ;
346353}
347354
355+ const BEST_RENAME_GROUPS : Record < string , string > = {
356+ '🚀 节点选择' : '🚀 代理入口' ,
357+ '🚀 手动切换' : '🔀 手动切换' ,
358+ } ;
359+
360+ const REGION_GROUP_NAMES = new Set ( [ '🇭🇰 香港节点' , '🇯🇵 日本节点' , '🇺🇲 美国节点' , '🇨🇳 台湾节点' , '🇸🇬 狮城节点' , '🇰🇷 韩国节点' ] ) ;
361+ const DROP_GROUP_NAMES = new Set ( [ '🎥 奈飞节点' ] ) ;
362+
363+ function reorderBestGroups ( groups : Record < string , unknown > [ ] ) : Record < string , unknown > [ ] {
364+ const head = groups . slice ( 0 , 3 ) ;
365+ const regions = groups . filter ( g => REGION_GROUP_NAMES . has ( String ( g . name ) ) ) ;
366+ const rest = groups . slice ( 3 ) . filter ( g =>
367+ ! REGION_GROUP_NAMES . has ( String ( g . name ) ) && ! DROP_GROUP_NAMES . has ( String ( g . name ) ) ,
368+ ) ;
369+ return [ ...head , ...regions , ...rest ] . map ( g => {
370+ const newName = BEST_RENAME_GROUPS [ String ( g . name ) ] ;
371+ const proxies = g . proxies as string [ ] | undefined ;
372+ const renamedProxies = proxies ?. map ( p => BEST_RENAME_GROUPS [ p ] ?? p ) ;
373+ return {
374+ ...g ,
375+ ...( newName ? { name : newName } : { } ) ,
376+ ...( renamedProxies ? { proxies : renamedProxies } : { } ) ,
377+ } ;
378+ } ) ;
379+ }
380+
381+ function renameBestRules ( rules : string [ ] ) : string [ ] {
382+ return rules . filter ( r => ! DROP_GROUP_NAMES . has ( r . split ( ',' ) . pop ( ) ! ) ) . map ( r => {
383+ for ( const [ from , to ] of Object . entries ( BEST_RENAME_GROUPS ) ) {
384+ if ( r . includes ( from ) ) return r . replace ( from , to ) ;
385+ }
386+ return r ;
387+ } ) ;
388+ }
389+
348390// --- main ---
349391
350392function main ( ) {
@@ -400,8 +442,8 @@ function main() {
400442 }
401443
402444 // best1/best2 outputs (both use acl4ssr template with OpenAi→AI平台 fix)
403- const fixedGroups = acl4ssrTemplate ? fixAiGroupName ( acl4ssrTemplate [ 'proxy-groups' ] as Record < string , unknown > [ ] ) : null ;
404- const fixedRules = acl4ssrTemplate ? fixAiRules ( acl4ssrTemplate . rules as string [ ] ) : null ;
445+ const fixedGroups = acl4ssrTemplate ? reorderBestGroups ( fixAiGroupName ( acl4ssrTemplate [ 'proxy-groups' ] as Record < string , unknown > [ ] ) ) : null ;
446+ const fixedRules = acl4ssrTemplate ? renameBestRules ( fixAiRules ( acl4ssrTemplate . rules as string [ ] ) ) : null ;
405447
406448 const bestBase = {
407449 'mixed-port' : 7890 ,
0 commit comments