This commit is contained in:
wjqserver 2025-03-18 21:53:59 +08:00
parent ac7e1e43b5
commit a92bbb7fb6
22 changed files with 685 additions and 316 deletions

View file

@ -4,16 +4,16 @@ import (
"fmt"
"ghproxy/config"
"github.com/gin-gonic/gin"
"github.com/cloudwego/hertz/pkg/app"
)
func AuthParametersHandler(c *gin.Context, cfg *config.Config) (isValid bool, err error) {
func AuthParametersHandler(c *app.RequestContext, cfg *config.Config) (isValid bool, err error) {
if !cfg.Auth.Enabled {
return true, nil
}
authToken := c.Query("auth_token")
logDebug("%s %s %s %s %s AUTH_TOKEN: %s", c.ClientIP(), c.Request.Method, c.Request.URL.Path, c.Request.UserAgent(), c.Request.Proto, authToken)
logDebug("%s %s %s %s %s AUTH_TOKEN: %s", c.ClientIP(), c.Request.Method, string(c.Path()), c.Request.Header.UserAgent(), c.Request.Header.GetProtocol(), authToken)
if authToken == "" {
return false, fmt.Errorf("Auth token not found")