mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-06 07:36:37 +08:00
5016103774
- Created `internal/router/v1` subpackage - Split routes into `admin.go`, `user.go`, `public.go`, and `custom.go` - Cleaned up imports and helper registration functions from `router.go` - Removed obsolete `internal/router/custom.go`
40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// Package v1 contains router registrations for API V1
|
|
package v1
|
|
|
|
import (
|
|
capApp "github.com/Rain-kl/Wavelet/internal/apps/cap"
|
|
publicconfig "github.com/Rain-kl/Wavelet/internal/apps/config"
|
|
"github.com/Rain-kl/Wavelet/internal/apps/health"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// RegisterPublicRoutes registers all public routes (captcha, health, config).
|
|
func RegisterPublicRoutes(apiV1Router *gin.RouterGroup, apiGroup *gin.RouterGroup) {
|
|
// CAPTCHA
|
|
registerCaptchaRoutes(apiGroup)
|
|
|
|
// Health
|
|
apiGroup.GET("/health", health.Health)
|
|
|
|
// Config (public)
|
|
registerConfigRoutes(apiV1Router)
|
|
}
|
|
|
|
func registerCaptchaRoutes(apiGroup *gin.RouterGroup) {
|
|
capGroup := apiGroup.Group("/cap")
|
|
{
|
|
capGroup.POST("/challenge", capApp.Challenge)
|
|
capGroup.POST("/redeem", capApp.Redeem)
|
|
}
|
|
}
|
|
|
|
func registerConfigRoutes(apiV1Router *gin.RouterGroup) {
|
|
configRouter := apiV1Router.Group("/config")
|
|
{
|
|
configRouter.GET("/public", publicconfig.GetPublicConfig)
|
|
}
|
|
}
|