This commit is contained in:
lolka1333 2025-12-14 13:04:23 +01:00
parent c4e9f3d9f5
commit cf1b39c714
2 changed files with 31 additions and 19 deletions

View file

@ -75,16 +75,16 @@
<a-form-item label="Vision Seed"> <a-form-item label="Vision Seed">
<a-row :gutter="8"> <a-row :gutter="8">
<a-col :span="6"> <a-col :span="6">
<a-input-number v-model.number="inbound.settings.testseed[0]" :min="0" :max="9999" :style="{ width: '100%' }" placeholder="900" addon-before="[0]"></a-input-number> <a-input-number :value="(inbound.settings.testseed && inbound.settings.testseed[0] !== undefined) ? inbound.settings.testseed[0] : 900" @change="(val) => updateTestseed(0, val)" :min="0" :max="9999" :style="{ width: '100%' }" placeholder="900" addon-before="[0]"></a-input-number>
</a-col> </a-col>
<a-col :span="6"> <a-col :span="6">
<a-input-number v-model.number="inbound.settings.testseed[1]" :min="0" :max="9999" :style="{ width: '100%' }" placeholder="500" addon-before="[1]"></a-input-number> <a-input-number :value="(inbound.settings.testseed && inbound.settings.testseed[1] !== undefined) ? inbound.settings.testseed[1] : 500" @change="(val) => updateTestseed(1, val)" :min="0" :max="9999" :style="{ width: '100%' }" placeholder="500" addon-before="[1]"></a-input-number>
</a-col> </a-col>
<a-col :span="6"> <a-col :span="6">
<a-input-number v-model.number="inbound.settings.testseed[2]" :min="0" :max="9999" :style="{ width: '100%' }" placeholder="900" addon-before="[2]"></a-input-number> <a-input-number :value="(inbound.settings.testseed && inbound.settings.testseed[2] !== undefined) ? inbound.settings.testseed[2] : 900" @change="(val) => updateTestseed(2, val)" :min="0" :max="9999" :style="{ width: '100%' }" placeholder="900" addon-before="[2]"></a-input-number>
</a-col> </a-col>
<a-col :span="6"> <a-col :span="6">
<a-input-number v-model.number="inbound.settings.testseed[3]" :min="0" :max="9999" :style="{ width: '100%' }" placeholder="256" addon-before="[3]"></a-input-number> <a-input-number :value="(inbound.settings.testseed && inbound.settings.testseed[3] !== undefined) ? inbound.settings.testseed[3] : 256" @change="(val) => updateTestseed(3, val)" :min="0" :max="9999" :style="{ width: '100%' }" placeholder="256" addon-before="[3]"></a-input-number>
</a-col> </a-col>
</a-row> </a-row>
<a-space :size="8" :style="{ marginTop: '8px' }"> <a-space :size="8" :style="{ marginTop: '8px' }">

View file

@ -26,17 +26,12 @@
} else { } else {
this.inbound = new Inbound(); this.inbound = new Inbound();
} }
// Ensure testseed is initialized for VLESS protocol with vision flow // Always ensure testseed is initialized for VLESS protocol (even if vision flow is not set yet)
// Use Vue.set to ensure reactivity // This ensures Vue reactivity works properly
if (this.inbound.protocol === Protocols.VLESS && this.inbound.settings && this.inbound.settings.vlesses) { if (this.inbound.protocol === Protocols.VLESS && this.inbound.settings) {
const hasVisionFlow = this.inbound.settings.vlesses.some(c => c.flow === 'xtls-rprx-vision' || c.flow === 'xtls-rprx-vision-udp443'); if (!this.inbound.settings.testseed || !Array.isArray(this.inbound.settings.testseed) || this.inbound.settings.testseed.length < 4) {
if (hasVisionFlow && (!this.inbound.settings.testseed || !Array.isArray(this.inbound.settings.testseed) || this.inbound.settings.testseed.length < 4)) { // Create a new array to ensure Vue reactivity
// Use Vue.set to ensure the array is reactive this.inbound.settings.testseed = [900, 500, 900, 256].slice();
if (typeof this.$set === 'function') {
this.$set(this.inbound.settings, 'testseed', [900, 500, 900, 256]);
} else {
this.inbound.settings.testseed = [900, 500, 900, 256];
}
} }
} }
if (dbInbound) { if (dbInbound) {
@ -240,17 +235,34 @@
this.inbound.settings.encryption = 'none'; this.inbound.settings.encryption = 'none';
this.inbound.settings.selectedAuth = undefined; this.inbound.settings.selectedAuth = undefined;
}, },
updateTestseed(index, value) {
// Ensure testseed is initialized
if (!inModal.inbound.settings.testseed || !Array.isArray(inModal.inbound.settings.testseed)) {
inModal.inbound.settings.testseed = [900, 500, 900, 256];
}
// Ensure array has enough elements
while (inModal.inbound.settings.testseed.length <= index) {
inModal.inbound.settings.testseed.push(0);
}
// Update value using Vue.set for reactivity
if (this.$set) {
this.$set(inModal.inbound.settings.testseed, index, value);
} else {
inModal.inbound.settings.testseed[index] = value;
}
},
setRandomTestseed() { setRandomTestseed() {
// Ensure testseed is initialized // Ensure testseed is initialized
if (!inModal.inbound.settings.testseed || !Array.isArray(inModal.inbound.settings.testseed) || inModal.inbound.settings.testseed.length < 4) { if (!inModal.inbound.settings.testseed || !Array.isArray(inModal.inbound.settings.testseed) || inModal.inbound.settings.testseed.length < 4) {
inModal.inbound.settings.testseed = [900, 500, 900, 256]; inModal.inbound.settings.testseed = [900, 500, 900, 256].slice();
} }
// Create new array to ensure Vue reactivity
const newSeed = [Math.floor(Math.random()*1000), Math.floor(Math.random()*1000), Math.floor(Math.random()*1000), Math.floor(Math.random()*1000)]; const newSeed = [Math.floor(Math.random()*1000), Math.floor(Math.random()*1000), Math.floor(Math.random()*1000), Math.floor(Math.random()*1000)];
inModal.inbound.settings.testseed = newSeed; inModal.inbound.settings.testseed = newSeed.slice();
}, },
resetTestseed() { resetTestseed() {
// Reset testseed to default values // Reset testseed to default values - create new array for Vue reactivity
inModal.inbound.settings.testseed = [900, 500, 900, 256]; inModal.inbound.settings.testseed = [900, 500, 900, 256].slice();
} }
} }
}); });