382
382
</ a-col >
383
383
</ a-row >
384
384
< a-collapse v-if ="enableDirect " style ="margin-top: 14px; ">
385
- < a-collapse-panel header ='{{ i18n "pages.xray.directips"}} '>
386
- < a-list-item style ="padding: 10px 20px ">
387
- < a-checkbox-group v-model ="directIPs " :options ="IPsOptions "> </ a-checkbox-group >
385
+ < a-collapse-panel header ='{{ i18n "pages.settings.direct"}} '>
386
+ < a-list-item >
387
+ < a-row style ="padding: 0 20px ">
388
+ < a-col :lg ="24 " :xl ="12 ">
389
+ < a-list-item-meta
390
+ title ='{{ i18n "pages.xray.directips" }} '/>
391
+ </ a-col >
392
+ < a-col :lg ="24 " :xl ="12 ">
393
+ < a-select mode ="tags " style ="width: 100% "
394
+ v-model ="directIPs "
395
+ :dropdown-class-name ="themeSwitcher.currentTheme ">
396
+ < a-select-option :value ="p.value " :label ="p.label "
397
+ v-for ="p in directIPsOptions "> [[ p.label ]]
398
+ </ a-select-option >
399
+ </ a-select >
400
+ </ a-col >
401
+ </ a-row >
388
402
</ a-list-item >
389
- </ a-collapse-panel >
390
- < a-collapse-panel header ='{{ i18n "pages.xray.directdomains"}} '>
391
- < a-list-item style ="padding: 10px 20px ">
392
- < a-checkbox-group v-model ="directDomains " :options ="DomainsOptions "> </ a-checkbox-group >
403
+ < a-list-item >
404
+ < a-row style ="padding: 0 20px ">
405
+ < a-col :lg ="24 " :xl ="12 ">
406
+ < a-list-item-meta
407
+ title ='{{ i18n "pages.xray.directdomains" }} '/>
408
+ </ a-col >
409
+ < a-col :lg ="24 " :xl ="12 ">
410
+ < a-select mode ="tags " style ="width: 100% "
411
+ v-model ="directDomains "
412
+ :dropdown-class-name ="themeSwitcher.currentTheme ">
413
+ < a-select-option :value ="p.value " :label ="p.label "
414
+ v-for ="p in diretDomainsOptions "> [[ p.label ]]
415
+ </ a-select-option >
416
+ </ a-select >
417
+ </ a-col >
418
+ </ a-row >
393
419
</ a-list-item >
394
420
</ a-collapse-panel >
395
421
</ a-collapse >
477
503
]
478
504
} ,
479
505
] ,
480
- IPsOptions : [
481
- { label : 'Private IP' , value : 'private' } ,
482
- { label : '🇮🇷 Iran' , value : 'ir' } ,
483
- { label : '🇨🇳 China' , value : 'cn' } ,
484
- { label : '🇷🇺 Russia' , value : 'ru' } ,
485
- { label : '🇻🇳 Vietnam' , value : 'vn' } ,
486
- { label : '🇪🇸 Spain' , value : 'es' } ,
487
- { label : '🇮🇩 Indonesia' , value : 'id' } ,
488
- { label : '🇺🇦 Ukraine' , value : 'ua' } ,
489
- { label : '🇹🇷 Türkiye' , value : 'tr' } ,
490
- { label : '🇧🇷 Brazil' , value : 'br' } ,
506
+ directIPsOptions : [
507
+ { label : 'Private IP' , value : 'geoip: private' } ,
508
+ { label : '🇮🇷 Iran' , value : 'geoip: ir' } ,
509
+ { label : '🇨🇳 China' , value : 'geoip: cn' } ,
510
+ { label : '🇷🇺 Russia' , value : 'geoip: ru' } ,
511
+ { label : '🇻🇳 Vietnam' , value : 'geoip: vn' } ,
512
+ { label : '🇪🇸 Spain' , value : 'geoip: es' } ,
513
+ { label : '🇮🇩 Indonesia' , value : 'geoip: id' } ,
514
+ { label : '🇺🇦 Ukraine' , value : 'geoip: ua' } ,
515
+ { label : '🇹🇷 Türkiye' , value : 'geoip: tr' } ,
516
+ { label : '🇧🇷 Brazil' , value : 'geoip: br' } ,
491
517
] ,
492
- DomainsOptions : [
493
- { label : '🇮🇷 Iran' , value : 'ir' } ,
494
- { label : '🇨🇳 China' , value : 'cn' } ,
495
- { label : '🇷🇺 Russia' , value : 'ru' } ,
496
- { label : 'Apple' , value : 'apple' } ,
497
- { label : 'Meta' , value : 'meta' } ,
498
- { label : 'Google' , value : 'google' } ,
518
+ diretDomainsOptions : [
519
+ { label : 'Private DNS' , value : 'geosite:private' } ,
520
+ { label : '🇮🇷 Iran' , value : 'geosite:category-ir' } ,
521
+ { label : '🇨🇳 China' , value : 'geosite:cn' } ,
522
+ { label : '🇷🇺 Russia' , value : 'geosite:category-ru' } ,
523
+ { label : 'Apple' , value : 'geosite:apple' } ,
524
+ { label : 'Meta' , value : 'geosite:meta' } ,
525
+ { label : 'Google' , value : 'geosite:google' } ,
499
526
] ,
500
527
get remarkModel ( ) {
501
528
rm = this . allSetting . remarkModel ;
753
780
const rules = JSON . parse ( this . allSetting . subJsonRules ) ;
754
781
if ( ! Array . isArray ( rules ) ) return [ ] ;
755
782
const ipRule = rules . find ( r => r . ip ) ;
756
- return ipRule ?. ip . map ( d => d . replace ( "geoip:" , "" ) ) ?? [ ] ;
783
+ return ipRule ?. ip ?? [ ] ;
757
784
} ,
758
785
set : function ( v ) {
759
786
let rules = JSON . parse ( this . allSetting . subJsonRules ) ;
767
794
768
795
rules [ ruleIndex ] . ip = [ ] ;
769
796
v . forEach ( d => {
770
- rules [ ruleIndex ] . ip . push ( "geoip:" + d ) ;
797
+ rules [ ruleIndex ] . ip . push ( d ) ;
771
798
} ) ;
772
799
}
773
800
this . allSetting . subJsonRules = JSON . stringify ( rules ) ;
779
806
const rules = JSON . parse ( this . allSetting . subJsonRules ) ;
780
807
if ( ! Array . isArray ( rules ) ) return [ ] ;
781
808
const domainRule = rules . find ( r => r . domain ) ;
782
- return domainRule ?. domain . map ( d => {
783
- if ( d . startsWith ( "geosite:category-" ) ) {
784
- return d . replace ( "geosite:category-" , "" ) ;
785
- }
786
- return d . replace ( "geosite:" , "" ) ;
787
- } )
788
- ?? [ ] ;
809
+ return domainRule ?. domain ?? [ ] ;
789
810
} ,
790
811
set : function ( v ) {
791
812
let rules = JSON . parse ( this . allSetting . subJsonRules ) ;
792
813
if ( ! Array . isArray ( rules ) ) return ;
793
-
794
814
if ( v . length == 0 ) {
795
815
rules = rules . filter ( r => ! r . domain ) ;
796
816
} else {
797
817
let ruleIndex = rules . findIndex ( r => r . domain ) ;
798
818
if ( ruleIndex == - 1 ) ruleIndex = rules . push ( this . defaultRules [ 0 ] ) - 1 ;
799
819
800
- rules [ ruleIndex ] . domain = [ ] ;
801
- v . forEach ( d => {
802
- let category = '' ;
803
- if ( [ "cn" , "apple" , "meta" , "google" ] . includes ( d ) ) {
804
- category = "" ;
805
- } else if ( [ "ru" , "ir" ] . includes ( d ) ) {
806
- category = "category-" ;
807
- }
808
- rules [ ruleIndex ] . domain . push ( "geosite:" + category + d ) ;
809
- } ) ;
820
+ rules [ ruleIndex ] . domain = v ;
810
821
}
811
822
this . allSetting . subJsonRules = JSON . stringify ( rules ) ;
812
823
}
839
850
} ) ;
840
851
</ script >
841
852
</ body >
842
- </ html >
853
+ </ html >
0 commit comments