random sub Id

optimize utils
trojan short id fix
index page better view
This commit is contained in:
MHSanaei
2023-06-07 12:45:58 +03:30
parent 70f250dfe1
commit 594d682e20
15 changed files with 31 additions and 46 deletions
+5 -5
View File
@@ -708,7 +708,7 @@ class RealityStreamSettings extends XrayCommonClass {
minClient = '',
maxClient = '',
maxTimediff = 0,
shortIds = RandomUtil.randomShortId(),
shortIds = RandomUtil.randomShortId(8),
settings= new RealityStreamSettings.Settings()
){
super();
@@ -1655,7 +1655,7 @@ Inbound.VmessSettings = class extends Inbound.Settings {
}
};
Inbound.VmessSettings.Vmess = class extends XrayCommonClass {
constructor(id=RandomUtil.randomUUID(), alterId=0, email=RandomUtil.randomText(),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId='') {
constructor(id=RandomUtil.randomUUID(), alterId=0, email=RandomUtil.randomText(8),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId=RandomUtil.randomText(16)) {
super();
this.id = id;
this.alterId = alterId;
@@ -1747,7 +1747,7 @@ Inbound.VLESSSettings = class extends Inbound.Settings {
};
Inbound.VLESSSettings.VLESS = class extends XrayCommonClass {
constructor(id=RandomUtil.randomUUID(), flow='', email=RandomUtil.randomText(),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId='') {
constructor(id=RandomUtil.randomUUID(), flow='', email=RandomUtil.randomText(8),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId=RandomUtil.randomText(16)) {
super();
this.id = id;
this.flow = flow;
@@ -1870,7 +1870,7 @@ Inbound.TrojanSettings = class extends Inbound.Settings {
}
};
Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
constructor(password=RandomUtil.randomSeq(10), flow='', email=RandomUtil.randomText(),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId='') {
constructor(password=RandomUtil.randomSeq(10), flow='', email=RandomUtil.randomText(8),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId=RandomUtil.randomText(16)) {
super();
this.password = password;
this.flow = flow;
@@ -2012,7 +2012,7 @@ Inbound.ShadowsocksSettings = class extends Inbound.Settings {
};
Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
constructor(password=RandomUtil.randomShadowsocksPassword(), email=RandomUtil.randomText(),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId='') {
constructor(password=RandomUtil.randomShadowsocksPassword(), email=RandomUtil.randomText(8),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId=RandomUtil.randomText(16)) {
super();
this.password = password;
this.email = email;
+6 -21
View File
@@ -75,9 +75,7 @@ class PromiseUtil {
}
}
const seq = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
const shortIdSeq = 'abcdef0123456789'.split('');
const seq = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
class RandomUtil {
static randomIntRange(min, max) {
@@ -96,21 +94,17 @@ class RandomUtil {
return str;
}
static randomShortIdSeq(count) {
static randomShortId(count) {
let str = '';
for (let i = 0; i < count; ++i) {
str += shortIdSeq[this.randomInt(16)];
str += seq[this.randomInt(16)];
}
return str;
}
static randomShortId() {
return this.randomShortIdSeq(8);
}
static randomLowerAndNum(count) {
static randomText(len) {
let str = '';
for (let i = 0; i < count; ++i) {
for (let i = 0; i < len; i++) {
str += seq[this.randomInt(36)];
}
return str;
@@ -136,16 +130,7 @@ class RandomUtil {
d = Math.floor(d / 16);
return (c === 'x' ? r : (r & 0x7 | 0x8)).toString(16);
});
}
static randomText() {
var chars = 'abcdefghijklmnopqrstuvwxyz1234567890';
var string = '';
for (var ii = 0; ii < 8; ii++) {
string += chars[Math.floor(Math.random() * chars.length)];
}
return string;
}
}
static randomShadowsocksPassword() {
let array = new Uint8Array(32);