mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: list objects in specific path
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
// CreateDirectory 创建目录
|
||||
func CreateDirectory(c *gin.Context) {
|
||||
var service explorer.DirectoryCreateService
|
||||
var service explorer.DirectoryService
|
||||
if err := c.ShouldBindJSON(&service); err == nil {
|
||||
res := service.CreateDirectory(c)
|
||||
c.JSON(200, res)
|
||||
@@ -15,3 +15,14 @@ func CreateDirectory(c *gin.Context) {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
|
||||
// ListDirectory 列出目录下内容
|
||||
func ListDirectory(c *gin.Context) {
|
||||
var service explorer.DirectoryService
|
||||
if err := c.ShouldBindJSON(&service); err == nil {
|
||||
res := service.ListDirectory(c)
|
||||
c.JSON(200, res)
|
||||
} else {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,10 +37,9 @@ func FileUploadStream(c *gin.Context) {
|
||||
Name: c.Request.Header.Get("X-FileName"),
|
||||
VirtualPath: util.DotPathToStandardPath(c.Request.Header.Get("X-Path")),
|
||||
}
|
||||
user, _ := c.Get("user")
|
||||
|
||||
// 创建文件系统
|
||||
fs, err := filesystem.NewFileSystem(user.(*model.User))
|
||||
fs, err := filesystem.NewFileSystemFromContext(c)
|
||||
if err != nil {
|
||||
c.JSON(200, serializer.Err(serializer.CodePolicyNotAllowed, err.Error(), err))
|
||||
return
|
||||
|
||||
@@ -69,6 +69,8 @@ func InitRouter() *gin.Engine {
|
||||
{
|
||||
// 创建目录
|
||||
directory.PUT("", controllers.CreateDirectory)
|
||||
// 列出目录下内容
|
||||
directory.GET("", controllers.ListDirectory)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user