mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-20 05:52:24 +00:00
random sub Id
optimize utils trojan short id fix index page better view
This commit is contained in:
parent
70f250dfe1
commit
594d682e20
15 changed files with 31 additions and 46 deletions
|
@ -576,7 +576,7 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string
|
||||||
if pbkValue, ok := searchKey(realitySettings, "publicKey"); ok {
|
if pbkValue, ok := searchKey(realitySettings, "publicKey"); ok {
|
||||||
params["pbk"], _ = pbkValue.(string)
|
params["pbk"], _ = pbkValue.(string)
|
||||||
}
|
}
|
||||||
if sidValue, ok := searchKey(realitySettings, "shortIds"); ok {
|
if sidValue, ok := searchKey(realitySetting, "shortIds"); ok {
|
||||||
shortIds, _ := sidValue.([]interface{})
|
shortIds, _ := sidValue.([]interface{})
|
||||||
params["sid"], _ = shortIds[0].(string)
|
params["sid"], _ = shortIds[0].(string)
|
||||||
}
|
}
|
||||||
|
|
|
@ -708,7 +708,7 @@ class RealityStreamSettings extends XrayCommonClass {
|
||||||
minClient = '',
|
minClient = '',
|
||||||
maxClient = '',
|
maxClient = '',
|
||||||
maxTimediff = 0,
|
maxTimediff = 0,
|
||||||
shortIds = RandomUtil.randomShortId(),
|
shortIds = RandomUtil.randomShortId(8),
|
||||||
settings= new RealityStreamSettings.Settings()
|
settings= new RealityStreamSettings.Settings()
|
||||||
){
|
){
|
||||||
super();
|
super();
|
||||||
|
@ -1655,7 +1655,7 @@ Inbound.VmessSettings = class extends Inbound.Settings {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Inbound.VmessSettings.Vmess = class extends XrayCommonClass {
|
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();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.alterId = alterId;
|
this.alterId = alterId;
|
||||||
|
@ -1747,7 +1747,7 @@ Inbound.VLESSSettings = class extends Inbound.Settings {
|
||||||
|
|
||||||
};
|
};
|
||||||
Inbound.VLESSSettings.VLESS = class extends XrayCommonClass {
|
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();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.flow = flow;
|
this.flow = flow;
|
||||||
|
@ -1870,7 +1870,7 @@ Inbound.TrojanSettings = class extends Inbound.Settings {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
|
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();
|
super();
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.flow = flow;
|
this.flow = flow;
|
||||||
|
@ -2012,7 +2012,7 @@ Inbound.ShadowsocksSettings = class extends Inbound.Settings {
|
||||||
};
|
};
|
||||||
|
|
||||||
Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
|
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();
|
super();
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.email = email;
|
this.email = email;
|
||||||
|
|
|
@ -75,9 +75,7 @@ class PromiseUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const seq = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
|
const seq = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
|
||||||
|
|
||||||
const shortIdSeq = 'abcdef0123456789'.split('');
|
|
||||||
|
|
||||||
class RandomUtil {
|
class RandomUtil {
|
||||||
static randomIntRange(min, max) {
|
static randomIntRange(min, max) {
|
||||||
|
@ -96,21 +94,17 @@ class RandomUtil {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static randomShortIdSeq(count) {
|
static randomShortId(count) {
|
||||||
let str = '';
|
let str = '';
|
||||||
for (let i = 0; i < count; ++i) {
|
for (let i = 0; i < count; ++i) {
|
||||||
str += shortIdSeq[this.randomInt(16)];
|
str += seq[this.randomInt(16)];
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static randomShortId() {
|
static randomText(len) {
|
||||||
return this.randomShortIdSeq(8);
|
|
||||||
}
|
|
||||||
|
|
||||||
static randomLowerAndNum(count) {
|
|
||||||
let str = '';
|
let str = '';
|
||||||
for (let i = 0; i < count; ++i) {
|
for (let i = 0; i < len; i++) {
|
||||||
str += seq[this.randomInt(36)];
|
str += seq[this.randomInt(36)];
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
|
@ -138,15 +132,6 @@ class RandomUtil {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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() {
|
static randomShadowsocksPassword() {
|
||||||
let array = new Uint8Array(32);
|
let array = new Uint8Array(32);
|
||||||
window.crypto.getRandomValues(array);
|
window.crypto.getRandomValues(array);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
</template>
|
</template>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<a-icon @click="client.email = RandomUtil.randomText()" type="sync"> </a-icon>
|
<a-icon @click="client.email = RandomUtil.randomText(8)" type="sync"> </a-icon>
|
||||||
<a-input v-model.trim="client.email" style="width: 200px;"></a-input>
|
<a-input v-model.trim="client.email" style="width: 200px;"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="Password" v-if="inbound.protocol === Protocols.TROJAN || inbound.protocol === Protocols.SHADOWSOCKS">
|
<a-form-item label="Password" v-if="inbound.protocol === Protocols.TROJAN || inbound.protocol === Protocols.SHADOWSOCKS">
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
<a-icon type="question-circle" theme="filled"></a-icon>
|
<a-icon type="question-circle" theme="filled"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<a-icon @click="client.subId = RandomUtil.randomText()" type="sync"> </a-icon>
|
<a-icon @click="client.subId = RandomUtil.randomText(16)" type="sync"> </a-icon>
|
||||||
<a-input v-model.trim="client.subId" style="width: 150px;"></a-input>
|
<a-input v-model.trim="client.subId" style="width: 150px;"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="client.email && app.tgBotEnable" >
|
<a-form-item v-if="client.email && app.tgBotEnable" >
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</template>
|
</template>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<a-icon @click="client.email = RandomUtil.randomText()" type="sync"> </a-icon>
|
<a-icon @click="client.email = RandomUtil.randomText(8)" type="sync"> </a-icon>
|
||||||
<a-input v-model.trim="client.email" style="width: 200px;"></a-input>
|
<a-input v-model.trim="client.email" style="width: 200px;"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="Password">
|
<a-form-item label="Password">
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
<a-icon type="question-circle" theme="filled"></a-icon>
|
<a-icon type="question-circle" theme="filled"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<a-icon @click="client.subId = RandomUtil.randomText()" type="sync"> </a-icon>
|
<a-icon @click="client.subId = RandomUtil.randomText(16)" type="sync"> </a-icon>
|
||||||
<a-input v-model.trim="client.subId" style="width: 150px;"></a-input>
|
<a-input v-model.trim="client.subId" style="width: 150px;"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="client.email && app.tgBotEnable">
|
<a-form-item v-if="client.email && app.tgBotEnable">
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</template>
|
</template>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<a-icon @click="client.email = RandomUtil.randomText()" type="sync"> </a-icon>
|
<a-icon @click="client.email = RandomUtil.randomText(8)" type="sync"> </a-icon>
|
||||||
<a-input v-model.trim="client.email" style="width: 200px;"></a-input>
|
<a-input v-model.trim="client.email" style="width: 200px;"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="Password">
|
<a-form-item label="Password">
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
<a-icon type="question-circle" theme="filled"></a-icon>
|
<a-icon type="question-circle" theme="filled"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<a-icon @click="client.subId = RandomUtil.randomText()" type="sync"> </a-icon>
|
<a-icon @click="client.subId = RandomUtil.randomText(16)" type="sync"> </a-icon>
|
||||||
<a-input v-model.trim="client.subId" style="width: 150px;"></a-input>
|
<a-input v-model.trim="client.subId" style="width: 150px;"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="client.email && app.tgBotEnable">
|
<a-form-item v-if="client.email && app.tgBotEnable">
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</template>
|
</template>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<a-icon @click="client.email = RandomUtil.randomText()" type="sync"> </a-icon>
|
<a-icon @click="client.email = RandomUtil.randomText(8)" type="sync"> </a-icon>
|
||||||
<a-input v-model.trim="client.email" style="width: 200px;"></a-input>
|
<a-input v-model.trim="client.email" style="width: 200px;"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="ID">
|
<a-form-item label="ID">
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
<a-icon type="question-circle" theme="filled"></a-icon>
|
<a-icon type="question-circle" theme="filled"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<a-icon @click="client.subId = RandomUtil.randomText()" type="sync"> </a-icon>
|
<a-icon @click="client.subId = RandomUtil.randomText(16)" type="sync"> </a-icon>
|
||||||
<a-input v-model.trim="client.subId" style="width: 150px;"></a-input>
|
<a-input v-model.trim="client.subId" style="width: 150px;"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="client.email && app.tgBotEnable">
|
<a-form-item v-if="client.email && app.tgBotEnable">
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</template>
|
</template>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<a-icon @click="client.email = RandomUtil.randomText()" type="sync"> </a-icon>
|
<a-icon @click="client.email = RandomUtil.randomText(8)" type="sync"> </a-icon>
|
||||||
<a-input v-model.trim="client.email" style="width: 200px;"></a-input>
|
<a-input v-model.trim="client.email" style="width: 200px;"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<br>
|
<br>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
<a-icon type="question-circle" theme="filled"></a-icon>
|
<a-icon type="question-circle" theme="filled"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<a-icon @click="client.subId = RandomUtil.randomText()" type="sync"> </a-icon>
|
<a-icon @click="client.subId = RandomUtil.randomText(16)" type="sync"> </a-icon>
|
||||||
<a-input v-model.trim="client.subId" style="width: 150px;"></a-input>
|
<a-input v-model.trim="client.subId" style="width: 150px;"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="client.email && app.tgBotEnable">
|
<a-form-item v-if="client.email && app.tgBotEnable">
|
||||||
|
|
|
@ -187,7 +187,7 @@
|
||||||
<a-input v-model.trim="inbound.stream.reality.serverNames" style="width: 300px"></a-input>
|
<a-input v-model.trim="inbound.stream.reality.serverNames" style="width: 300px"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="ShortIds">
|
<a-form-item label="ShortIds">
|
||||||
<a-icon @click="inbound.stream.reality.shortIds = RandomUtil.randomShortId()" type="sync"> </a-icon>
|
<a-icon @click="inbound.stream.reality.shortIds = RandomUtil.randomShortId(8)" type="sync"> </a-icon>
|
||||||
<a-input v-model.trim="inbound.stream.reality.shortIds" style="width: 150px;"></a-input>
|
<a-input v-model.trim="inbound.stream.reality.shortIds" style="width: 150px;"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -78,9 +78,9 @@
|
||||||
<a-row>
|
<a-row>
|
||||||
<a-col :sm="24" :md="12">
|
<a-col :sm="24" :md="12">
|
||||||
<a-card hoverable :class="themeSwitcher.darkCardClass">
|
<a-card hoverable :class="themeSwitcher.darkCardClass">
|
||||||
3x-ui: <a href="https://github.com/MHSanaei/3x-ui/releases" target="_blank"><a-tag color="green">v{{ .cur_ver }}</a-tag></a>
|
3X: <a href="https://github.com/MHSanaei/3x-ui/releases" target="_blank"><a-tag color="green">v{{ .cur_ver }}</a-tag></a>
|
||||||
Xray: <a-tag color="green" style="cursor: pointer;" @click="openSelectV2rayVersion">v[[ status.xray.version ]]</a-tag>
|
Xray: <a-tag color="green" style="cursor: pointer;" @click="openSelectV2rayVersion">v[[ status.xray.version ]]</a-tag>
|
||||||
Telegram: <a href="https://t.me/panel3xui" target="_blank"><a-tag color="green">@panel3xui</a-tag></a>
|
<a href="https://t.me/panel3xui" target="_blank"><a-tag color="green">@panel3xui</a-tag></a>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :sm="24" :md="12">
|
<a-col :sm="24" :md="12">
|
||||||
|
|
|
@ -564,7 +564,7 @@ func (s *InboundService) UpdateInboundClient(data *model.Inbound, clientId strin
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
err = s.UpdateClientIPs(db, oldEmail, clients[0].Email)
|
err = s.UpdateClientIPs(tx, oldEmail, clients[0].Email)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
@ -576,7 +576,7 @@ func (s *InboundService) UpdateInboundClient(data *model.Inbound, clientId strin
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
err = s.DelClientIPs(db, oldEmail)
|
err = s.DelClientIPs(tx, oldEmail)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
"title" = "System Status"
|
"title" = "System Status"
|
||||||
"memory" = "Memory"
|
"memory" = "Memory"
|
||||||
"hard" = "Hard Disk"
|
"hard" = "Hard Disk"
|
||||||
"xrayStatus" = "Xray Status"
|
"xrayStatus" = "Status"
|
||||||
"stopXray" = "Stop"
|
"stopXray" = "Stop"
|
||||||
"restartXray" = "Restart"
|
"restartXray" = "Restart"
|
||||||
"xraySwitch" = "SwitchV"
|
"xraySwitch" = "SwitchV"
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
"title" = "وضعیت سیستم"
|
"title" = "وضعیت سیستم"
|
||||||
"memory" = "حافظه رم"
|
"memory" = "حافظه رم"
|
||||||
"hard" = "حافظه دیسک"
|
"hard" = "حافظه دیسک"
|
||||||
"xrayStatus" = "وضعیت Xray"
|
"xrayStatus" = "وضعیت"
|
||||||
"stopXray" = "توقف"
|
"stopXray" = "توقف"
|
||||||
"restartXray" = "شروع مجدد"
|
"restartXray" = "شروع مجدد"
|
||||||
"xraySwitch" = "تغییر ورژن"
|
"xraySwitch" = "تغییر ورژن"
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
"title" = "Статус системы"
|
"title" = "Статус системы"
|
||||||
"memory" = "Память"
|
"memory" = "Память"
|
||||||
"hard" = "Жесткий диск"
|
"hard" = "Жесткий диск"
|
||||||
"xrayStatus" = "Статус Xray"
|
"xrayStatus" = "Статус"
|
||||||
"stopXray" = "Остановить Xray"
|
"stopXray" = "Остановить Xray"
|
||||||
"restartXray" = "Рестарт Xray"
|
"restartXray" = "Рестарт Xray"
|
||||||
"xraySwitch" = "Переключить версию"
|
"xraySwitch" = "Переключить версию"
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
"title" = "系统状态"
|
"title" = "系统状态"
|
||||||
"memory" = "内存"
|
"memory" = "内存"
|
||||||
"hard" = "硬盘"
|
"hard" = "硬盘"
|
||||||
"xrayStatus" = "xray 状态"
|
"xrayStatus" = "状态"
|
||||||
"stopXray" = "停止"
|
"stopXray" = "停止"
|
||||||
"restartXray" = "重启"
|
"restartXray" = "重启"
|
||||||
"xraySwitch" = "切换版本"
|
"xraySwitch" = "切换版本"
|
||||||
|
|
Loading…
Reference in a new issue