From 1aa22b2d29ce51b58b3c84a181e8cefa247f36e7 Mon Sep 17 00:00:00 2001
From: MHSanaei <33454419+MHSanaei@users.noreply.github.com>
Date: Sat, 25 Mar 2023 19:42:31 +0330
Subject: [PATCH 1/4] typo fixed
---
web/html/xui/form/stream/stream_settings.html | 2 +-
web/html/xui/index.html | 2 +-
web/translation/translate.en_US.toml | 2 +-
web/translation/translate.fa_IR.toml | 8 ++++----
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/web/html/xui/form/stream/stream_settings.html b/web/html/xui/form/stream/stream_settings.html
index 417d1734..3db72fe5 100644
--- a/web/html/xui/form/stream/stream_settings.html
+++ b/web/html/xui/form/stream/stream_settings.html
@@ -8,7 +8,7 @@
WS
HTTP
QUIC
- GRPC
+ gRPC
diff --git a/web/html/xui/index.html b/web/html/xui/index.html
index 3d9b326c..5ced0a26 100644
--- a/web/html/xui/index.html
+++ b/web/html/xui/index.html
@@ -172,7 +172,7 @@
- x-ui: 3x-ui v{{ .cur_ver }}
+ 3x-ui: v{{ .cur_ver }}
Telegram
Log Reports
diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml
index 76dc50f1..836e4692 100644
--- a/web/translation/translate.en_US.toml
+++ b/web/translation/translate.en_US.toml
@@ -170,7 +170,7 @@
"restartPanelDesc" = "Are you sure you want to restart the panel? Click OK to restart after 3 seconds. If you cannot access the panel after restarting, please go to the server to view the panel log information"
"panelConfig" = "Panel Configuration"
"userSetting" = "User Setting"
-"xrayConfiguration" = "xray Configuration"
+"xrayConfiguration" = "Xray Configuration"
"TGReminder" = "TG Reminder Related Settings"
"otherSetting" = "Other Setting"
"panelListeningIP" = "Panel listening IP"
diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml
index cbc25c2f..0fcab166 100644
--- a/web/translation/translate.fa_IR.toml
+++ b/web/translation/translate.fa_IR.toml
@@ -74,8 +74,8 @@
"xraySwitch" = "تغییر ورژن"
"xraySwitchClick" = "ورژن مورد نظر را انتخاب کنید"
"xraySwitchClickDesk" = "لطفا با دقت انتخاب کنید ، در صورت انتخاب اشتباه امکان قطعی سیستم وجود دارد ."
-"operationHours" = "ساعت فعال"
-"operationHoursDesc" = "ساعت فعال بعد از شروع سیستم"
+"operationHours" = "مدت فعالیت"
+"operationHoursDesc" = "مدت فعالیت سیستم بعد از روشن شدن"
"systemLoad" = "بار روی سیستم"
"connectionCount" = "تعداد کانکشن ها"
"connectionCountDesc" = "تعداد کانکشن ها برای کل شبکه"
@@ -83,7 +83,7 @@
"downSpeed" = "سرعت دانلود در حال حاضر سیستم"
"totalSent" = "جمع کل ترافیک آپلود مصرفی"
"totalReceive" = "جمع کل ترافیک دانلود مصرفی"
-"xraySwitchVersionDialog" = "تغییر ورژن Xray"
+"xraySwitchVersionDialog" = "تغییر ورژن"
"xraySwitchVersionDialogDesc" = "آیا از تغییر ورژن مطمئن هستین"
"dontRefreshh" = "در حال نصب ، لطفا رفرش نکنید "
@@ -128,7 +128,7 @@
"keyContent" = "محتوای Private.key"
"clickOnQRcode" = "برای کپی بر روی کد تصویری کلیک کنید"
"client" = "کاربر"
-"export" = "استخراج لینکها"
+"export" = "استخراج لینکها"
[pages.client]
"add" = "کاربر جدید"
From 862cb11183123764b4ad46c7491f28204b88d0f5 Mon Sep 17 00:00:00 2001
From: MHSanaei <33454419+MHSanaei@users.noreply.github.com>
Date: Sat, 25 Mar 2023 19:46:03 +0330
Subject: [PATCH 2/4] "index out of range" fixed
---
web/job/check_clinet_ip_job.go | 59 +++++++++++++++++-----------------
1 file changed, 29 insertions(+), 30 deletions(-)
diff --git a/web/job/check_clinet_ip_job.go b/web/job/check_clinet_ip_job.go
index bf71116b..9e1959e3 100644
--- a/web/job/check_clinet_ip_job.go
+++ b/web/job/check_clinet_ip_job.go
@@ -247,47 +247,46 @@ func GetInboundByEmail(clientEmail string) (*model.Inbound, error) {
return inbounds, nil
}
-func LimitDevice(){
-
- localIp,err := LocalIP()
- checkError(err)
+func LimitDevice() {
+ var destIp, destPort, srcIp, srcPort string
+
+ localIp,err := LocalIP()
+ checkError(err)
- c := cmd.NewCmd("bash","-c","ss --tcp | grep -E '" + IPsToRegex(localIp) + "'| awk '{if($1==\"ESTAB\") print $4,$5;}'","| sort | uniq -c | sort -nr | head")
+ c := cmd.NewCmd("bash","-c","ss --tcp | grep -E '" + IPsToRegex(localIp) + "'| awk '{if($1==\"ESTAB\") print $4,$5;}'","| sort | uniq -c | sort -nr | head")
- <-c.Start()
- if len(c.Status().Stdout) > 0 {
- ipRegx, _ := regexp.Compile(`[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+`)
- portRegx, _ := regexp.Compile(`(?:(:))([0-9]..[^.][0-9]+)`)
+ <-c.Start()
+ if len(c.Status().Stdout) > 0 {
+ ipRegx, _ := regexp.Compile(`[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+`)
+ portRegx, _ := regexp.Compile(`(?:(:))([0-9]..[^.][0-9]+)`)
- for _, row := range c.Status().Stdout {
-
- data := strings.Split(row," ")
-
- destIp,destPort,srcIp,srcPort := "","","",""
-
+ for _, row := range c.Status().Stdout {
- destIp = string(ipRegx.FindString(data[0]))
+ data := strings.Split(row," ")
- destPort = portRegx.FindString(data[0])
- destPort = strings.Replace(destPort,":","",-1)
-
-
- srcIp = string(ipRegx.FindString(data[1]))
+ if len(data) < 2 {
+ continue // Skip this row if it doesn't have at least two elements
+ }
- srcPort = portRegx.FindString(data[1])
- srcPort = strings.Replace(srcPort,":","",-1)
+ destIp = string(ipRegx.FindString(data[0]))
+ destPort = portRegx.FindString(data[0])
+ destPort = strings.Replace(destPort,":","",-1)
- if(contains(disAllowedIps,srcIp)){
- dropCmd := cmd.NewCmd("bash","-c","ss -K dport = " + srcPort)
- dropCmd.Start()
+ srcIp = string(ipRegx.FindString(data[1]))
+ srcPort = portRegx.FindString(data[1])
+ srcPort = strings.Replace(srcPort,":","",-1)
- logger.Debug("request droped : ",srcIp,srcPort,"to",destIp,destPort)
- }
- }
- }
+ if contains(disAllowedIps,srcIp){
+ dropCmd := cmd.NewCmd("bash","-c","ss -K dport = " + srcPort)
+ dropCmd.Start()
+ logger.Debug("request droped : ",srcIp,srcPort,"to",destIp,destPort)
+ }
+ }
+ }
}
+
func LocalIP() ([]string, error) {
// get machine ips
From 218d25a0fa1e1e95e2931a6a0c678ca74381aed3 Mon Sep 17 00:00:00 2001
From: MHSanaei <33454419+MHSanaei@users.noreply.github.com>
Date: Sat, 25 Mar 2023 20:05:46 +0330
Subject: [PATCH 3/4] bug fixed (extra enter on client_email)
---
web/job/check_clinet_ip_job.go | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/web/job/check_clinet_ip_job.go b/web/job/check_clinet_ip_job.go
index 9e1959e3..ed86b42d 100644
--- a/web/job/check_clinet_ip_job.go
+++ b/web/job/check_clinet_ip_job.go
@@ -154,14 +154,16 @@ func GetInboundClientIps(clientEmail string) (*model.InboundClientIps, error) {
}
return InboundClientIps, nil
}
-func addInboundClientIps(clientEmail string,ips []string) error {
+func addInboundClientIps(clientEmail string, ips []string) error {
inboundClientIps := &model.InboundClientIps{}
- jsonIps, err := json.Marshal(ips)
+ jsonIps, err := json.Marshal(ips)
checkError(err)
+ // Trim any leading/trailing whitespace from clientEmail
+ clientEmail = strings.TrimSpace(clientEmail)
+
inboundClientIps.ClientEmail = clientEmail
inboundClientIps.Ips = string(jsonIps)
-
db := database.GetDB()
tx := db.Begin()
From db25a87790038b1c08c1058397229e2e8b35578f Mon Sep 17 00:00:00 2001
From: MHSanaei <33454419+MHSanaei@users.noreply.github.com>
Date: Sun, 26 Mar 2023 16:25:28 +0330
Subject: [PATCH 4/4] params.set xtls
---
web/assets/js/model/xray.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js
index 9b0f8de9..775d56c8 100644
--- a/web/assets/js/model/xray.js
+++ b/web/assets/js/model/xray.js
@@ -1160,7 +1160,7 @@ class Inbound extends XrayCommonClass {
}
if (this.XTLS) {
- params.set("security", "tls");
+ params.set("security", "xtls");
params.set("alpn", this.stream.tls.alpn);
if(this.stream.tls.settings[0].allowInsecure){
params.set("allowInsecure", "1");
@@ -1261,7 +1261,7 @@ class Inbound extends XrayCommonClass {
}
if (this.XTLS) {
- params.set("security", "tls");
+ params.set("security", "xtls");
params.set("alpn", this.stream.tls.alpn);
if(this.stream.tls.settings[0].allowInsecure){
params.set("allowInsecure", "1");