mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-05-18 12:05:53 +00:00
fix: disable balancer fallbackTag for random / roundRobin strategies
Xray-core's RandomStrategy and RoundRobinStrategy register a pending dependency on the Observatory feature whenever fallbackTag is non-empty. Since the panel only provisions observatory for leastPing / leastLoad balancers, picking roundRobin with a fallbackTag caused xray to fail boot with "not all dependencies are resolved". Disable the fallback field for the two strategies that cannot resolve it, and strip fallbackTag from the wire balancer as a defensive backstop for users who edit the JSON template directly.
This commit is contained in:
parent
79a9be7b22
commit
5cf8a08540
2 changed files with 15 additions and 3 deletions
|
|
@ -61,6 +61,16 @@ const isValid = computed(
|
||||||
() => !tagEmpty.value && !duplicateTag.value && !emptySelector.value,
|
() => !tagEmpty.value && !duplicateTag.value && !emptySelector.value,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const fallbackSupported = computed(
|
||||||
|
() => form.strategy === 'leastPing' || form.strategy === 'leastLoad',
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(() => form.strategy, (next) => {
|
||||||
|
if (next !== 'leastPing' && next !== 'leastLoad') {
|
||||||
|
form.fallbackTag = '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const tagValidateStatus = computed(() => {
|
const tagValidateStatus = computed(() => {
|
||||||
if (tagEmpty.value) return 'error';
|
if (tagEmpty.value) return 'error';
|
||||||
if (duplicateTag.value) return 'warning';
|
if (duplicateTag.value) return 'warning';
|
||||||
|
|
@ -111,8 +121,9 @@ const okText = computed(() =>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item label="Fallback">
|
<a-form-item label="Fallback"
|
||||||
<a-select v-model:value="form.fallbackTag" allow-clear>
|
:help="fallbackSupported ? '' : 'Available only with Least ping / Least load'">
|
||||||
|
<a-select v-model:value="form.fallbackTag" allow-clear :disabled="!fallbackSupported">
|
||||||
<a-select-option v-for="tag in ['', ...outboundTags]" :key="tag || '__empty'" :value="tag">
|
<a-select-option v-for="tag in ['', ...outboundTags]" :key="tag || '__empty'" :value="tag">
|
||||||
{{ tag || `(${t('none')})` }}
|
{{ tag || `(${t('none')})` }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
|
|
|
||||||
|
|
@ -145,10 +145,11 @@ function syncObservatories() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildWireBalancer(form) {
|
function buildWireBalancer(form) {
|
||||||
|
const supportsFallback = form.strategy === 'leastPing' || form.strategy === 'leastLoad';
|
||||||
const out = {
|
const out = {
|
||||||
tag: form.tag,
|
tag: form.tag,
|
||||||
selector: [...form.selector],
|
selector: [...form.selector],
|
||||||
fallbackTag: form.fallbackTag,
|
fallbackTag: supportsFallback ? form.fallbackTag : '',
|
||||||
};
|
};
|
||||||
if (form.strategy && form.strategy !== 'random') {
|
if (form.strategy && form.strategy !== 'random') {
|
||||||
out.strategy = { type: form.strategy };
|
out.strategy = { type: form.strategy };
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue