feat: add SproutWorkCollect apps

This commit is contained in:
2026-03-13 17:14:37 +08:00
parent 189baa3d59
commit 46afd3149f
54 changed files with 28126 additions and 4 deletions

View File

@@ -0,0 +1,27 @@
package middleware
import (
"net/http"
"github.com/gin-gonic/gin"
)
// AdminAuth returns a Gin middleware that validates the admin token.
// The token may be supplied via the `token` query parameter or the
// `Authorization` request header.
func AdminAuth(token string) gin.HandlerFunc {
return func(c *gin.Context) {
t := c.Query("token")
if t == "" {
t = c.GetHeader("Authorization")
}
if t != token {
c.AbortWithStatusJSON(http.StatusForbidden, gin.H{
"success": false,
"message": "权限不足",
})
return
}
c.Next()
}
}