Browse Source

Typo fixed

mhsanaei 8 months ago
parent
commit
7a51d2f2cc

+ 3 - 3
main.go

@@ -159,19 +159,19 @@ func showSetting(show bool) {
 
 func updateTgbotEnableSts(status bool) {
 	settingService := service.SettingService{}
-	currentTgSts, err := settingService.GetTgbotenabled()
+	currentTgSts, err := settingService.GetTgbotEnabled()
 	if err != nil {
 		fmt.Println(err)
 		return
 	}
 	logger.Infof("current enabletgbot status[%v],need update to status[%v]", currentTgSts, status)
 	if currentTgSts != status {
-		err := settingService.SetTgbotenabled(status)
+		err := settingService.SetTgbotEnabled(status)
 		if err != nil {
 			fmt.Println(err)
 			return
 		} else {
-			logger.Infof("SetTgbotenabled[%v] success", status)
+			logger.Infof("SetTgbotEnabled[%v] success", status)
 		}
 	}
 }

+ 6 - 8
web/controller/inbound.go

@@ -232,14 +232,12 @@ func (a *InboundController) resetClientTraffic(c *gin.Context) {
 	}
 	email := c.Param("email")
 
-	needRestart := true
-
-	needRestart, err = a.inboundService.ResetClientTraffic(id, email)
+	needRestart, err := a.inboundService.ResetClientTraffic(id, email)
 	if err != nil {
 		jsonMsg(c, "Something went wrong!", err)
 		return
 	}
-	jsonMsg(c, "traffic reseted", nil)
+	jsonMsg(c, "Traffic has been reset", nil)
 	if needRestart {
 		a.xrayService.SetToNeedRestart()
 	}
@@ -253,7 +251,7 @@ func (a *InboundController) resetAllTraffics(c *gin.Context) {
 	} else {
 		a.xrayService.SetToNeedRestart()
 	}
-	jsonMsg(c, "All traffics reseted", nil)
+	jsonMsg(c, "all traffic has been reset", nil)
 }
 
 func (a *InboundController) resetAllClientTraffics(c *gin.Context) {
@@ -270,7 +268,7 @@ func (a *InboundController) resetAllClientTraffics(c *gin.Context) {
 	} else {
 		a.xrayService.SetToNeedRestart()
 	}
-	jsonMsg(c, "All traffics of client reseted", nil)
+	jsonMsg(c, "All traffic from the client has been reset.", nil)
 }
 
 func (a *InboundController) importInbound(c *gin.Context) {
@@ -313,9 +311,9 @@ 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) onlines(c *gin.Context) {
-	jsonObj(c, a.inboundService.GetOnlineClinets(), nil)
+	jsonObj(c, a.inboundService.GetOnlineClients(), nil)
 }

+ 1 - 1
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) {

+ 1 - 1
web/controller/xray_setting.go

@@ -81,7 +81,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)

+ 4 - 4
web/html/common/qrcode_modal.html

@@ -79,8 +79,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', () => {
@@ -88,9 +88,9 @@
           this.qrModal.clipboard.destroy();
         });
       },
