From b5b682794a56a15ff21a16c19db0e77fe46a2494 Mon Sep 17 00:00:00 2001 From: Simon Martens Date: Tue, 20 May 2025 17:13:54 +0200 Subject: [PATCH] cache reset on reparse --- controllers/routes.go | 2 +- controllers/webhook.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/controllers/routes.go b/controllers/routes.go index 31d9cbc..7b03ec0 100644 --- a/controllers/routes.go +++ b/controllers/routes.go @@ -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)) } } diff --git a/controllers/webhook.go b/controllers/webhook.go index 1cb9aa4..588c59d 100644 --- a/controllers/webhook.go +++ b/controllers/webhook.go @@ -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) } }