- 改进 ui 界面
 - 修复流量超出后账号不自动失效问题
 - 修复vless生成的链接不正确问题
 - 修复网页端重启面板功能问题
This commit is contained in:
sprov
2021-06-15 11:10:39 +08:00
parent 5cc4cf02ee
commit e91daabb18
13 changed files with 303 additions and 59 deletions

View File

@@ -54,6 +54,38 @@ class DBInbound {
this.total = toFixed(gb * ONE_GB, 0);
}
get isVMess() {
return this.protocol === Protocols.VMESS;
}
get isVLess() {
return this.protocol === Protocols.VLESS;
}
get isTrojan() {
return this.protocol === Protocols.TROJAN;
}
get isSS() {
return this.protocol === Protocols.SHADOWSOCKS;
}
get isSocks() {
return this.protocol === Protocols.SOCKS;
}
get isHTTP() {
return this.protocol === Protocols.HTTP;
}
get address() {
let address = location.hostname;
if (!ObjectUtil.isEmpty(this.listen) && this.listen !== "0.0.0.0") {
address = this.listen;
}
return address;
}
toInbound() {
let settings = {};
if (!ObjectUtil.isEmpty(this.settings)) {
@@ -93,9 +125,9 @@ class DBInbound {
}
}
genLink(address = "") {
genLink() {
const inbound = this.toInbound();
return inbound.genLink(address, this.remark);
return inbound.genLink(this.address, this.remark);
}
}

View File

@@ -643,6 +643,81 @@ class Inbound extends XrayCommonClass {
this.stream.network = network;
}
// VMess & VLess
get uuid() {
switch (this.protocol) {
case Protocols.VMESS:
return this.settings.vmesses[0].id;
case Protocols.VLESS:
return this.settings.vlesses[0].id;
default:
return "";
}
}
// VLess
get flow() {
switch (this.protocol) {
case Protocols.VLESS:
return this.settings.vlesses[0].flow;
default:
return "";
}
}
// VMess
get alterId() {
switch (this.protocol) {
case Protocols.VMESS:
return this.settings.vmesses[0].alterId;
default:
return "";
}
}
// Socks & HTTP
get username() {
switch (this.protocol) {
case Protocols.SOCKS:
case Protocols.HTTP:
return this.settings.accounts[0].user;
default:
return "";
}
}
// Trojan & Shadowsocks & Socks & HTTP
get password() {
switch (this.protocol) {
case Protocols.TROJAN:
return this.settings.clients[0].password;
case Protocols.SHADOWSOCKS:
return this.settings.password;
case Protocols.SOCKS:
case Protocols.HTTP:
return this.settings.accounts[0].pass;
default:
return "";
}
}
// Shadowsocks
get method() {
switch (this.protocol) {
case Protocols.SHADOWSOCKS:
return this.settings.method;
default:
return "";
}
}
get serverName() {
if (this.stream.isTls || this.stream.isXTls) {
return this.stream.tls.server;
}
return "";
}
canEnableTls() {
switch (this.protocol) {
case Protocols.VMESS:
@@ -785,7 +860,7 @@ class Inbound extends XrayCommonClass {
const type = this.stream.network;
const params = new Map();
params.set("type", this.stream.network);
if (this.isXTls) {
if (this.xtls) {
params.set("security", "xtls");
} else {
params.set("security", this.stream.security);
@@ -841,7 +916,7 @@ class Inbound extends XrayCommonClass {
}
}
if (this.isXTls) {
if (this.xtls) {
params.set("flow", this.settings.vlesses[0].flow);
}