diff options
| author | mhsanaei <ho3ein.sanaei@gmail.com> | 2025-09-20 12:11:30 +0300 |
|---|---|---|
| committer | mhsanaei <ho3ein.sanaei@gmail.com> | 2025-09-20 14:10:57 +0300 |
| commit | 37c17357fc45b9acec387f3097be5db074ce880d (patch) | |
| tree | a3a5aa82c7483c0883070185372c491537173c25 /web | |
| parent | b35d33966589f428053b77f51a92ec0214bd92fb (diff) | |
undo vnext for vmess
Diffstat (limited to 'web')
| -rw-r--r-- | web/assets/js/model/outbound.js | 36 | ||||
| -rw-r--r-- | web/html/xray.html | 8 |
2 files changed, 21 insertions, 23 deletions
diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index 3e481dff..c727abae 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -686,14 +686,7 @@ class Outbound extends CommonClass { if (this.stream?.sockopt) stream = { sockopt: this.stream.sockopt.toJson() }; } - // For VMess/VLESS, emit settings as a flat object let settingsOut = this.settings instanceof CommonClass ? this.settings.toJson() : this.settings; - // Remove undefined/null keys - if (settingsOut && typeof settingsOut === 'object') { - Object.keys(settingsOut).forEach(k => { - if (settingsOut[k] === undefined || settingsOut[k] === null) delete settingsOut[k]; - }); - } return { protocol: this.protocol, settings: settingsOut, @@ -1031,21 +1024,28 @@ Outbound.VmessSettings = class extends CommonClass { } static fromJson(json = {}) { - if (ObjectUtil.isEmpty(json.address) || ObjectUtil.isEmpty(json.port)) return new Outbound.VmessSettings(); - return new Outbound.VmessSettings( - json.address, - json.port, - json.id, - json.security, - ); + if (!ObjectUtil.isArrEmpty(json.vnext)) { + const v = json.vnext[0] || {}; + const u = ObjectUtil.isArrEmpty(v.users) ? {} : v.users[0]; + return new Outbound.VmessSettings( + v.address, + v.port, + u.id, + u.security, + ); + } } toJson() { return { - address: this.address, - port: this.port, - id: this.id, - security: this.security, + vnext: [{ + address: this.address, + port: this.port, + users: [{ + id: this.id, + security: this.security + }] + }] }; } }; diff --git a/web/html/xray.html b/web/html/xray.html index 258c81c9..266f9eef 100644 --- a/web/html/xray.html +++ b/web/html/xray.html @@ -534,13 +534,11 @@ serverObj = null; switch (o.protocol) { case Protocols.VMess: - case Protocols.VLESS: - if (o.settings && o.settings.address && o.settings.port) { - return [o.settings.address + ':' + o.settings.port]; - } + serverObj = o.settings.vnext; break; + case Protocols.VLESS: case Protocols.HTTP: - case Protocols.Mixed: + case Protocols.Socks: case Protocols.Shadowsocks: case Protocols.Trojan: serverObj = o.settings.servers; |
