mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: list files for shared folder
This commit is contained in:
@@ -20,13 +20,22 @@ func (fs *FileSystem) IsPathExist(path string) (bool, *model.Folder) {
|
||||
}
|
||||
|
||||
// 递归步入目录
|
||||
// TODO:装入树形缓存
|
||||
// TODO:测试新增
|
||||
var currentFolder *model.Folder
|
||||
|
||||
// 如果已设定目录对象,则从给定目录向下遍历
|
||||
if len(fs.DirTarget) > 0 {
|
||||
currentFolder = &fs.DirTarget[0]
|
||||
}
|
||||
|
||||
for _, folderName := range pathList {
|
||||
var err error
|
||||
|
||||
// 根目录
|
||||
if folderName == "/" {
|
||||
if currentFolder != nil {
|
||||
continue
|
||||
}
|
||||
currentFolder, err = fs.User.Root()
|
||||
if err != nil {
|
||||
return false, nil
|
||||
|
||||
@@ -31,6 +31,8 @@ func BuildSiteConfig(settings map[string]string, user *model.User) Response {
|
||||
var userRes User
|
||||
if user != nil {
|
||||
userRes = BuildUser(*user)
|
||||
} else {
|
||||
userRes = BuildUser(*model.NewAnonymousUser())
|
||||
}
|
||||
return Response{
|
||||
Data: SiteConfig{
|
||||
|
||||
@@ -43,6 +43,7 @@ type group struct {
|
||||
AllowTorrentDownload bool `json:"allowTorrentDownload"`
|
||||
AllowArchiveDownload bool `json:"allowArchiveDownload"`
|
||||
ShareFreeEnabled bool `json:"shareFree"`
|
||||
ShareDownload bool `json:"shareDownload"`
|
||||
}
|
||||
|
||||
type storage struct {
|
||||
@@ -78,6 +79,7 @@ func BuildUser(user model.User) User {
|
||||
AllowTorrentDownload: aria2Option[2],
|
||||
AllowArchiveDownload: user.Group.OptionsSerialized.ArchiveDownloadEnabled,
|
||||
ShareFreeEnabled: user.Group.OptionsSerialized.ShareFreeEnabled,
|
||||
ShareDownload: user.Group.OptionsSerialized.ShareDownloadEnabled,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user