Bladeren bron

fallback outbound in balancer

Co-Authored-By: Alireza Ahmadi <[email protected]>
mhsanaei 4 maanden geleden
bovenliggende
commit
816adfc3ea
2 gewijzigde bestanden met toevoegingen van 21 en 9 verwijderingen
  1. 9 5
      web/html/xui/xray.html
  2. 12 4
      web/html/xui/xray_balancer_modal.html

+ 9 - 5
web/html/xui/xray.html

@@ -1268,7 +1268,8 @@
                     balancer: {
                         tag: '',
                         strategy: 'random',
-                        selector: []
+                        selector: [],
+                        fallbackTag: ''
                     },
                     confirm: (balancer) => {
                         balancerModal.loading();
@@ -1278,7 +1279,8 @@
                         }
                         let tmpBalancer = {
                             'tag': balancer.tag,
-                            'selector': balancer.selector
+                            'selector': balancer.selector,
+                            'fallbackTag': balancer.fallbackTag
                         };
                         if (balancer.strategy && balancer.strategy != 'random') {
                             tmpBalancer.strategy = {
@@ -1308,7 +1310,8 @@
 
                         let tmpBalancer = {
                             'tag': balancer.tag,
-                            'selector': balancer.selector
+                            'selector': balancer.selector,
+                            'fallbackTag': balancer.fallbackTag
                         };
 
                         // Remove old tag
@@ -1377,7 +1380,7 @@
                 this.changeObsCode();
             },
             deleteBalancer(index) {
-                let newTemplateSettings = { ...this.templateSettings };
+                newTemplateSettings = this.templateSettings;
 
                 // Remove from balancers
                 const removedBalancer = this.balancersData.splice(index, 1)[0];
@@ -1623,7 +1626,8 @@
                                 'key': index,
                                 'tag': o.tag ? o.tag : "",
                                 'strategy': o.strategy?.type ?? "random",
-                                'selector': o.selector ? o.selector : []
+                                'selector': o.selector ? o.selector : [],
+                                'fallbackTag': o.fallbackTag?? '',
                             });
                         });
                     }

+ 12 - 4
web/html/xui/xray_balancer_modal.html

@@ -25,13 +25,19 @@
                 <a-select-option value="leastPing">Least Ping</a-select-option>
             </a-select>
         </a-form-item>
-        <a-form-item label='{{ i18n "pages.xray.balancer.balancerSelectors" }}' has-feedback 
-        :validate-status="balancerModal.emptySelector? 'warning' : 'success'">
+        <a-form-item label='{{ i18n "pages.xray.balancer.balancerSelectors" }}' has-feedback
+            :validate-status="balancerModal.emptySelector? 'warning' : 'success'">
             <a-select v-model="balancerModal.balancer.selector" mode="tags" @change="balancerModal.checkSelector()"
                 :dropdown-class-name="themeSwitcher.currentTheme">
                 <a-select-option v-for="tag in balancerModal.outboundTags" :value="tag">[[ tag ]]</a-select-option>
             </a-select>
         </a-form-item>
+        <a-form-item label="Fallback">
+            <a-select v-model="balancerModal.balancer.fallbackTag" clearable
+                :dropdown-class-name="themeSwitcher.currentTheme">
+                <a-select-option v-for="tag in [ '', ...balancerModal.outboundTags]" :value="tag">[[ tag ]]</a-select-option>
+            </a-select>
+        </a-form-item>
         </table>
     </a-form>
 </a-modal>
@@ -48,7 +54,8 @@
         balancer: {
             tag: '',
             strategy: 'random',
-            selector: []
+            selector: [],
+            fallbackTag: ''
         },
         outboundTags: [],
         balancerTags:[],
@@ -71,7 +78,8 @@
                 balancerModal.balancer = {
                     tag: '',
                     strategy: 'random',
-                    selector: []
+                    selector: [],
+                    fallbackTag: ''
                 };
             }
             this.balancerTags = balancerTags.filter((tag) => tag != balancer.tag);