mirror of
https://github.com/alireza0/x-ui.git
synced 2026-03-21 08:15:48 +00:00
0.3.0
- 增加到期时间限制 - 新增配置面板 https 访问后,http 自动跳转 https(同端口) - 降低获取系统连接数的 cpu 使用率 - 优化界面 - VMess 协议 alterId 默认改为 0 - 修复旧版本 iOS 系统白屏问题 - 修复重启面板后 xray 没有启动的问题
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
class User {
|
||||
username = "";
|
||||
password = "";
|
||||
|
||||
constructor() {
|
||||
this.username = "";
|
||||
this.password = "";
|
||||
}
|
||||
}
|
||||
|
||||
class Msg {
|
||||
success = false;
|
||||
msg = "";
|
||||
obj = null;
|
||||
|
||||
constructor(success, msg, obj) {
|
||||
this.success = false;
|
||||
this.msg = "";
|
||||
this.obj = null;
|
||||
|
||||
if (success != null) {
|
||||
this.success = success;
|
||||
}
|
||||
@@ -22,24 +26,25 @@ class Msg {
|
||||
}
|
||||
|
||||
class DBInbound {
|
||||
id = 0;
|
||||
userId = 0;
|
||||
up = 0;
|
||||
down = 0;
|
||||
total = 0;
|
||||
remark = "";
|
||||
enable = true;
|
||||
expiryTime = 0;
|
||||
|
||||
listen = "";
|
||||
port = 0;
|
||||
protocol = "";
|
||||
settings = "";
|
||||
streamSettings = "";
|
||||
tag = "";
|
||||
sniffing = "";
|
||||
|
||||
constructor(data) {
|
||||
this.id = 0;
|
||||
this.userId = 0;
|
||||
this.up = 0;
|
||||
this.down = 0;
|
||||
this.total = 0;
|
||||
this.remark = "";
|
||||
this.enable = true;
|
||||
this.expiryTime = 0;
|
||||
|
||||
this.listen = "";
|
||||
this.port = 0;
|
||||
this.protocol = "";
|
||||
this.settings = "";
|
||||
this.streamSettings = "";
|
||||
this.tag = "";
|
||||
this.sniffing = "";
|
||||
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
@@ -86,6 +91,25 @@ class DBInbound {
|
||||
return address;
|
||||
}
|
||||
|
||||
get _expiryTime() {
|
||||
if (this.expiryTime === 0) {
|
||||
return null;
|
||||
}
|
||||
return moment(this.expiryTime);
|
||||
}
|
||||
|
||||
set _expiryTime(t) {
|
||||
if (t == null) {
|
||||
this.expiryTime = 0;
|
||||
} else {
|
||||
this.expiryTime = t.valueOf();
|
||||
}
|
||||
}
|
||||
|
||||
get isExpiry() {
|
||||
return this.expiryTime < new Date().getTime();
|
||||
}
|
||||
|
||||
toInbound() {
|
||||
let settings = {};
|
||||
if (!ObjectUtil.isEmpty(this.settings)) {
|
||||
@@ -132,17 +156,18 @@ class DBInbound {
|
||||
}
|
||||
|
||||
class AllSetting {
|
||||
webListen = "";
|
||||
webPort = 54321;
|
||||
webCertFile = "";
|
||||
webKeyFile = "";
|
||||
webBasePath = "/";
|
||||
|
||||
xrayTemplateConfig = "";
|
||||
|
||||
timeLocation = "Asia/Shanghai";
|
||||
|
||||
constructor(data) {
|
||||
this.webListen = "";
|
||||
this.webPort = 54321;
|
||||
this.webCertFile = "";
|
||||
this.webKeyFile = "";
|
||||
this.webBasePath = "/";
|
||||
|
||||
this.xrayTemplateConfig = "";
|
||||
|
||||
this.timeLocation = "Asia/Shanghai";
|
||||
|
||||
if (data == null) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1165,7 +1165,7 @@ Inbound.VmessSettings = class extends Inbound.Settings {
|
||||
}
|
||||
};
|
||||
Inbound.VmessSettings.Vmess = class extends XrayCommonClass {
|
||||
constructor(id=RandomUtil.randomUUID(), alterId=64) {
|
||||
constructor(id=RandomUtil.randomUUID(), alterId=0) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.alterId = alterId;
|
||||
|
||||
@@ -77,18 +77,19 @@ class PromiseUtil {
|
||||
|
||||
}
|
||||
|
||||
const seq = [
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g',
|
||||
'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
||||
'o', 'p', 'q', 'r', 's', 't',
|
||||
'u', 'v', 'w', 'x', 'y', 'z',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
||||
'O', 'P', 'Q', 'R', 'S', 'T',
|
||||
'U', 'V', 'W', 'X', 'Y', 'Z'
|
||||
];
|
||||
|
||||
class RandomUtil {
|
||||
static seq = [
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g',
|
||||
'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
||||
'o', 'p', 'q', 'r', 's', 't',
|
||||
'u', 'v', 'w', 'x', 'y', 'z',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
||||
'O', 'P', 'Q', 'R', 'S', 'T',
|
||||
'U', 'V', 'W', 'X', 'Y', 'Z'
|
||||
];
|
||||
|
||||
static randomIntRange(min, max) {
|
||||
return parseInt(Math.random() * (max - min) + min, 10);
|
||||
@@ -101,7 +102,7 @@ class RandomUtil {
|
||||
static randomSeq(count) {
|
||||
let str = '';
|
||||
for (let i = 0; i < count; ++i) {
|
||||
str += this.seq[this.randomInt(62)];
|
||||
str += seq[this.randomInt(62)];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
@@ -109,7 +110,7 @@ class RandomUtil {
|
||||
static randomLowerAndNum(count) {
|
||||
let str = '';
|
||||
for (let i = 0; i < count; ++i) {
|
||||
str += this.seq[this.randomInt(36)];
|
||||
str += seq[this.randomInt(36)];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
@@ -121,7 +122,7 @@ class RandomUtil {
|
||||
if (index <= 9) {
|
||||
str += index;
|
||||
} else {
|
||||
str += this.seq[index - 10];
|
||||
str += seq[index - 10];
|
||||
}
|
||||
}
|
||||
return str;
|
||||
|
||||
Reference in New Issue
Block a user