mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-12-17 04:34:40 +03:00
undo vnext for vmess
Some checks failed
Release 3X-UI / build (386) (push) Has been cancelled
Release 3X-UI / build (amd64) (push) Has been cancelled
Release 3X-UI / build (arm64) (push) Has been cancelled
Release 3X-UI / build (armv5) (push) Has been cancelled
Release 3X-UI / build (armv6) (push) Has been cancelled
Release 3X-UI / build (armv7) (push) Has been cancelled
Release 3X-UI / build (s390x) (push) Has been cancelled
Release 3X-UI / Build for Windows (amd64) (push) Has been cancelled
Some checks failed
Release 3X-UI / build (386) (push) Has been cancelled
Release 3X-UI / build (amd64) (push) Has been cancelled
Release 3X-UI / build (arm64) (push) Has been cancelled
Release 3X-UI / build (armv5) (push) Has been cancelled
Release 3X-UI / build (armv6) (push) Has been cancelled
Release 3X-UI / build (armv7) (push) Has been cancelled
Release 3X-UI / build (s390x) (push) Has been cancelled
Release 3X-UI / Build for Windows (amd64) (push) Has been cancelled
This commit is contained in:
@@ -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
|
||||
}]
|
||||
}]
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user