Browse Source

fix(xray): surface reverse tags in routing and balancer dropdowns

Outbound reverse tags now appear as inbound options in routing rules
(#4199), and inbound-client reverse tags appear as outbounds in the
balancer selector (#4187). Both represent virtual endpoints created by
xray-core that the dropdowns previously missed.
MHSanaei 19 giờ trước cách đây
mục cha
commit
917f9b307e

+ 11 - 5
frontend/src/pages/xray/BalancersTab.vue

@@ -20,6 +20,7 @@ const { t } = useI18n();
 
 const props = defineProps({
   templateSettings: { type: Object, default: null },
+  clientReverseTags: { type: Array, default: () => [] },
 });
 
 const STRATEGY_LABELS = {
@@ -40,11 +41,16 @@ const rows = computed(() => {
   }));
 });
 
-const outboundTags = computed(
-  () => (props.templateSettings?.outbounds || [])
-    .filter((o) => o.tag)
-    .map((o) => o.tag),
-);
+const outboundTags = computed(() => {
+  const tags = new Set();
+  for (const o of props.templateSettings?.outbounds || []) {
+    if (o.tag) tags.add(o.tag);
+  }
+  for (const t of props.clientReverseTags || []) {
+    if (t) tags.add(t);
+  }
+  return [...tags];
+});
 
 // === Modal state ====================================================
 const modalOpen = ref(false);

+ 4 - 0
frontend/src/pages/xray/RoutingTab.vue

@@ -70,6 +70,10 @@ const inboundTagOptions = computed(() => {
     if (ib.tag) out.add(ib.tag);
   }
   for (const t of props.inboundTags || []) out.add(t);
+  for (const ob of props.templateSettings?.outbounds || []) {
+    const rt = ob?.reverse?.tag || ob?.settings?.reverse?.tag;
+    if (rt) out.add(rt);
+  }
   // dnsTag if DNS is configured.
   const dt = props.templateSettings?.dns?.tag;
   if (dt) out.add(dt);

+ 4 - 1
frontend/src/pages/xray/XrayPage.vue

@@ -306,7 +306,10 @@ function confirmRestart() {
                       <template #tab>
                         <ClusterOutlined /> <span>{{ t('pages.xray.Balancers') }}</span>
                       </template>
-                      <BalancersTab :template-settings="templateSettings" />
+                      <BalancersTab
+                        :template-settings="templateSettings"
+                        :client-reverse-tags="clientReverseTags"
+                      />
                     </a-tab-pane>
 
                     <a-tab-pane key="tpl-dns" class="tab-pane">