diff --git a/server/dev.go b/server/dev.go new file mode 100644 index 00000000..ea923af2 --- /dev/null +++ b/server/dev.go @@ -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, + }) + }) +} diff --git a/server/router.go b/server/router.go index 0398710e..068bd9dd 100644 --- a/server/router.go +++ b/server/router.go @@ -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) {