Added new clear function-calls for the recent-stored-events and as well the permanent-block list

This commit is contained in:
2026-02-21 17:23:33 +01:00
parent c85d51edd6
commit 3e06cfc1ab
12 changed files with 138 additions and 11 deletions

View File

@@ -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 {