feat: obj list api
This commit is contained in:
@ -2,7 +2,6 @@ package fs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/alist-org/alist/v3/internal/db"
|
||||
"github.com/alist-org/alist/v3/internal/model"
|
||||
"github.com/alist-org/alist/v3/internal/operations"
|
||||
"github.com/alist-org/alist/v3/pkg/utils"
|
||||
@ -13,7 +12,7 @@ import (
|
||||
// List files
|
||||
// TODO: sort
|
||||
func list(ctx context.Context, path string) ([]model.Obj, error) {
|
||||
meta, _ := db.GetNearestMeta(path)
|
||||
meta := ctx.Value("meta").(*model.Meta)
|
||||
user := ctx.Value("user").(*model.User)
|
||||
account, actualPath, err := operations.GetAccountAndActualPath(path)
|
||||
virtualFiles := operations.GetAccountVirtualFilesByPath(path)
|
||||
|
@ -1,7 +1,6 @@
|
||||
package fs
|
||||
|
||||
import (
|
||||
"github.com/alist-org/alist/v3/pkg/utils"
|
||||
"io"
|
||||
"mime"
|
||||
"net/http"
|
||||
@ -64,19 +63,3 @@ func getFileStreamFromLink(file model.Obj, link *model.Link) (model.FileStreamer
|
||||
}
|
||||
return stream, nil
|
||||
}
|
||||
|
||||
func canAccess(user *model.User, meta *model.Meta, path string) bool {
|
||||
// if is not guest, can access
|
||||
if user.IsAdmin() || user.IgnorePassword {
|
||||
return true
|
||||
}
|
||||
// if meta is nil or password is empty, can access
|
||||
if meta == nil || meta.Password == "" {
|
||||
return true
|
||||
}
|
||||
// if meta doesn't apply to sub_folder, can access
|
||||
if !utils.PathEqual(meta.Path, path) && !meta.SubFolder {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user