fix: move ALTCHA endpoints to correct v1 group location

- Move test and ALTCHA endpoints inside the v1 group where they belong
- Fix route registration issue by placing routes in correct scope
- Both auth and admin ALTCHA challenge endpoints should now work
This commit is contained in:
Patrick Britton 2026-02-16 22:49:42 -06:00
parent 050fb89bfe
commit 797661ab9b

View file

@ -262,13 +262,13 @@ func main() {
} }
// Test endpoint to verify routing // Test endpoint to verify routing
r.GET("/api/v1/test", func(c *gin.Context) { v1.GET("/test", func(c *gin.Context) {
c.JSON(200, gin.H{"message": "Route test successful"}) c.JSON(200, gin.H{"message": "Route test successful"})
}) })
// ALTCHA challenge endpoint (no rate limiting) // ALTCHA challenge endpoints (no rate limiting)
v1.GET("/auth/altcha-challenge", authHandler.GetAltchaChallenge) v1.GET("/auth/altcha-challenge", authHandler.GetAltchaChallenge)
r.GET("/api/v1/admin/altcha-challenge", adminHandler.GetAltchaChallenge) v1.GET("/admin/altcha-challenge", adminHandler.GetAltchaChallenge)
authorized := v1.Group("") authorized := v1.Group("")
authorized.Use(middleware.AuthMiddleware(cfg.JWTSecret, dbPool)) authorized.Use(middleware.AuthMiddleware(cfg.JWTSecret, dbPool))