cache reset on reparse

This commit is contained in:
Simon Martens
2025-05-20 17:13:54 +02:00
parent 625cf05322
commit b5b682794a
2 changed files with 4 additions and 2 deletions

View File

@@ -44,7 +44,7 @@ func Register(server server.Server, cfg config.Config) {
// INFO: we map the webhook when a secret was provided
if cfg.WebHookSecret != "" {
server.Server.Post(cfg.WebHookEndpoint, PostWebhook(cfg))
server.Server.Post(cfg.WebHookEndpoint, PostWebhook(cfg, server))
}
}

View File

@@ -9,13 +9,14 @@ import (
"github.com/Theodor-Springmann-Stiftung/lenz-web/config"
gitprovider "github.com/Theodor-Springmann-Stiftung/lenz-web/git"
"github.com/Theodor-Springmann-Stiftung/lenz-web/server"
"github.com/Theodor-Springmann-Stiftung/lenz-web/xmlmodels"
"github.com/gofiber/fiber/v2"
)
const SIGNATURE_PREFIX = "sha256="
func PostWebhook(cfg config.Config) fiber.Handler {
func PostWebhook(cfg config.Config, server server.Server) fiber.Handler {
return func(c *fiber.Ctx) error {
body := c.Body()
if !verifySignature256([]byte(cfg.WebHookSecret), body, c.Get("X-Hub-Signature-256")) {
@@ -38,6 +39,7 @@ func PostWebhook(cfg config.Config) fiber.Handler {
return c.SendStatus(fiber.StatusInternalServerError)
}
server.Cache.Reset()
return c.SendStatus(fiber.StatusOK)
}
}