From 19a7a8574c8a2545d4607e6277d0a62a82f90c67 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Wed, 10 Jul 2024 20:56:38 +0200 Subject: [PATCH] typo fixed --- install.sh | 2 +- web/controller/inbound.go | 10 +++++----- web/controller/index.go | 10 +++++----- web/controller/server.go | 2 +- web/controller/xray_setting.go | 2 +- web/html/common/qrcode_modal.html | 8 ++++---- web/html/xui/inbound_info_modal.html | 4 ++-- web/service/inbound.go | 6 +++--- web/service/tgbot.go | 14 +++++++------- web/service/xray_setting.go | 2 +- web/translation/translate.en_US.toml | 2 +- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/install.sh b/install.sh index 0e5e991d..b4928802 100755 --- a/install.sh +++ b/install.sh @@ -73,7 +73,7 @@ install_dependencies() { esac } -#This function will be called when user installed x-ui out of sercurity +#This function will be called when user installed x-ui out of security config_after_install() { echo -e "${yellow}Install/update finished! For security it's recommended to modify panel settings ${plain}" read -p "Do you want to continue with the modification [y/n]? ": config_confirm diff --git a/web/controller/inbound.go b/web/controller/inbound.go index 8db9d486..f80d57fd 100644 --- a/web/controller/inbound.go +++ b/web/controller/inbound.go @@ -214,7 +214,7 @@ func (a *InboundController) resetClientTraffic(c *gin.Context) { jsonMsg(c, "Something went wrong!", err) return } - jsonMsg(c, "traffic reseted", nil) + jsonMsg(c, "traffic has been reset", nil) if needRestart { a.xrayService.SetToNeedRestart() } @@ -228,7 +228,7 @@ func (a *InboundController) resetAllTraffics(c *gin.Context) { } else { a.xrayService.SetToNeedRestart() } - jsonMsg(c, "All traffics reseted", nil) + jsonMsg(c, "All traffics has been reset", nil) } func (a *InboundController) resetAllClientTraffics(c *gin.Context) { @@ -245,7 +245,7 @@ func (a *InboundController) resetAllClientTraffics(c *gin.Context) { } else { a.xrayService.SetToNeedRestart() } - jsonMsg(c, "All traffics of client reseted", nil) + jsonMsg(c, "All traffics of client has been reset", nil) } func (a *InboundController) delDepletedClients(c *gin.Context) { @@ -259,7 +259,7 @@ func (a *InboundController) delDepletedClients(c *gin.Context) { jsonMsg(c, "Something went wrong!", err) return } - jsonMsg(c, "All delpeted clients are deleted", nil) + jsonMsg(c, "All depleted clients are deleted", nil) } func (a *InboundController) importInbound(c *gin.Context) { @@ -292,5 +292,5 @@ func (a *InboundController) importInbound(c *gin.Context) { } func (a *InboundController) onlines(c *gin.Context) { - jsonObj(c, a.inboundService.GetOnlineClinets(), nil) + jsonObj(c, a.inboundService.GetOnlineClients(), nil) } diff --git a/web/controller/index.go b/web/controller/index.go index 919a2648..db2d55a3 100644 --- a/web/controller/index.go +++ b/web/controller/index.go @@ -68,31 +68,31 @@ func (a *IndexController) login(c *gin.Context) { pureJsonMsg(c, http.StatusOK, false, I18nWeb(c, "pages.login.toasts.wrongUsernameOrPassword")) return } else { - logger.Infof("%s login success ,Ip Address: %s\n", form.Username, getRemoteIp(c)) + logger.Infof("%s Successful Login ,Ip Address: %s\n", form.Username, getRemoteIp(c)) a.tgbot.UserLoginNotify(form.Username, getRemoteIp(c), timeStr, 1) } sessionMaxAge, err := a.settingService.GetSessionMaxAge() if err != nil { - logger.Infof("Unable to get session's max age from DB") + logger.Info("Unable to get session's max age from DB") } if sessionMaxAge > 0 { err = session.SetMaxAge(c, sessionMaxAge*60) if err != nil { - logger.Infof("Unable to set session's max age") + logger.Info("Unable to set session's max age") } } err = session.SetLoginUser(c, user) - logger.Info("user", user.Id, "login success") + logger.Infof("%s logged in successfully", user.Username) jsonMsg(c, I18nWeb(c, "pages.login.toasts.successLogin"), err) } func (a *IndexController) logout(c *gin.Context) { user := session.GetLoginUser(c) if user != nil { - logger.Info("user", user.Id, "logout") + logger.Infof("%s logged out successfully", user.Username) } session.ClearSession(c) c.Redirect(http.StatusTemporaryRedirect, c.GetString("base_path")) diff --git a/web/controller/server.go b/web/controller/server.go index 8ce0b6bb..28fd4ac0 100644 --- a/web/controller/server.go +++ b/web/controller/server.go @@ -105,7 +105,7 @@ func (a *ServerController) stopXrayService(c *gin.Context) { jsonMsg(c, "", err) return } - jsonMsg(c, "Xray stoped", err) + jsonMsg(c, "Xray stopped", err) } func (a *ServerController) restartXrayService(c *gin.Context) { diff --git a/web/controller/xray_setting.go b/web/controller/xray_setting.go index 9555b0d7..299f797e 100644 --- a/web/controller/xray_setting.go +++ b/web/controller/xray_setting.go @@ -78,7 +78,7 @@ func (a *XraySettingController) warp(c *gin.Context) { resp, err = a.XraySettingService.RegWarp(skey, pkey) case "license": license := c.PostForm("license") - resp, err = a.XraySettingService.SetWarpLicence(license) + resp, err = a.XraySettingService.SetWarpLicense(license) } jsonObj(c, resp, err) diff --git a/web/html/common/qrcode_modal.html b/web/html/common/qrcode_modal.html index 7441bd5b..28349ee8 100644 --- a/web/html/common/qrcode_modal.html +++ b/web/html/common/qrcode_modal.html @@ -71,8 +71,8 @@ qrModal: qrModal, }, methods: { - copyToClipboard(elmentId, content) { - this.qrModal.clipboard = new ClipboardJS('#' + elmentId, { + copyToClipboard(elementId, content) { + this.qrModal.clipboard = new ClipboardJS('#' + elementId, { text: () => content, }); this.qrModal.clipboard.on('success', () => { @@ -80,9 +80,9 @@ this.qrModal.clipboard.destroy(); }); }, - setQrCode(elmentId, content) { + setQrCode(elementId, content) { new QRious({ - element: document.querySelector('#' + elmentId), + element: document.querySelector('#' + elementId), size: 260, value: content, }); diff --git a/web/html/xui/inbound_info_modal.html b/web/html/xui/inbound_info_modal.html index 2bb59593..03f730ed 100644 --- a/web/html/xui/inbound_info_modal.html +++ b/web/html/xui/inbound_info_modal.html @@ -412,8 +412,8 @@ }, }, methods: { - copyToClipboard(elmentId,content) { - this.infoModal.clipboard = new ClipboardJS('#' + elmentId, { + copyToClipboard(elementId,content) { + this.infoModal.clipboard = new ClipboardJS('#' + elementId, { text: () => content, }); this.infoModal.clipboard.on('success', () => { diff --git a/web/service/inbound.go b/web/service/inbound.go index d8101567..424be726 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -574,7 +574,7 @@ func (s *InboundService) UpdateInboundClient(data *model.Inbound, clientId strin return false, err } - inerfaceClients := settings["clients"].([]interface{}) + interfaceClients := settings["clients"].([]interface{}) oldInbound, err := s.GetInbound(data.Id) if err != nil { @@ -629,7 +629,7 @@ func (s *InboundService) UpdateInboundClient(data *model.Inbound, clientId strin return false, err } settingsClients := oldSettings["clients"].([]interface{}) - settingsClients[clientIndex] = inerfaceClients[0] + settingsClients[clientIndex] = interfaceClients[0] oldSettings["clients"] = settingsClients newSettings, err := json.MarshalIndent(oldSettings, "", " ") @@ -1468,6 +1468,6 @@ func (s *InboundService) MigrateDB() { s.MigrationRemoveOrphanedTraffics() } -func (s *InboundService) GetOnlineClinets() []string { +func (s *InboundService) GetOnlineClients() []string { return p.GetOnlineClients() } diff --git a/web/service/tgbot.go b/web/service/tgbot.go index 6ed8476e..fee1b51a 100644 --- a/web/service/tgbot.go +++ b/web/service/tgbot.go @@ -135,7 +135,7 @@ func (t *Tgbot) OnReceive() { isAdmin := checkAdmin(tgId) if update.Message == nil { if update.CallbackQuery != nil { - t.asnwerCallback(update.CallbackQuery) + t.answerCallback(update.CallbackQuery) } } else { if update.Message.IsCommand() { @@ -196,7 +196,7 @@ func (t *Tgbot) answerCommand(message *tgbotapi.Message, chatId int64, isAdmin b t.SendAnswer(chatId, msg, isAdmin) } -func (t *Tgbot) asnwerCallback(callbackQuery *tgbotapi.CallbackQuery) { +func (t *Tgbot) answerCallback(callbackQuery *tgbotapi.CallbackQuery) { // Respond to the callback query, telling Telegram to show the user // a message with the data received. callback := tgbotapi.NewCallback(callbackQuery.ID, callbackQuery.Data) @@ -424,14 +424,14 @@ func (t *Tgbot) UserLoginNotify(username string, ip string, time string, status func (t *Tgbot) getInboundUsages() string { info := "" // get traffic - inbouds, err := t.inboundService.GetAllInbounds() + inbounds, err := t.inboundService.GetAllInbounds() if err != nil { logger.Warning("GetAllInbounds run failed:", err) info += t.I18nBot("tgbot.answers.getInboundsFailed") } else { // NOTE:If there no any sessions here,need to notify here // TODO:Sub-node push, automatic conversion format - for _, inbound := range inbouds { + for _, inbound := range inbounds { info += t.I18nBot("tgbot.messages.inbound", "Remark=="+inbound.Remark) info += t.I18nBot("tgbot.messages.port", "Port=="+strconv.Itoa(inbound.Port)) info += t.I18nBot("tgbot.messages.traffic", "Total=="+common.FormatTraffic((inbound.Up+inbound.Down)), "Upload=="+common.FormatTraffic(inbound.Up), "Download=="+common.FormatTraffic(inbound.Down)) @@ -539,7 +539,7 @@ func (t *Tgbot) searchClient(chatId int64, email string) { } func (t *Tgbot) searchInbound(chatId int64, remark string) { - inbouds, err := t.inboundService.SearchInbounds(remark) + inbounds, err := t.inboundService.SearchInbounds(remark) if err != nil { logger.Warning(err) msg := t.I18nBot("tgbot.wentWrong") @@ -547,13 +547,13 @@ func (t *Tgbot) searchInbound(chatId int64, remark string) { return } - if len(inbouds) == 0 { + if len(inbounds) == 0 { msg := t.I18nBot("tgbot.noInbounds") t.SendMsgToTgbot(chatId, msg) return } - for _, inbound := range inbouds { + for _, inbound := range inbounds { info := "" info += t.I18nBot("tgbot.messages.inbound", "Remark=="+inbound.Remark) info += t.I18nBot("tgbot.messages.port", "Port=="+strconv.Itoa(inbound.Port)) diff --git a/web/service/xray_setting.go b/web/service/xray_setting.go index a203e649..43d143db 100644 --- a/web/service/xray_setting.go +++ b/web/service/xray_setting.go @@ -128,7 +128,7 @@ func (s *XraySettingService) RegWarp(secretKey string, publicKey string) (string return result, nil } -func (s *XraySettingService) SetWarpLicence(license string) (string, error) { +func (s *XraySettingService) SetWarpLicense(license string) (string, error) { var warpData map[string]string warp, err := s.SettingService.GetWarp() if err != nil { diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml index 95ba163a..efbb8d75 100644 --- a/web/translation/translate.en_US.toml +++ b/web/translation/translate.en_US.toml @@ -44,7 +44,7 @@ "monitor" = "Listen IP" "certificate" = "Certificate" "fail" = " Failed" -"success" = " Successful" +"success" = " Successfully" "getVersion" = "Get Version" "install" = "Install" "clients" = "Clients"