chore: dev test

pull/1604/head
Noah Hsu 2022-08-02 22:16:58 +08:00
parent c7128133d6
commit 71a6ebaf43
2 changed files with 19 additions and 0 deletions

15
server/dev.go Normal file
View File

@ -0,0 +1,15 @@
package server
import (
"github.com/alist-org/alist/v3/server/middlewares"
"github.com/gin-gonic/gin"
)
func dev(g *gin.RouterGroup) {
g.GET("/path/*path", middlewares.Down, func(ctx *gin.Context) {
rawPath := ctx.MustGet("path").(string)
ctx.JSON(200, gin.H{
"path": rawPath,
})
})
}

View File

@ -1,6 +1,7 @@
package server
import (
"github.com/alist-org/alist/v3/cmd/args"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/message"
"github.com/alist-org/alist/v3/server/common"
@ -31,6 +32,9 @@ func Init(r *gin.Engine) {
fs(auth.Group("/fs"))
admin(auth.Group("/admin", middlewares.AuthAdmin))
if args.Dev {
dev(r.Group("/dev"))
}
}
func admin(g *gin.RouterGroup) {