From 536bce4625e468c722d8a775918ba2300215809f Mon Sep 17 00:00:00 2001 From: Nuxgrid Date: Sat, 11 Jul 2026 19:58:15 +0200 Subject: [PATCH] chore: build --- backend/gestion/handlers/crypto_payment.go | 2 +- backend/gestion/routes/routes.go | 10 +++++----- docker-prod/backend/nginx.conf | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/backend/gestion/handlers/crypto_payment.go b/backend/gestion/handlers/crypto_payment.go index 765cfeea..dc386893 100644 --- a/backend/gestion/handlers/crypto_payment.go +++ b/backend/gestion/handlers/crypto_payment.go @@ -12,7 +12,7 @@ import ( "github.com/gin-gonic/gin" ) -// IPNWebhook - POST /api/v1/webhooks/nowpayments +// IPNWebhook - POST /api/v1/webhook/nowpayments func IPNWebhook(c *gin.Context) { database := c.MustGet("database").(*db.Database) np, ok := c.MustGet("nowpayments").(*services.NowPaymentsClient) diff --git a/backend/gestion/routes/routes.go b/backend/gestion/routes/routes.go index cd3121d4..006e41c6 100644 --- a/backend/gestion/routes/routes.go +++ b/backend/gestion/routes/routes.go @@ -123,7 +123,7 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services // ============================================ // 💸 WEBHOOK NOWPAYMENTS (v1) - PUBLIC (pas d'auth, vérifié par HMAC) // ============================================ - router.POST("/api/v1/webhooks/nowpayments", handlers.IPNWebhook) + router.POST("/api/v1/webhook/nowpayments", handlers.IPNWebhook) // ============================================ // 🤖 WEBHOOK TELEGRAM - PUBLIC (sécurisé par secret header) @@ -268,10 +268,10 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services adminGroupV2.POST("/penalty", handlers.ApplyClientPenalty) // Appliquer pénalité adminGroupV2.GET("/client/:username/penalties", handlers.GetClientPenaltiesAdmin) // Voir pénalités client adminGroupV2.POST("/client/:username/penalties/reset", handlers.ResetClientPenaltiesAdmin) // Reset amende - adminGroupV2.POST("/client/:username/point/reset", handlers.ResetClientPointAdmin) // Reset points → 0 - adminGroupV2.POST("/client/:username/points/add", handlers.AddClientPointsAdmin) // Ajouter points par pool - adminGroupV2.POST("/client/:username/points/subtract", handlers.SubtractClientPointsAdmin) // Enlever points par pool - adminGroupV2.POST("/client/:username/rewards/reset", handlers.AdminResetClientRedeemed) // Reset récompenses réclamées + adminGroupV2.POST("/client/:username/point/reset", handlers.ResetClientPointAdmin) // Reset points → 0 + adminGroupV2.POST("/client/:username/points/add", handlers.AddClientPointsAdmin) // Ajouter points par pool + adminGroupV2.POST("/client/:username/points/subtract", handlers.SubtractClientPointsAdmin) // Enlever points par pool + adminGroupV2.POST("/client/:username/rewards/reset", handlers.AdminResetClientRedeemed) // Reset récompenses réclamées adminGroupV2.GET("/penalties/all", handlers.GetAllClientsWithPenalties) // Liste clients avec pénalités adminGroupV2.GET("/penalties/stats", handlers.GetPenaltiesStats) diff --git a/docker-prod/backend/nginx.conf b/docker-prod/backend/nginx.conf index 557db88f..115e7da6 100644 --- a/docker-prod/backend/nginx.conf +++ b/docker-prod/backend/nginx.conf @@ -141,6 +141,20 @@ server { proxy_set_header X-Forwarded-Proto $scheme; } + location = /webhook/nowpayement { + limit_except POST { deny all; } + + set $upstream_backend http://backend:8080; + proxy_pass $upstream_backend; + proxy_http_version 1.1; + proxy_set_header Connection ""; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + # --------------------------------------------------- # Webhooks LBTelegram (/webhook/bot1, /webhook/bot2…) # ---------------------------------------------------