2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 14:57:16 +08:00

feat: 同步前端修改

This commit is contained in:
耗子
2023-10-30 21:11:02 +08:00
parent 914e4e1b7b
commit b8f5eccf9c
2 changed files with 11 additions and 8 deletions

View File

@@ -190,6 +190,9 @@ func (c *Fail2banController) List(ctx http.Context) http.Response {
endIndex = len(jails)
}
pagedJails := jails[startIndex:endIndex]
if pagedJails == nil {
pagedJails = []Jail{}
}
return controllers.Success(ctx, http.Json{
"total": len(jails),
@@ -363,7 +366,7 @@ func (c *Fail2banController) BanList(ctx http.Context) http.Response {
return check
}
name := ctx.Request().Query("name")
name := ctx.Request().Input("name")
if len(name) == 0 {
return controllers.Error(ctx, http.StatusUnprocessableEntity, "缺少参数")
}
@@ -384,9 +387,9 @@ func (c *Fail2banController) BanList(ctx http.Context) http.Response {
}
return controllers.Success(ctx, http.Json{
"currentlyBan": currentlyBan,
"totalBan": totalBan,
"bannedIpList": list,
"currently_ban": currentlyBan,
"total_ban": totalBan,
"baned_list": list,
})
}

View File

@@ -288,10 +288,10 @@ func Plugin() {
route.Post("stop", fail2banController.Stop)
route.Post("restart", fail2banController.Restart)
route.Post("reload", fail2banController.Reload)
route.Get("list", fail2banController.List)
route.Post("add", fail2banController.Add)
route.Post("delete", fail2banController.Delete)
route.Get("ban", fail2banController.BanList)
route.Get("jails", fail2banController.List)
route.Post("jails", fail2banController.Add)
route.Delete("jails", fail2banController.Delete)
route.Get("jails/{name}", fail2banController.BanList)
route.Post("unban", fail2banController.Unban)
route.Post("whiteList", fail2banController.SetWhiteList)
route.Get("whiteList", fail2banController.GetWhiteList)