diff --git a/web/assets/js/model/models.js b/web/assets/js/model/models.js index ab6631a6ee..459807646b 100644 --- a/web/assets/js/model/models.js +++ b/web/assets/js/model/models.js @@ -170,13 +170,13 @@ class AllSetting { this.webCertFile = ""; this.webKeyFile = ""; this.webBasePath = "/"; + this.expireDiff = ""; + this.trafficDiff = ""; this.tgBotEnable = false; this.tgBotToken = ""; this.tgBotChatId = ""; this.tgRunTime = "@daily"; this.tgBotBackup = false; - this.tgExpireDiff = ""; - this.tgTrafficDiff = ""; this.tgCpu = ""; this.xrayTemplateConfig = ""; diff --git a/web/controller/setting.go b/web/controller/setting.go index 0456bca314..cfdfe5d62c 100644 --- a/web/controller/setting.go +++ b/web/controller/setting.go @@ -33,6 +33,7 @@ func (a *SettingController) initRouter(g *gin.RouterGroup) { g = g.Group("/setting") g.POST("/all", a.getAllSetting) + g.POST("/thresholds", a.getThresholds) g.POST("/update", a.updateSetting) g.POST("/updateUser", a.updateUser) g.POST("/restartPanel", a.restartPanel) @@ -47,6 +48,24 @@ func (a *SettingController) getAllSetting(c *gin.Context) { jsonObj(c, allSetting, nil) } +func (a *SettingController) getThresholds(c *gin.Context) { + expireDiff, err := a.settingService.GetExpireDiff() + if err != nil { + jsonMsg(c, I18n(c, "pages.setting.toasts.getSetting"), err) + return + } + trafficDiff, err := a.settingService.GetTrafficDiff() + if err != nil { + jsonMsg(c, I18n(c, "pages.setting.toasts.getSetting"), err) + return + } + result := map[string]interface{}{ + "expireDiff": expireDiff, + "trafficDiff": trafficDiff, + } + jsonObj(c, result, nil) +} + func (a *SettingController) updateSetting(c *gin.Context) { allSetting := &entity.AllSetting{} err := c.ShouldBind(allSetting) diff --git a/web/entity/entity.go b/web/entity/entity.go index 372f5caaa4..b464de00b2 100644 --- a/web/entity/entity.go +++ b/web/entity/entity.go @@ -32,13 +32,13 @@ type AllSetting struct { WebCertFile string `json:"webCertFile" form:"webCertFile"` WebKeyFile string `json:"webKeyFile" form:"webKeyFile"` WebBasePath string `json:"webBasePath" form:"webBasePath"` + ExpireDiff int `json:"expireDiff" form:"expireDiff"` + TrafficDiff int `json:"trafficDiff" form:"trafficDiff"` TgBotEnable bool `json:"tgBotEnable" form:"tgBotEnable"` TgBotToken string `json:"tgBotToken" form:"tgBotToken"` TgBotChatId string `json:"tgBotChatId" form:"tgBotChatId"` TgRunTime string `json:"tgRunTime" form:"tgRunTime"` TgBotBackup bool `json:"tgBotBackup" form:"tgBotBackup"` - TgExpireDiff int `json:"tgExpireDiff" form:"tgExpireDiff"` - TgTrafficDiff int `json:"tgTrafficDiff" form:"tgTrafficDiff"` TgCpu int `json:"tgCpu" form:"tgCpu"` XrayTemplateConfig string `json:"xrayTemplateConfig" form:"xrayTemplateConfig"` TimeLocation string `json:"timeLocation" form:"timeLocation"` diff --git a/web/html/xui/form/client.html b/web/html/xui/form/client.html index 6b1b0f8f0e..1dac816568 100644 --- a/web/html/xui/form/client.html +++ b/web/html/xui/form/client.html @@ -30,7 +30,7 @@ - + diff --git a/web/html/xui/inbound_client_table.html b/web/html/xui/inbound_client_table.html index e2abeb1b36..024ded7cb2 100644 --- a/web/html/xui/inbound_client_table.html +++ b/web/html/xui/inbound_client_table.html @@ -26,7 +26,7 @@ {{ i18n "indefinite" }} - - {{ i18n "enabled" }} - {{ i18n "disabled" }} - + + + + + + + + + +
Subscription link[[ infoModal.subBase + infoModal.clientSettings.subId ]]
Telegram Username@[[ infoModal.clientSettings.tgId ]]
@@ -160,7 +178,6 @@