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