chore: set guest while token is empty

This commit is contained in:
Noah Hsu
2022-06-26 16:39:02 +08:00
parent 54ca68e4b3
commit 7cbfe93a02
6 changed files with 31 additions and 8 deletions

View File

@@ -4,6 +4,7 @@ import (
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/server/common"
"github.com/alist-org/alist/v3/internal/server/controllers"
"github.com/alist-org/alist/v3/internal/server/middlewares"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
)
@@ -12,8 +13,9 @@ func Init(r *gin.Engine) {
common.SecretKey = []byte(conf.Conf.JwtSecret)
Cors(r)
api := r.Group("/api")
api := r.Group("/api", middlewares.Auth)
api.POST("/user/login", controllers.Login)
api.GET("/user/current", controllers.CurrentUser)
}
func Cors(r *gin.Engine) {