-      setQrCode(elmentId, content) {
+      setQrCode(elementId, content) {
         new QRious({
-          element: document.querySelector('#' + elmentId),
+          element: document.querySelector('#' + elementId),
           size: 400,
           value: content,
           background: 'white',

+ 2 - 2
web/html/xui/inbound_info_modal.html

@@ -494,8 +494,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', () => {

+ 1 - 1
web/service/inbound.go

@@ -1947,6 +1947,6 @@ func (s *InboundService) MigrateDB() {
 	s.MigrationRemoveOrphanedTraffics()
 }
 
-func (s *InboundService) GetOnlineClinets() []string {
+func (s *InboundService) GetOnlineClients() []string {
 	return p.GetOnlineClients()
 }

+ 3 - 3
web/service/setting.go

@@ -269,11 +269,11 @@ func (s *SettingService) SetTgBotChatId(chatIds string) error {
 	return s.setString("tgBotChatId", chatIds)
 }
 
-func (s *SettingService) GetTgbotenabled() (bool, error) {
+func (s *SettingService) GetTgbotEnabled() (bool, error) {
 	return s.getBool("tgBotEnable")
 }
 
-func (s *SettingService) SetTgbotenabled(value bool) error {
+func (s *SettingService) SetTgbotEnabled(value bool) error {
 	return s.setBool("tgBotEnable", value)
 }
 
@@ -524,7 +524,7 @@ func (s *SettingService) GetDefaultSettings(host string) (interface{}, error) {
 		"pageSize":      func() (interface{}, error) { return s.GetPageSize() },
 		"defaultCert":   func() (interface{}, error) { return s.GetCertFile() },
 		"defaultKey":    func() (interface{}, error) { return s.GetKeyFile() },
-		"tgBotEnable":   func() (interface{}, error) { return s.GetTgbotenabled() },
+		"tgBotEnable":   func() (interface{}, error) { return s.GetTgbotEnabled() },
 		"subEnable":     func() (interface{}, error) { return s.GetSubEnable() },
 		"subURI":        func() (interface{}, error) { return s.GetSubURI() },
 		"subJsonURI":    func() (interface{}, error) { return s.GetSubJsonURI() },

+ 8 - 8
web/service/tgbot.go

@@ -201,7 +201,7 @@ func (t *Tgbot) OnReceive() {
 	}, th.AnyCommand())
 
 	botHandler.HandleCallbackQuery(func(_ *telego.Bot, query telego.CallbackQuery) {
-		t.asnwerCallback(&query, checkAdmin(query.From.ID))
+		t.answerCallback(&query, checkAdmin(query.From.ID))
 	}, th.AnyCallbackQueryWithMessage())
 
 	botHandler.HandleMessage(func(_ *telego.Bot, message telego.Message) {
@@ -286,7 +286,7 @@ func (t *Tgbot) answerCommand(message *telego.Message, chatId int64, isAdmin boo
 	}
 }
 
-func (t *Tgbot) asnwerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool) {
+func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool) {
 	chatId := callbackQuery.Message.GetChat().ID
 
 	if isAdmin {
@@ -964,7 +964,7 @@ func (t *Tgbot) getServerUsage(chatId int64, messageID ...int) string {
 	return info
 }
 
-// Send server usage without an inline keyborad
+// Send server usage without an inline keyboard
 func (t *Tgbot) sendServerUsage() string {
 	info := t.prepareServerUsageInfo()
 	return info
@@ -1052,14 +1052,14 @@ func (t *Tgbot) UserLoginNotify(username string, password string, ip string, tim
 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))
@@ -1332,20 +1332,20 @@ func (t *Tgbot) searchClient(chatId int64, email string, messageID ...int) {
 }
 
 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")
 		t.SendMsgToTgbot(chatId, msg)
 		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))

+ 1 - 1
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 {

+ 1 - 1
web/translation/translate.en_US.toml

@@ -44,7 +44,7 @@
 "monitor" = "Listen IP"
 "certificate" = "Digital Certificate"
 "fail" = " Failed"
-"success" = " Successful"
+"success" = " Successfully"
 "getVersion" = "Get Version"
 "install" = "Install"
 "clients" = "Clients"

+ 2 - 2
web/web.go

@@ -268,7 +268,7 @@ func (s *Server) startTask() {
 
 	// Make a traffic condition every day, 8:30
 	var entry cron.EntryID
-	isTgbotenabled, err := s.settingService.GetTgbotenabled()
+	isTgbotenabled, err := s.settingService.GetTgbotEnabled()
 	if (err == nil) && (isTgbotenabled) {
 		runtime, err := s.settingService.GetTgbotRuntime()
 		if err != nil || runtime == "" {
@@ -364,7 +364,7 @@ func (s *Server) Start() (err error) {
 
 	s.startTask()
 
-	isTgbotenabled, err := s.settingService.GetTgbotenabled()
+	isTgbotenabled, err := s.settingService.GetTgbotEnabled()
 	if (err == nil) && (isTgbotenabled) {
 		tgBot := s.tgbotService.NewTgbot()
 		tgBot.Start(i18nFS)