Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMHSanaei <ho3ein.sanaei@gmail.com>2023-06-07 12:15:58 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2023-06-07 12:15:58 +0300
commit594d682e202b30164aa7f9c510ec5955ed871541 (patch)
treef1f7d7bfd4f48fa48e8a29b0da3ed57788bec2e6 /web/assets
parent70f250dfe1e24249a4cc8102e3fef65959dfb15a (diff)
random sub Id
optimize utils trojan short id fix index page better view
Diffstat (limited to 'web/assets')
-rw-r--r--web/assets/js/model/xray.js10
-rw-r--r--web/assets/js/util/utils.js27
2 files changed, 11 insertions, 26 deletions
diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js
index bc8d4d4a..33cd10d5 100644
--- a/web/assets/js/model/xray.js
+++ b/web/assets/js/model/xray.js
@@ -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;
diff --git a/web/assets/js/util/utils.js b/web/assets/js/util/utils.js
index e6a28a32..5644df2e 100644
--- a/web/assets/js/util/utils.js
+++ b/web/assets/js/util/utils.js
@@ -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);