mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-05-13 15:06:46 +00:00
add loopback and dns servers tag to inbound lists in RuleFormModal
This commit is contained in:
parent
8834e5fbbe
commit
cd5f9baf99
3 changed files with 25 additions and 23 deletions
|
|
@ -34,7 +34,6 @@ const props = defineProps({
|
|||
open: { type: Boolean, default: false },
|
||||
outbound: { type: Object, default: null },
|
||||
existingTags: { type: Array, default: () => [] },
|
||||
inboundTags: { type: Array, default: () => [] },
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:open', 'confirm']);
|
||||
|
|
@ -318,10 +317,8 @@ function regenerateWgKeys() {
|
|||
<!-- ============== Loopback ============== -->
|
||||
<template v-if="isLoopback">
|
||||
<a-form-item label="Inbound tag">
|
||||
<a-auto-complete v-model:value="outbound.settings.inboundTag"
|
||||
:options="inboundTags.map((tag) => ({ value: tag }))"
|
||||
:filter-option="(input, option) => option.value.toLowerCase().includes(input.toLowerCase())"
|
||||
placeholder="tag of an existing inbound to re-route into" />
|
||||
<a-input v-model:value="outbound.settings.inboundTag"
|
||||
placeholder="inbound tag using in routing rules" />
|
||||
</a-form-item>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -35,15 +35,6 @@ const props = defineProps({
|
|||
isMobile: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const inboundTagOptions = computed(() => {
|
||||
const out = new Set();
|
||||
for (const ib of props.templateSettings?.inbounds || []) {
|
||||
if (ib.tag) out.add(ib.tag);
|
||||
}
|
||||
for (const t of props.inboundTags || []) out.add(t);
|
||||
return [...out];
|
||||
});
|
||||
|
||||
const emit = defineEmits(['reset-traffic', 'test', 'test-all', 'show-warp', 'show-nord', 'delete']);
|
||||
|
||||
const testMode = ref('tcp');
|
||||
|
|
@ -443,7 +434,7 @@ const rows = computed(() => {
|
|||
</a-table>
|
||||
|
||||
<OutboundFormModal v-model:open="modalOpen" :outbound="editingOutbound" :existing-tags="existingTags"
|
||||
:inbound-tags="inboundTagOptions" @confirm="onConfirm" />
|
||||
@confirm="onConfirm" />
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -65,18 +65,32 @@ const editingRule = ref(null);
|
|||
const editingIndex = ref(null);
|
||||
|
||||
const inboundTagOptions = computed(() => {
|
||||
const out = new Set();
|
||||
const seen = new Set();
|
||||
const out = [];
|
||||
|
||||
function pushUnique(tag) {
|
||||
if (!tag) return;
|
||||
if (seen.has(tag)) return;
|
||||
seen.add(tag);
|
||||
out.push(tag);
|
||||
}
|
||||
|
||||
for (const ib of props.templateSettings?.inbounds || []) {
|
||||
if (ib.tag) out.add(ib.tag);
|
||||
pushUnique(ib.tag);
|
||||
}
|
||||
for (const t of props.inboundTags || []) {
|
||||
pushUnique(t);
|
||||
}
|
||||
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);
|
||||
const rt = ob?.reverse?.tag || ob?.settings?.reverse?.tag || ob?.settings?.inboundTag;
|
||||
pushUnique(rt);
|
||||
}
|
||||
// dnsTag if DNS is configured.
|
||||
const dt = props.templateSettings?.dns?.tag;
|
||||
if (dt) out.add(dt);
|
||||
pushUnique(props.templateSettings?.dns?.tag);
|
||||
|
||||
for (const s of props.templateSettings?.dns?.servers || []) {
|
||||
if (typeof s === 'object' && s?.tag) pushUnique(s.tag);
|
||||
}
|
||||
|
||||
return [...out];
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue