Skip to content

Commit

Permalink
Typo fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
MHSanaei committed Jul 7, 2024
1 parent 02ae61f commit 7a51d2f
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 35 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
14 changes: 6 additions & 8 deletions web/controller/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion web/controller/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion web/controller/xray_setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions web/html/common/qrcode_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@
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', () => {
app.$message.success('{{ i18n "copied" }}')
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',
Expand Down
4 changes: 2 additions & 2 deletions web/html/xui/inbound_info_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion web/service/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -1947,6 +1947,6 @@ func (s *InboundService) MigrateDB() {
s.MigrationRemoveOrphanedTraffics()
}

func (s *InboundService) GetOnlineClinets() []string {
func (s *InboundService) GetOnlineClients() []string {
return p.GetOnlineClients()
}
6 changes: 3 additions & 3 deletions web/service/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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() },
Expand Down
16 changes: 8 additions & 8 deletions web/service/tgbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion web/service/xray_setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion web/translation/translate.en_US.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"monitor" = "Listen IP"
"certificate" = "Digital Certificate"
"fail" = " Failed"
"success" = " Successful"
"success" = " Successfully"
"getVersion" = "Get Version"
"install" = "Install"
"clients" = "Clients"
Expand Down
4 changes: 2 additions & 2 deletions web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7a51d2f

Please sign in to comment.