This commit is contained in:
Alireza Ahmadi
2025-09-18 22:51:34 +02:00
parent 1b0828eb3e
commit 2ae72aa8d1
3 changed files with 12 additions and 24 deletions

View File

@@ -1 +1 @@
1.9.0 1.9.1

View File

@@ -99,8 +99,7 @@ func (a *InboundController) addInbound(c *gin.Context) {
inbound.Tag = fmt.Sprintf("inbound-%v:%v", inbound.Listen, inbound.Port) inbound.Tag = fmt.Sprintf("inbound-%v:%v", inbound.Listen, inbound.Port)
} }
needRestart := false inbound, needRestart, err := a.inboundService.AddInbound(inbound)
inbound, needRestart, err = a.inboundService.AddInbound(inbound)
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.create"), inbound, err) jsonMsgObj(c, I18nWeb(c, "pages.inbounds.create"), inbound, err)
if err == nil && needRestart { if err == nil && needRestart {
a.xrayService.SetToNeedRestart() a.xrayService.SetToNeedRestart()
@@ -113,8 +112,7 @@ func (a *InboundController) delInbound(c *gin.Context) {
jsonMsg(c, I18nWeb(c, "delete"), err) jsonMsg(c, I18nWeb(c, "delete"), err)
return return
} }
needRestart := true needRestart, err := a.inboundService.DelInbound(id)
needRestart, err = a.inboundService.DelInbound(id)
jsonMsgObj(c, I18nWeb(c, "delete"), id, err) jsonMsgObj(c, I18nWeb(c, "delete"), id, err)
if err == nil && needRestart { if err == nil && needRestart {
a.xrayService.SetToNeedRestart() a.xrayService.SetToNeedRestart()
@@ -135,8 +133,7 @@ func (a *InboundController) updateInbound(c *gin.Context) {
jsonMsg(c, I18nWeb(c, "pages.inbounds.update"), err) jsonMsg(c, I18nWeb(c, "pages.inbounds.update"), err)
return return
} }
needRestart := true inbound, needRestart, err := a.inboundService.UpdateInbound(inbound)
inbound, needRestart, err = a.inboundService.UpdateInbound(inbound)
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.update"), inbound, err) jsonMsgObj(c, I18nWeb(c, "pages.inbounds.update"), inbound, err)
if err == nil && needRestart { if err == nil && needRestart {
a.xrayService.SetToNeedRestart() a.xrayService.SetToNeedRestart()
@@ -151,9 +148,7 @@ func (a *InboundController) addInboundClient(c *gin.Context) {
return return
} }
needRestart := true needRestart, err := a.inboundService.AddInboundClient(data)
needRestart, err = a.inboundService.AddInboundClient(data)
if err != nil { if err != nil {
jsonMsg(c, "Something went wrong!", err) jsonMsg(c, "Something went wrong!", err)
return return
@@ -172,9 +167,7 @@ func (a *InboundController) delInboundClient(c *gin.Context) {
} }
clientId := c.Param("clientId") clientId := c.Param("clientId")
needRestart := true needRestart, err := a.inboundService.DelInboundClient(id, clientId)
needRestart, err = a.inboundService.DelInboundClient(id, clientId)
if err != nil { if err != nil {
jsonMsg(c, "Something went wrong!", err) jsonMsg(c, "Something went wrong!", err)
return return
@@ -195,9 +188,7 @@ func (a *InboundController) updateInboundClient(c *gin.Context) {
return return
} }
needRestart := true needRestart, err := a.inboundService.UpdateInboundClient(inbound, clientId)
needRestart, err = a.inboundService.UpdateInboundClient(inbound, clientId)
if err != nil { if err != nil {
jsonMsg(c, "Something went wrong!", err) jsonMsg(c, "Something went wrong!", err)
return return
@@ -216,9 +207,7 @@ func (a *InboundController) resetClientTraffic(c *gin.Context) {
} }
email := c.Param("email") email := c.Param("email")
needRestart := true needRestart, err := a.inboundService.ResetClientTraffic(id, email)
needRestart, err = a.inboundService.ResetClientTraffic(id, email)
if err != nil { if err != nil {
jsonMsg(c, "Something went wrong!", err) jsonMsg(c, "Something went wrong!", err)
return return
@@ -292,8 +281,7 @@ func (a *InboundController) importInbound(c *gin.Context) {
inbound.ClientStats[index].Enable = true inbound.ClientStats[index].Enable = true
} }
needRestart := false inbound, needRestart, err := a.inboundService.AddInbound(inbound)
inbound, needRestart, err = a.inboundService.AddInbound(inbound)
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.create"), inbound, err) jsonMsgObj(c, I18nWeb(c, "pages.inbounds.create"), inbound, err)
if err == nil && needRestart { if err == nil && needRestart {
a.xrayService.SetToNeedRestart() a.xrayService.SetToNeedRestart()

View File

@@ -48,10 +48,10 @@ func InitLocalizer(i18nFS embed.FS, settingService SettingService) error {
return nil return nil
} }
func createTemplateData(params []string, seperator ...string) map[string]interface{} { func createTemplateData(params []string, separator ...string) map[string]interface{} {
var sep string = "==" var sep string = "=="
if len(seperator) > 0 { if len(separator) > 0 {
sep = seperator[0] sep = separator[0]
} }
templateData := make(map[string]interface{}) templateData := make(map[string]interface{})