mirror of
https://github.com/swissmakers/fail2ban-ui.git
synced 2026-04-19 06:53:14 +02:00
Added new clear function-calls for the recent-stored-events and as well the permanent-block list
This commit is contained in:
@@ -555,6 +555,16 @@ func BanInsightsHandler(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// Deletes all stored ban event records.
|
||||
func ClearBanEventsHandler(c *gin.Context) {
|
||||
deleted, err := storage.ClearBanEvents(c.Request.Context())
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"deleted": deleted})
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Fail2ban Servers Management
|
||||
// =========================================================================
|
||||
@@ -1631,6 +1641,16 @@ func ListPermanentBlocksHandler(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{"blocks": records})
|
||||
}
|
||||
|
||||
// Deletes all permanent block records.
|
||||
func ClearPermanentBlocksHandler(c *gin.Context) {
|
||||
deleted, err := storage.ClearPermanentBlocks(c.Request.Context())
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"deleted": deleted})
|
||||
}
|
||||
|
||||
// Allows manual block/unblock against the configured integration.
|
||||
func AdvancedActionsTestHandler(c *gin.Context) {
|
||||
var req struct {
|
||||
|
||||
Reference in New Issue
Block a user