From 161c4c950b771f5245a25a7856c48f4d5c1d9fb7 Mon Sep 17 00:00:00 2001
From: Hamidreza Ghavami <70919649+hamid-gh98@users.noreply.github.com>
Date: Mon, 15 May 2023 22:58:57 +0430
Subject: [PATCH 01/23] Update translation
---
web/translation/translate.en_US.toml | 16 ++++++++--------
web/translation/translate.fa_IR.toml | 6 +++---
web/translation/translate.ru_RU.toml | 2 +-
web/translation/translate.zh_Hans.toml | 4 ++--
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml
index 913e6f46..7cb707a9 100644
--- a/web/translation/translate.en_US.toml
+++ b/web/translation/translate.en_US.toml
@@ -52,8 +52,8 @@
[menu]
"dashboard" = "System Status"
"inbounds" = "Inbounds"
-"setting" = "Panel Setting"
-"logout" = "LogOut"
+"settings" = "Panel Settings"
+"logout" = "Logout"
"link" = "Other"
[pages.login]
@@ -68,10 +68,10 @@
"successLogin" = "Login"
[pages.index]
-"title" = "System status"
+"title" = "System Status"
"memory" = "Memory"
"hard" = "Hard disk"
-"xrayStatus" = "xray Status"
+"xrayStatus" = "Xray Status"
"stopXray" = "Stop"
"restartXray" = "Restart"
"xraySwitch" = "Switch Version"
@@ -88,11 +88,11 @@
"totalReceive" = "Total download traffic of all network cards since system startup"
"xraySwitchVersionDialog" = "Switch xray version"
"xraySwitchVersionDialogDesc" = "Whether to switch the xray version to"
-"dontRefreshh" = "Installation is in progress, please do not refresh this page"
+"dontRefresh" = "Installation is in progress, please do not refresh this page"
"logs" = "Logs"
"config" = "Config"
-"backup" = "Backup"
-"backupTitle" = "Backup Database"
+"backup" = "Backup & Restore"
+"backupTitle" = "Backup & Restore Database"
"backupDescription" = "Remember to backup before importing a new database"
"exportDatabase" = "Download Database"
"importDatabase" = "Upload Database"
@@ -198,7 +198,7 @@
"encryption" = "Encryption"
[pages.settings]
-"title" = "Setting"
+"title" = "Settings"
"save" = "Save"
"infoDesc" = "Every change here needs to be saved and restart panel to take effect"
"restartPanel" = "Restart Panel"
diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml
index efce12e3..392da5ab 100644
--- a/web/translation/translate.fa_IR.toml
+++ b/web/translation/translate.fa_IR.toml
@@ -51,8 +51,8 @@
[menu]
"dashboard" = "وضعیت سیستم"
-"inbounds" = "سرویس ها"
-"setting" = "تنظیمات پنل"
+"inbounds" = "سرویس ها"
+"settings" = "تنظیمات پنل"
"logout" = "خروج"
"link" = "دیگر"
@@ -88,7 +88,7 @@
"totalReceive" = "جمع کل ترافیک دانلود مصرفی"
"xraySwitchVersionDialog" = "تغییر ورژن Xray"
"xraySwitchVersionDialogDesc" = "آیا از تغییر ورژن مطمئن هستین"
-"dontRefreshh" = "در حال نصب ، لطفا رفرش نکنید "
+"dontRefresh" = "در حال نصب ، لطفا رفرش نکنید "
"logs" = "گزارش ها"
"config" = "تنظیمات"
"backup" = "پشتیبان گیری"
diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml
index a6eb8e54..f4d8548c 100644
--- a/web/translation/translate.ru_RU.toml
+++ b/web/translation/translate.ru_RU.toml
@@ -52,7 +52,7 @@
[menu]
"dashboard" = "статус системы"
"inbounds" = "пользователи"
-"setting" = "настройки"
+"settings" = "настройки"
"logout" = "выход"
"link" = "другое"
diff --git a/web/translation/translate.zh_Hans.toml b/web/translation/translate.zh_Hans.toml
index 7c146403..7c48c34e 100644
--- a/web/translation/translate.zh_Hans.toml
+++ b/web/translation/translate.zh_Hans.toml
@@ -52,7 +52,7 @@
[menu]
"dashboard" = "系统状态"
"inbounds" = "入站列表"
-"setting" = "面板设置"
+"settings" = "面板设置"
"logout" = "退出登录"
"link" = "其他"
@@ -88,7 +88,7 @@
"totalReceive" = "系统启动以来所有网卡的总下载流量"
"xraySwitchVersionDialog" = "切换 xray 版本"
"xraySwitchVersionDialogDesc" = "是否切换 xray 版本至"
-"dontRefreshh" = "安装中,请不要刷新此页面"
+"dontRefresh" = "安装中,请不要刷新此页面"
"logs" = "日志"
"config" = "配置"
"backup" = "备份"
From c538301d42cc4604cfe4cc2975445e1341d33bf6 Mon Sep 17 00:00:00 2001
From: Hamidreza Ghavami <70919649+hamid-gh98@users.noreply.github.com>
Date: Mon, 15 May 2023 22:59:23 +0430
Subject: [PATCH 02/23] Update docker-compose
---
docker-compose.yml | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/docker-compose.yml b/docker-compose.yml
index 2e57169f..978fa2fa 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,12 +1,16 @@
-version: '3.9'
+---
+version: "3.9"
+
services:
xui:
image: alireza7/x-ui
container_name: x-ui
+ hostname: yourhostname
volumes:
- $PWD/db/:/etc/x-ui/
- $PWD/cert/:/root/cert/
+ environment:
+ XRAY_VMESS_AEAD_FORCED: "false"
+ tty: true
+ network_mode: host
restart: unless-stopped
- ports:
- - 54321:54321
- - 443:443
From d14c5f4f6773131fb7f067975ff03b43f2adf417 Mon Sep 17 00:00:00 2001
From: Hamidreza Ghavami <70919649+hamid-gh98@users.noreply.github.com>
Date: Mon, 15 May 2023 23:01:07 +0430
Subject: [PATCH 03/23] Update sub remarks
---
web/controller/xui.go | 6 +++---
web/service/config.json | 40 +++++++++++++++-------------------------
web/service/sub.go | 16 ++++++++++------
3 files changed, 28 insertions(+), 34 deletions(-)
diff --git a/web/controller/xui.go b/web/controller/xui.go
index fc3ca5f8..1844181d 100644
--- a/web/controller/xui.go
+++ b/web/controller/xui.go
@@ -23,7 +23,7 @@ func (a *XUIController) initRouter(g *gin.RouterGroup) {
g.GET("/", a.index)
g.GET("/inbounds", a.inbounds)
- g.GET("/setting", a.setting)
+ g.GET("/settings", a.settings)
a.inboundController = NewInboundController(g)
a.settingController = NewSettingController(g)
@@ -37,6 +37,6 @@ func (a *XUIController) inbounds(c *gin.Context) {
html(c, "inbounds.html", "pages.inbounds.title", nil)
}
-func (a *XUIController) setting(c *gin.Context) {
- html(c, "setting.html", "pages.settings.title", nil)
+func (a *XUIController) settings(c *gin.Context) {
+ html(c, "settings.html", "pages.settings.title", nil)
}
diff --git a/web/service/config.json b/web/service/config.json
index a986ea94..87069239 100644
--- a/web/service/config.json
+++ b/web/service/config.json
@@ -3,22 +3,18 @@
"loglevel": "warning"
},
"api": {
- "services": [
- "HandlerService",
- "LoggerService",
- "StatsService"
- ],
- "tag": "api"
+ "tag": "api",
+ "services": ["HandlerService", "LoggerService", "StatsService"]
},
"inbounds": [
{
+ "tag": "api",
"listen": "127.0.0.1",
"port": 62789,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1"
- },
- "tag": "api"
+ }
}
],
"outbounds": [
@@ -27,16 +23,16 @@
"settings": {}
},
{
+ "tag": "blocked",
"protocol": "blackhole",
- "settings": {},
- "tag": "blocked"
+ "settings": {}
}
],
"policy": {
"levels": {
"0": {
- "statsUserUplink": true,
- "statsUserDownlink": true
+ "statsUserDownlink": true,
+ "statsUserUplink": true
}
},
"system": {
@@ -48,25 +44,19 @@
"domainStrategy": "IPIfNonMatch",
"rules": [
{
- "inboundTag": [
- "api"
- ],
- "outboundTag": "api",
- "type": "field"
+ "type": "field",
+ "inboundTag": ["api"],
+ "outboundTag": "api"
},
{
- "ip": [
- "geoip:private"
- ],
+ "type": "field",
"outboundTag": "blocked",
- "type": "field"
+ "ip": ["geoip:private"]
},
{
+ "type": "field",
"outboundTag": "blocked",
- "protocol": [
- "bittorrent"
- ],
- "type": "field"
+ "protocol": ["bittorrent"]
}
]
},
diff --git a/web/service/sub.go b/web/service/sub.go
index f887c681..53099497 100644
--- a/web/service/sub.go
+++ b/web/service/sub.go
@@ -38,7 +38,7 @@ func (s *SubService) GetSubs(subId string, host string) ([]string, string, error
continue
}
for _, client := range clients {
- if client.SubID == subId {
+ if client.Enable && client.SubID == subId {
link := s.getLink(inbound, client.Email)
result = append(result, link)
clientTraffics = append(clientTraffics, s.getClientTraffics(inbound.ClientStats, client.Email))
@@ -73,7 +73,7 @@ func (s *SubService) GetSubs(subId string, host string) ([]string, string, error
func (s *SubService) getInboundsBySubId(subId string) ([]*model.Inbound, error) {
db := database.GetDB()
var inbounds []*model.Inbound
- err := db.Model(model.Inbound{}).Preload("ClientStats").Where("settings like ?", fmt.Sprintf(`%%"subId": "%s"%%`, subId)).Find(&inbounds).Error
+ err := db.Model(model.Inbound{}).Preload("ClientStats").Where("settings like ? and enable = ?", fmt.Sprintf(`%%"subId": "%s"%%`, subId), true).Find(&inbounds).Error
if err != nil && err != gorm.ErrRecordNotFound {
return nil, err
}
@@ -107,9 +107,10 @@ func (s *SubService) genVmessLink(inbound *model.Inbound, email string) string {
if inbound.Protocol != model.VMess {
return ""
}
+ remark := fmt.Sprintf("%s-%s", inbound.Remark, email)
obj := map[string]interface{}{
"v": "2",
- "ps": email,
+ "ps": remark,
"add": s.address,
"port": inbound.Port,
"type": "none",
@@ -353,7 +354,8 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
// Set the new query values on the URL
url.RawQuery = q.Encode()
- url.Fragment = email
+ remark := fmt.Sprintf("%s-%s", inbound.Remark, email)
+ url.Fragment = remark
return url.String()
}
@@ -502,7 +504,8 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string
// Set the new query values on the URL
url.RawQuery = q.Encode()
- url.Fragment = email
+ remark := fmt.Sprintf("%s-%s", inbound.Remark, email)
+ url.Fragment = remark
return url.String()
}
@@ -583,7 +586,8 @@ func (s *SubService) genShadowsocksLink(inbound *model.Inbound, email string) st
// Set the new query values on the URL
url.RawQuery = q.Encode()
- url.Fragment = clients[clientIndex].Email
+ remark := fmt.Sprintf("%s-%s", inbound.Remark, clients[clientIndex].Email)
+ url.Fragment = remark
return url.String()
}
From b00d33830c333b53a717a18f1a1cbe18339bc2fd Mon Sep 17 00:00:00 2001
From: Hamidreza Ghavami <70919649+hamid-gh98@users.noreply.github.com>
Date: Mon, 15 May 2023 23:01:44 +0430
Subject: [PATCH 04/23] Add password component
---
web/html/xui/component/password.html | 35 ++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
create mode 100644 web/html/xui/component/password.html
diff --git a/web/html/xui/component/password.html b/web/html/xui/component/password.html
new file mode 100644
index 00000000..ebea3be6
--- /dev/null
+++ b/web/html/xui/component/password.html
@@ -0,0 +1,35 @@
+{{define "component/passwordInput"}}
+
+
+
+
+
+
+
+
+
+
+{{end}}
+
+{{define "component/password"}}
+
+{{end}}
\ No newline at end of file
From 2349c9fdbeb08a0207420256c3b6dea10ab7f313 Mon Sep 17 00:00:00 2001
From: Hamidreza Ghavami <70919649+hamid-gh98@users.noreply.github.com>
Date: Mon, 15 May 2023 23:02:10 +0430
Subject: [PATCH 05/23] FIX themeSwitcher classes
---
web/html/xui/component/themeSwitch.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/web/html/xui/component/themeSwitch.html b/web/html/xui/component/themeSwitch.html
index 35013a9e..7cbedecf 100644
--- a/web/html/xui/component/themeSwitch.html
+++ b/web/html/xui/component/themeSwitch.html
@@ -28,7 +28,7 @@
isDarkTheme,
bgStyle: `background: ${colors[theme].bg};`,
textStyle: `color: ${colors[theme].text};`,
- darkClass: isDarkTheme ? 'ant-card-dark' : '',
+ darkClass: isDarkTheme ? 'ant-dark' : '',
darkCardClass: isDarkTheme ? 'ant-card-dark' : '',
darkDrawerClass: isDarkTheme ? 'ant-drawer-dark' : '',
get currentTheme() {
@@ -40,7 +40,7 @@
localStorage.setItem('dark-mode', this.isDarkTheme);
this.bgStyle = `background: ${colors[this.theme].bg};`;
this.textStyle = `color: ${colors[this.theme].text};`;
- this.darkClass = this.isDarkTheme ? 'ant-card-dark' : '';
+ this.darkClass = this.isDarkTheme ? 'ant-dark' : '';
this.darkCardClass = this.isDarkTheme ? 'ant-card-dark' : '';
this.darkDrawerClass = this.isDarkTheme ? 'ant-drawer-dark' : '';
},
From b87705f50bce65fd38454f0415343938ca4014be Mon Sep 17 00:00:00 2001
From: Hamidreza Ghavami <70919649+hamid-gh98@users.noreply.github.com>
Date: Mon, 15 May 2023 23:02:21 +0430
Subject: [PATCH 06/23] Update htmls
---
web/html/common/prompt_modal.html | 10 +++----
web/html/common/qrcode_modal.html | 2 +-
web/html/common/text_modal.html | 2 +-
web/html/login.html | 26 +++++++++----------
web/html/xui/client_bulk_modal.html | 6 ++---
web/html/xui/common_sider.html | 4 +--
web/html/xui/form/client.html | 4 +--
web/html/xui/form/inbound.html | 4 +--
web/html/xui/form/protocol/dokodemo.html | 2 +-
web/html/xui/form/protocol/shadowsocks.html | 10 +++----
web/html/xui/form/protocol/socks.html | 1 -
web/html/xui/form/protocol/trojan.html | 6 ++---
web/html/xui/form/protocol/vless.html | 4 +--
web/html/xui/form/protocol/vmess.html | 2 +-
web/html/xui/form/stream/stream_kcp.html | 2 +-
web/html/xui/form/stream/stream_quic.html | 4 +--
web/html/xui/form/stream/stream_settings.html | 2 +-
web/html/xui/form/tls_settings.html | 10 +++----
web/html/xui/inbounds.html | 20 +++++++-------
web/html/xui/index.html | 4 +--
web/html/xui/{setting.html => settings.html} | 15 +++++------
21 files changed, 68 insertions(+), 72 deletions(-)
rename web/html/xui/{setting.html => settings.html} (98%)
diff --git a/web/html/common/prompt_modal.html b/web/html/common/prompt_modal.html
index 6b64bc95..23bdca64 100644
--- a/web/html/common/prompt_modal.html
+++ b/web/html/common/prompt_modal.html
@@ -36,11 +36,11 @@
},
confirm() {},
open({
- title='',
- type='text',
- value='',
- okText='{{ i18n "sure"}}',
- confirm=() => {},
+ title = '',
+ type = 'text',
+ value = '',
+ okText = '{{ i18n "sure"}}',
+ confirm = () => {},
}) {
this.title = title;
this.type = type;
diff --git a/web/html/common/qrcode_modal.html b/web/html/common/qrcode_modal.html
index 06ca07a8..76ab7b41 100644
--- a/web/html/common/qrcode_modal.html
+++ b/web/html/common/qrcode_modal.html
@@ -23,7 +23,7 @@
qrcode: null,
clipboard: null,
visible: false,
- show: function (title='', content='', dbInbound=new DBInbound(), copyText='', clientName = null) {
+ show: function (title = '', content = '', dbInbound = new DBInbound(), copyText = '', clientName = null) {
this.title = title;
this.content = content;
this.dbInbound = dbInbound;
diff --git a/web/html/common/text_modal.html b/web/html/common/text_modal.html
index 649f73dd..1514051b 100644
--- a/web/html/common/text_modal.html
+++ b/web/html/common/text_modal.html
@@ -21,7 +21,7 @@
qrcode: null,
clipboard: null,
visible: false,
- show: function (title='', content='', fileName='') {
+ show: function (title = '', content = '', fileName = '') {
this.title = title;
this.content = content;
this.fileName = fileName;
diff --git a/web/html/login.html b/web/html/login.html
index b98059e2..c1b88449 100644
--- a/web/html/login.html
+++ b/web/html/login.html
@@ -50,7 +50,7 @@
- {{ i18n "pages.login.title" }}
+ {{ i18n "pages.login.title" }}
@@ -63,10 +63,9 @@
-
-
-
+
+
@@ -78,14 +77,12 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -101,6 +98,7 @@
{{template "js" .}}
{{template "component/themeSwitcher" .}}
+{{template "component/password" .}}
+ });
+
-{{template "inboundModal"}}
-{{template "promptModal"}}
-{{template "qrcodeModal"}}
-{{template "textModal"}}
-{{template "inboundInfoModal"}}
-{{template "clientsModal"}}
-{{template "clientsBulkModal"}}
+ {{template "inboundModal"}}
+ {{template "promptModal"}}
+ {{template "qrcodeModal"}}
+ {{template "textModal"}}
+ {{template "inboundInfoModal"}}
+ {{template "clientsModal"}}
+ {{template "clientsBulkModal"}}