diff --git a/sub/subService.go b/sub/subService.go index 3238ca44..7f8dbc46 100644 --- a/sub/subService.go +++ b/sub/subService.go @@ -576,7 +576,7 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string if pbkValue, ok := searchKey(realitySettings, "publicKey"); ok { params["pbk"], _ = pbkValue.(string) } - if sidValue, ok := searchKey(realitySettings, "shortIds"); ok { + if sidValue, ok := searchKey(realitySetting, "shortIds"); ok { shortIds, _ := sidValue.([]interface{}) params["sid"], _ = shortIds[0].(string) } 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); diff --git a/web/html/xui/form/client.html b/web/html/xui/form/client.html index 45068f91..cfac5cff 100644 --- a/web/html/xui/form/client.html +++ b/web/html/xui/form/client.html @@ -18,7 +18,7 @@ - + @@ -44,7 +44,7 @@ - + diff --git a/web/html/xui/form/protocol/shadowsocks.html b/web/html/xui/form/protocol/shadowsocks.html index 45385300..e4eaf155 100644 --- a/web/html/xui/form/protocol/shadowsocks.html +++ b/web/html/xui/form/protocol/shadowsocks.html @@ -11,7 +11,7 @@ - + @@ -28,7 +28,7 @@ - + diff --git a/web/html/xui/form/protocol/trojan.html b/web/html/xui/form/protocol/trojan.html index caec459a..cf56f438 100644 --- a/web/html/xui/form/protocol/trojan.html +++ b/web/html/xui/form/protocol/trojan.html @@ -11,7 +11,7 @@ - + @@ -28,7 +28,7 @@ - + diff --git a/web/html/xui/form/protocol/vless.html b/web/html/xui/form/protocol/vless.html index 3155ee28..59ba7672 100644 --- a/web/html/xui/form/protocol/vless.html +++ b/web/html/xui/form/protocol/vless.html @@ -11,7 +11,7 @@ - + @@ -28,7 +28,7 @@ - + diff --git a/web/html/xui/form/protocol/vmess.html b/web/html/xui/form/protocol/vmess.html index 469440c6..de6e5250 100644 --- a/web/html/xui/form/protocol/vmess.html +++ b/web/html/xui/form/protocol/vmess.html @@ -11,7 +11,7 @@ - +
@@ -33,7 +33,7 @@ - + diff --git a/web/html/xui/form/tls_settings.html b/web/html/xui/form/tls_settings.html index 58edf992..d0692e13 100644 --- a/web/html/xui/form/tls_settings.html +++ b/web/html/xui/form/tls_settings.html @@ -187,7 +187,7 @@ - +
diff --git a/web/html/xui/index.html b/web/html/xui/index.html index 284fdf03..9795e87d 100644 --- a/web/html/xui/index.html +++ b/web/html/xui/index.html @@ -78,9 +78,9 @@ - 3x-ui: v{{ .cur_ver }} + 3X: v{{ .cur_ver }} Xray: v[[ status.xray.version ]] - Telegram: @panel3xui + @panel3xui diff --git a/web/service/inbound.go b/web/service/inbound.go index 84ce9bd8..57384128 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -564,7 +564,7 @@ func (s *InboundService) UpdateInboundClient(data *model.Inbound, clientId strin if err != nil { return false, err } - err = s.UpdateClientIPs(db, oldEmail, clients[0].Email) + err = s.UpdateClientIPs(tx, oldEmail, clients[0].Email) if err != nil { return false, err } @@ -576,7 +576,7 @@ func (s *InboundService) UpdateInboundClient(data *model.Inbound, clientId strin if err != nil { return false, err } - err = s.DelClientIPs(db, oldEmail) + err = s.DelClientIPs(tx, oldEmail) if err != nil { return false, err } diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml index 401a1265..15c8416a 100644 --- a/web/translation/translate.en_US.toml +++ b/web/translation/translate.en_US.toml @@ -72,7 +72,7 @@ "title" = "System Status" "memory" = "Memory" "hard" = "Hard Disk" -"xrayStatus" = "Xray Status" +"xrayStatus" = "Status" "stopXray" = "Stop" "restartXray" = "Restart" "xraySwitch" = "SwitchV" diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml index 841483c7..16635d35 100644 --- a/web/translation/translate.fa_IR.toml +++ b/web/translation/translate.fa_IR.toml @@ -72,7 +72,7 @@ "title" = "وضعیت سیستم" "memory" = "حافظه رم" "hard" = "حافظه دیسک" -"xrayStatus" = "وضعیت Xray" +"xrayStatus" = "وضعیت" "stopXray" = "توقف" "restartXray" = "شروع مجدد" "xraySwitch" = "تغییر ورژن" diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml index 45a73a97..800f42a4 100644 --- a/web/translation/translate.ru_RU.toml +++ b/web/translation/translate.ru_RU.toml @@ -72,7 +72,7 @@ "title" = "Статус системы" "memory" = "Память" "hard" = "Жесткий диск" -"xrayStatus" = "Статус Xray" +"xrayStatus" = "Статус" "stopXray" = "Остановить Xray" "restartXray" = "Рестарт Xray" "xraySwitch" = "Переключить версию" diff --git a/web/translation/translate.zh_Hans.toml b/web/translation/translate.zh_Hans.toml index 70c24df7..18fc2ad5 100644 --- a/web/translation/translate.zh_Hans.toml +++ b/web/translation/translate.zh_Hans.toml @@ -72,7 +72,7 @@ "title" = "系统状态" "memory" = "内存" "hard" = "硬盘" -"xrayStatus" = "xray 状态" +"xrayStatus" = "状态" "stopXray" = "停止" "restartXray" = "重启" "xraySwitch" = "切换版本"