diff --git a/web/assets/js/model/models.js b/web/assets/js/model/models.js
index dfe33c1b..f0c51e06 100644
--- a/web/assets/js/model/models.js
+++ b/web/assets/js/model/models.js
@@ -179,6 +179,7 @@ class AllSetting {
this.tgBotChatId = "";
this.tgRunTime = "@daily";
this.tgBotBackup = false;
+ this.tgBotLoginNotify = false;
this.tgCpu = "";
this.tgLang = "";
this.xrayTemplateConfig = "";
diff --git a/web/entity/entity.go b/web/entity/entity.go
index 046ddb83..f2e8fb71 100644
--- a/web/entity/entity.go
+++ b/web/entity/entity.go
@@ -41,6 +41,7 @@ type AllSetting struct {
TgBotChatId string `json:"tgBotChatId" form:"tgBotChatId"`
TgRunTime string `json:"tgRunTime" form:"tgRunTime"`
TgBotBackup bool `json:"tgBotBackup" form:"tgBotBackup"`
+ TgBotLoginNotify bool `json:"tgBotLoginNotify" form:"tgBotLoginNotify"`
TgCpu int `json:"tgCpu" form:"tgCpu"`
TgLang string `json:"tgLang" form:"tgLang"`
XrayTemplateConfig string `json:"xrayTemplateConfig" form:"xrayTemplateConfig"`
diff --git a/web/html/xui/settings.html b/web/html/xui/settings.html
index 8a29c147..714da3ca 100644
--- a/web/html/xui/settings.html
+++ b/web/html/xui/settings.html
@@ -305,6 +305,7 @@
+
diff --git a/web/service/setting.go b/web/service/setting.go
index 49c6a709..a686c669 100644
--- a/web/service/setting.go
+++ b/web/service/setting.go
@@ -39,6 +39,7 @@ var defaultValueMap = map[string]string{
"tgBotChatId": "",
"tgRunTime": "@daily",
"tgBotBackup": "false",
+ "tgBotLoginNotify": "false",
"tgCpu": "0",
"tgLang": "en-US",
"subEnable": "false",
@@ -251,6 +252,10 @@ func (s *SettingService) GetTgBotBackup() (bool, error) {
return s.getBool("tgBotBackup")
}
+func (s *SettingService) GetTgBotLoginNotify() (bool, error) {
+ return s.getBool("tgBotLoginNotify")
+}
+
func (s *SettingService) GetTgCpu() (int, error) {
return s.getInt("tgCpu")
}
diff --git a/web/service/tgbot.go b/web/service/tgbot.go
index 0859df29..1d712452 100644
--- a/web/service/tgbot.go
+++ b/web/service/tgbot.go
@@ -385,6 +385,11 @@ func (t *Tgbot) UserLoginNotify(username string, ip string, time string, status
return
}
+ loginNotifyEnabled, err := t.settingService.GetTgBotLoginNotify()
+ if err != nil || !loginNotifyEnabled {
+ return
+ }
+
msg := ""
if status == LoginSuccess {
msg += t.I18nBot("tgbot.messages.loginSuccess")
diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml
index 84571903..36c0c5db 100644
--- a/web/translation/translate.en_US.toml
+++ b/web/translation/translate.en_US.toml
@@ -235,6 +235,8 @@
"telegramNotifyTimeDesc" = "Use Crontab timing format."
"tgNotifyBackup" = "Database Backup"
"tgNotifyBackupDesc" = "Send database backup file with report notification"
+"tgNotifyLogin" = "Login Notification"
+"tgNotifyLoginDesc" = "Displays the username, IP address, and time when someone tries to log into your panel."
"sessionMaxAge" = "Session maximum age"
"sessionMaxAgeDesc" = "The time that you can stay login (unit: minute)"
"expireTimeDiff" = "Expiration threshold for notification"
diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml
index 1d4c373a..114a09db 100644
--- a/web/translation/translate.fa_IR.toml
+++ b/web/translation/translate.fa_IR.toml
@@ -234,6 +234,8 @@
"telegramNotifyTimeDesc" = "از فرمت زمان بندی لینوکس استفاده کنید "
"tgNotifyBackup" = "پشتیبان گیری از پایگاه داده"
"tgNotifyBackupDesc" = "ارسال کپی فایل پایگاه داده به همراه گزارش دوره ای"
+"tgNotifyLogin" = "اعلان ورود"
+"tgNotifyLoginDesc" = "نام کاربری، آدرس ای پی، و زمان وقتی که فردی سعی میکند به پنل شما وارد شود نمایش میدهد"
"sessionMaxAge" = "بیشینه زمان جلسه وب"
"sessionMaxAgeDesc" = "بیشینه زمانی که میتوانید لاگین بمانید (واحد: دقیقه)"
"expireTimeDiff" = "آستانه زمان باقی مانده"
diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml
index ac8bd787..de5da513 100644
--- a/web/translation/translate.ru_RU.toml
+++ b/web/translation/translate.ru_RU.toml
@@ -235,6 +235,8 @@
"telegramNotifyTimeDesc" = "Используйте формат Crontab. Перезагрузите панель для применения настроек"
"tgNotifyBackup" = "Резервное копирование базы данных"
"tgNotifyBackupDesc" = "Включать файл резервной копии базы данных с уведомлением об отчете. Перезагрузите панель для применения настроек"
+"tgNotifyLogin" = "Уведомление о входе"
+"tgNotifyLoginDesc" = "Отображает имя пользователя, IP-адрес и время, когда кто-то пытается войти в вашу панель."
"sessionMaxAge" = "Продолжительность сессии"
"sessionMaxAgeDesc" = "Продолжительность сессии в системе (значение: минута)"
"expireTimeDiff" = "Порог истечения срока сессии для уведомления"
diff --git a/web/translation/translate.zh_Hans.toml b/web/translation/translate.zh_Hans.toml
index 648e4861..8aaa4e49 100644
--- a/web/translation/translate.zh_Hans.toml
+++ b/web/translation/translate.zh_Hans.toml
@@ -235,6 +235,8 @@
"telegramNotifyTimeDesc" = "采用Crontab定时格式"
"tgNotifyBackup" = "数据库备份"
"tgNotifyBackupDesc" = "正在发送数据库备份文件和报告通知"
+"tgNotifyLogin" = "登录通知"
+"tgNotifyLoginDesc" = "当有人试图登录您的面板时显示用户名、IP 地址和时间"
"sessionMaxAge" = "会话最大年龄"
"sessionMaxAgeDesc" = "您可以保持登录状态的时间(单位:分钟)"
"expireTimeDiff" = "耗尽时间阈值"