2022-07-11 09:12:50 +00:00
|
|
|
package handles
|
2022-06-27 11:51:23 +00:00
|
|
|
|
|
|
|
import (
|
2022-06-29 08:23:31 +00:00
|
|
|
"fmt"
|
2022-06-28 10:12:53 +00:00
|
|
|
stdpath "path"
|
2022-06-29 08:23:31 +00:00
|
|
|
"strings"
|
2022-06-28 10:12:53 +00:00
|
|
|
"time"
|
|
|
|
|
2023-03-26 08:19:01 +00:00
|
|
|
"github.com/alist-org/alist/v3/internal/conf"
|
2022-06-28 10:00:11 +00:00
|
|
|
"github.com/alist-org/alist/v3/internal/errs"
|
2022-06-27 11:51:23 +00:00
|
|
|
"github.com/alist-org/alist/v3/internal/fs"
|
|
|
|
"github.com/alist-org/alist/v3/internal/model"
|
2022-12-18 11:51:20 +00:00
|
|
|
"github.com/alist-org/alist/v3/internal/op"
|
2023-03-26 08:19:01 +00:00
|
|
|
"github.com/alist-org/alist/v3/internal/setting"
|
2022-08-03 05:03:45 +00:00
|
|
|
"github.com/alist-org/alist/v3/internal/sign"
|
2022-06-27 11:51:23 +00:00
|
|
|
"github.com/alist-org/alist/v3/pkg/utils"
|
|
|
|
"github.com/alist-org/alist/v3/server/common"
|
|
|
|
"github.com/gin-gonic/gin"
|
2022-06-28 10:00:11 +00:00
|
|
|
"github.com/pkg/errors"
|
2022-06-27 11:51:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ListReq struct {
|
2022-11-28 05:45:25 +00:00
|
|
|
model.PageReq
|
2022-06-27 11:51:23 +00:00
|
|
|
Path string `json:"path" form:"path"`
|
|
|
|
Password string `json:"password" form:"password"`
|
2022-08-29 11:15:52 +00:00
|
|
|
Refresh bool `json:"refresh"`
|
2022-06-27 11:51:23 +00:00
|
|
|
}
|
|
|
|
|
2022-07-10 06:09:31 +00:00
|
|
|
type DirReq struct {
|
2022-09-14 11:57:39 +00:00
|
|
|
Path string `json:"path" form:"path"`
|
|
|
|
Password string `json:"password" form:"password"`
|
|
|
|
ForceRoot bool `json:"force_root" form:"force_root"`
|
2022-07-10 06:09:31 +00:00
|
|
|
}
|
|
|
|
|
2022-06-27 11:51:23 +00:00
|
|
|
type ObjResp struct {
|
2023-09-22 07:20:04 +00:00
|
|
|
Name string `json:"name"`
|
|
|
|
Size int64 `json:"size"`
|
|
|
|
IsDir bool `json:"is_dir"`
|
|
|
|
Modified time.Time `json:"modified"`
|
|
|
|
Created time.Time `json:"created"`
|
|
|
|
Sign string `json:"sign"`
|
|
|
|
Thumb string `json:"thumb"`
|
|
|
|
Type int `json:"type"`
|
|
|
|
HashInfoStr string `json:"hashinfo"`
|
|
|
|
HashInfo map[*utils.HashType]string `json:"hash_info"`
|
2022-06-27 11:51:23 +00:00
|
|
|
}
|
|
|
|
|
2022-06-27 13:15:39 +00:00
|
|
|
type FsListResp struct {
|
2022-09-22 08:04:10 +00:00
|
|
|
Content []ObjResp `json:"content"`
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
Readme string `json:"readme"`
|
2023-10-02 08:43:29 +00:00
|
|
|
Header string `json:"header"`
|
2022-09-22 08:04:10 +00:00
|
|
|
Write bool `json:"write"`
|
|
|
|
Provider string `json:"provider"`
|
2022-06-27 11:51:23 +00:00
|
|
|
}
|
|
|
|
|
2022-06-27 13:15:39 +00:00
|
|
|
func FsList(c *gin.Context) {
|
2022-06-27 11:51:23 +00:00
|
|
|
var req ListReq
|
|
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
|
|
common.ErrorResp(c, err, 400)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
req.Validate()
|
|
|
|
user := c.MustGet("user").(*model.User)
|
2022-11-30 13:38:00 +00:00
|
|
|
reqPath, err := user.JoinPath(req.Path)
|
|
|
|
if err != nil {
|
|
|
|
common.ErrorResp(c, err, 403)
|
|
|
|
return
|
|
|
|
}
|
2022-12-18 11:51:20 +00:00
|
|
|
meta, err := op.GetNearestMeta(reqPath)
|
2022-06-28 10:00:11 +00:00
|
|
|
if err != nil {
|
|
|
|
if !errors.Is(errors.Cause(err), errs.MetaNotFound) {
|
|
|
|
common.ErrorResp(c, err, 500, true)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
2022-06-27 11:51:23 +00:00
|
|
|
c.Set("meta", meta)
|
2022-11-30 13:38:00 +00:00
|
|
|
if !common.CanAccess(user, meta, reqPath, req.Password) {
|
2022-11-30 14:01:33 +00:00
|
|
|
common.ErrorStrResp(c, "password is incorrect or you have no permission", 403)
|
2022-06-27 11:51:23 +00:00
|
|
|
return
|
|
|
|
}
|
2022-11-30 13:38:00 +00:00
|
|
|
if !user.CanWrite() && !common.CanWrite(meta, reqPath) && req.Refresh {
|
2022-08-29 11:15:52 +00:00
|
|
|
common.ErrorStrResp(c, "Refresh without permission", 403)
|
|
|
|
return
|
|
|
|
}
|
2023-04-06 16:02:07 +00:00
|
|
|
objs, err := fs.List(c, reqPath, &fs.ListArgs{Refresh: req.Refresh})
|
2022-06-27 11:51:23 +00:00
|
|
|
if err != nil {
|
2022-06-28 10:12:53 +00:00
|
|
|
common.ErrorResp(c, err, 500)
|
2022-06-27 11:51:23 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
total, objs := pagination(objs, &req.PageReq)
|
2022-09-22 08:04:10 +00:00
|
|
|
provider := "unknown"
|
2023-04-06 16:02:07 +00:00
|
|
|
storage, err := fs.GetStorage(reqPath, &fs.GetStoragesArgs{})
|
2022-09-22 08:04:10 +00:00
|
|
|
if err == nil {
|
|
|
|
provider = storage.GetStorage().Driver
|
|
|
|
}
|
2022-06-27 13:15:39 +00:00
|
|
|
common.SuccessResp(c, FsListResp{
|
2022-11-30 13:38:00 +00:00
|
|
|
Content: toObjsResp(objs, reqPath, isEncrypt(meta, reqPath)),
|
2022-09-22 08:04:10 +00:00
|
|
|
Total: int64(total),
|
2022-11-30 13:38:00 +00:00
|
|
|
Readme: getReadme(meta, reqPath),
|
2023-10-02 08:43:29 +00:00
|
|
|
Header: getHeader(meta, reqPath),
|
2022-11-30 13:38:00 +00:00
|
|
|
Write: user.CanWrite() || common.CanWrite(meta, reqPath),
|
2022-09-22 08:04:10 +00:00
|
|
|
Provider: provider,
|
2022-06-27 11:51:23 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-07-10 06:09:31 +00:00
|
|
|
func FsDirs(c *gin.Context) {
|
|
|
|
var req DirReq
|
|
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
|
|
common.ErrorResp(c, err, 400)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
user := c.MustGet("user").(*model.User)
|
2022-11-30 14:01:33 +00:00
|
|
|
reqPath := req.Path
|
2022-09-14 11:57:39 +00:00
|
|
|
if req.ForceRoot {
|
|
|
|
if !user.IsAdmin() {
|
|
|
|
common.ErrorStrResp(c, "Permission denied", 403)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
} else {
|
2022-11-30 13:38:00 +00:00
|
|
|
tmp, err := user.JoinPath(req.Path)
|
|
|
|
if err != nil {
|
|
|
|
common.ErrorResp(c, err, 403)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
reqPath = tmp
|
2022-09-14 11:57:39 +00:00
|
|
|
}
|
2022-12-18 11:51:20 +00:00
|
|
|
meta, err := op.GetNearestMeta(reqPath)
|
2022-07-10 06:09:31 +00:00
|
|
|
if err != nil {
|
|
|
|
if !errors.Is(errors.Cause(err), errs.MetaNotFound) {
|
|
|
|
common.ErrorResp(c, err, 500, true)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
c.Set("meta", meta)
|
2022-11-30 13:38:00 +00:00
|
|
|
if !common.CanAccess(user, meta, reqPath, req.Password) {
|
2022-11-30 14:01:33 +00:00
|
|
|
common.ErrorStrResp(c, "password is incorrect or you have no permission", 403)
|
2022-07-10 06:09:31 +00:00
|
|
|
return
|
|
|
|
}
|
2023-04-06 16:02:07 +00:00
|
|
|
objs, err := fs.List(c, reqPath, &fs.ListArgs{})
|
2022-07-10 06:09:31 +00:00
|
|
|
if err != nil {
|
|
|
|
common.ErrorResp(c, err, 500)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
dirs := filterDirs(objs)
|
|
|
|
common.SuccessResp(c, dirs)
|
|
|
|
}
|
|
|
|
|
|
|
|
type DirResp struct {
|
|
|
|
Name string `json:"name"`
|
|
|
|
Modified time.Time `json:"modified"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func filterDirs(objs []model.Obj) []DirResp {
|
|
|
|
var dirs []DirResp
|
|
|
|
for _, obj := range objs {
|
|
|
|
if obj.IsDir() {
|
|
|
|
dirs = append(dirs, DirResp{
|
2022-11-30 12:46:54 +00:00
|
|
|
Name: obj.GetName(),
|
2022-07-10 06:09:31 +00:00
|
|
|
Modified: obj.ModTime(),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return dirs
|
|
|
|
}
|
|
|
|
|
2022-06-30 07:41:58 +00:00
|
|
|
func getReadme(meta *model.Meta, path string) string {
|
|
|
|
if meta != nil && (utils.PathEqual(meta.Path, path) || meta.RSub) {
|
|
|
|
return meta.Readme
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2023-10-02 08:43:29 +00:00
|
|
|
func getHeader(meta *model.Meta, path string) string {
|
|
|
|
if meta != nil && (utils.PathEqual(meta.Path, path) || meta.HeaderSub) {
|
|
|
|
return meta.Header
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2022-09-11 06:14:14 +00:00
|
|
|
func isEncrypt(meta *model.Meta, path string) bool {
|
2023-03-24 14:44:33 +00:00
|
|
|
if common.IsStorageSignEnabled(path) {
|
|
|
|
return true
|
|
|
|
}
|
2022-09-11 06:14:14 +00:00
|
|
|
if meta == nil || meta.Password == "" {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if !utils.PathEqual(meta.Path, path) && !meta.PSub {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2022-11-28 05:45:25 +00:00
|
|
|
func pagination(objs []model.Obj, req *model.PageReq) (int, []model.Obj) {
|
2022-08-14 15:46:30 +00:00
|
|
|
pageIndex, pageSize := req.Page, req.PerPage
|
2022-06-27 11:51:23 +00:00
|
|
|
total := len(objs)
|
|
|
|
start := (pageIndex - 1) * pageSize
|
|
|
|
if start > total {
|
|
|
|
return total, []model.Obj{}
|
|
|
|
}
|
|
|
|
end := start + pageSize
|
|
|
|
if end > total {
|
|
|
|
end = total
|
|
|
|
}
|
|
|
|
return total, objs[start:end]
|
|
|
|
}
|
|
|
|
|
2022-11-28 05:45:25 +00:00
|
|
|
func toObjsResp(objs []model.Obj, parent string, encrypt bool) []ObjResp {
|
2022-06-27 11:51:23 +00:00
|
|
|
var resp []ObjResp
|
|
|
|
for _, obj := range objs {
|
2022-12-20 07:02:40 +00:00
|
|
|
thumb, _ := model.GetThumb(obj)
|
2022-06-27 11:51:23 +00:00
|
|
|
resp = append(resp, ObjResp{
|
2023-09-22 07:20:04 +00:00
|
|
|
Name: obj.GetName(),
|
|
|
|
Size: obj.GetSize(),
|
|
|
|
IsDir: obj.IsDir(),
|
|
|
|
Modified: obj.ModTime(),
|
|
|
|
Created: obj.CreateTime(),
|
|
|
|
HashInfoStr: obj.GetHash().String(),
|
|
|
|
HashInfo: obj.GetHash().Export(),
|
|
|
|
Sign: common.Sign(obj, parent, encrypt),
|
|
|
|
Thumb: thumb,
|
|
|
|
Type: utils.GetObjType(obj.GetName(), obj.IsDir()),
|
2022-06-27 11:51:23 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
return resp
|
|
|
|
}
|
2022-06-29 08:08:55 +00:00
|
|
|
|
2022-08-14 15:46:30 +00:00
|
|
|
type FsGetReq struct {
|
2022-06-29 08:08:55 +00:00
|
|
|
Path string `json:"path" form:"path"`
|
|
|
|
Password string `json:"password" form:"password"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type FsGetResp struct {
|
|
|
|
ObjResp
|
2022-08-10 02:48:14 +00:00
|
|
|
RawURL string `json:"raw_url"`
|
|
|
|
Readme string `json:"readme"`
|
2023-10-02 08:43:29 +00:00
|
|
|
Header string `json:"header"`
|
2022-08-10 02:48:14 +00:00
|
|
|
Provider string `json:"provider"`
|
|
|
|
Related []ObjResp `json:"related"`
|
2022-06-29 08:08:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func FsGet(c *gin.Context) {
|
2022-08-14 15:46:30 +00:00
|
|
|
var req FsGetReq
|
2022-06-29 08:08:55 +00:00
|
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
|
|
common.ErrorResp(c, err, 400)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
user := c.MustGet("user").(*model.User)
|
2022-11-30 13:38:00 +00:00
|
|
|
reqPath, err := user.JoinPath(req.Path)
|
|
|
|
if err != nil {
|
|
|
|
common.ErrorResp(c, err, 403)
|
|
|
|
return
|
|
|
|
}
|
2022-12-18 11:51:20 +00:00
|
|
|
meta, err := op.GetNearestMeta(reqPath)
|
2022-06-29 08:08:55 +00:00
|
|
|
if err != nil {
|
|
|
|
if !errors.Is(errors.Cause(err), errs.MetaNotFound) {
|
|
|
|
common.ErrorResp(c, err, 500)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
c.Set("meta", meta)
|
2022-11-30 13:38:00 +00:00
|
|
|
if !common.CanAccess(user, meta, reqPath, req.Password) {
|
2022-11-30 14:01:33 +00:00
|
|
|
common.ErrorStrResp(c, "password is incorrect or you have no permission", 403)
|
2022-06-29 08:08:55 +00:00
|
|
|
return
|
|
|
|
}
|
2023-04-06 16:02:07 +00:00
|
|
|
obj, err := fs.Get(c, reqPath, &fs.GetArgs{})
|
2022-06-29 08:08:55 +00:00
|
|
|
if err != nil {
|
|
|
|
common.ErrorResp(c, err, 500)
|
|
|
|
return
|
|
|
|
}
|
2022-06-29 08:23:31 +00:00
|
|
|
var rawURL string
|
2022-08-07 16:58:32 +00:00
|
|
|
|
2023-04-06 16:02:07 +00:00
|
|
|
storage, err := fs.GetStorage(reqPath, &fs.GetStoragesArgs{})
|
2022-08-07 16:58:32 +00:00
|
|
|
provider := "unknown"
|
|
|
|
if err == nil {
|
|
|
|
provider = storage.Config().Name
|
|
|
|
}
|
2022-07-08 07:56:29 +00:00
|
|
|
if !obj.IsDir() {
|
2022-09-13 12:02:57 +00:00
|
|
|
if err != nil {
|
|
|
|
common.ErrorResp(c, err, 500)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if storage.Config().MustProxy() || storage.GetStorage().WebProxy {
|
2023-03-24 14:44:33 +00:00
|
|
|
query := ""
|
2023-03-26 08:19:01 +00:00
|
|
|
if isEncrypt(meta, reqPath) || setting.GetBool(conf.SignAll) {
|
2023-03-24 14:44:33 +00:00
|
|
|
query = "?sign=" + sign.Sign(reqPath)
|
|
|
|
}
|
2022-09-13 12:02:57 +00:00
|
|
|
if storage.GetStorage().DownProxyUrl != "" {
|
2022-11-06 06:46:47 +00:00
|
|
|
rawURL = fmt.Sprintf("%s%s?sign=%s",
|
|
|
|
strings.Split(storage.GetStorage().DownProxyUrl, "\n")[0],
|
2022-11-30 13:38:00 +00:00
|
|
|
utils.EncodePath(reqPath, true),
|
|
|
|
sign.Sign(reqPath))
|
2022-09-13 12:02:57 +00:00
|
|
|
} else {
|
2023-03-24 14:44:33 +00:00
|
|
|
rawURL = fmt.Sprintf("%s/p%s%s",
|
2022-09-13 12:02:57 +00:00
|
|
|
common.GetApiUrl(c.Request),
|
2022-11-30 13:38:00 +00:00
|
|
|
utils.EncodePath(reqPath, true),
|
2023-03-24 14:44:33 +00:00
|
|
|
query)
|
2022-08-07 16:58:32 +00:00
|
|
|
}
|
2022-09-13 12:02:57 +00:00
|
|
|
} else {
|
|
|
|
// file have raw url
|
2022-12-20 07:02:40 +00:00
|
|
|
if url, ok := model.GetUrl(obj); ok {
|
|
|
|
rawURL = url
|
2022-07-08 07:56:29 +00:00
|
|
|
} else {
|
2022-07-10 06:45:39 +00:00
|
|
|
// if storage is not proxy, use raw url by fs.Link
|
2023-05-18 16:12:17 +00:00
|
|
|
link, _, err := fs.Link(c, reqPath, model.LinkArgs{
|
|
|
|
IP: c.ClientIP(),
|
|
|
|
Header: c.Request.Header,
|
|
|
|
HttpReq: c.Request,
|
|
|
|
})
|
2022-07-08 07:56:29 +00:00
|
|
|
if err != nil {
|
|
|
|
common.ErrorResp(c, err, 500)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
rawURL = link.URL
|
2022-06-29 08:23:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-08-10 02:48:14 +00:00
|
|
|
var related []model.Obj
|
2022-11-30 13:38:00 +00:00
|
|
|
parentPath := stdpath.Dir(reqPath)
|
2023-04-06 16:02:07 +00:00
|
|
|
sameLevelFiles, err := fs.List(c, parentPath, &fs.ListArgs{})
|
2022-08-07 13:01:29 +00:00
|
|
|
if err == nil {
|
|
|
|
related = filterRelated(sameLevelFiles, obj)
|
|
|
|
}
|
2022-12-18 11:51:20 +00:00
|
|
|
parentMeta, _ := op.GetNearestMeta(parentPath)
|
2023-03-23 05:59:39 +00:00
|
|
|
thumb, _ := model.GetThumb(obj)
|
2022-06-29 08:08:55 +00:00
|
|
|
common.SuccessResp(c, FsGetResp{
|
|
|
|
ObjResp: ObjResp{
|
2023-09-22 07:20:04 +00:00
|
|
|
Name: obj.GetName(),
|
|
|
|
Size: obj.GetSize(),
|
|
|
|
IsDir: obj.IsDir(),
|
|
|
|
Modified: obj.ModTime(),
|
|
|
|
Created: obj.CreateTime(),
|
|
|
|
HashInfoStr: obj.GetHash().String(),
|
|
|
|
HashInfo: obj.GetHash().Export(),
|
|
|
|
Sign: common.Sign(obj, parentPath, isEncrypt(meta, reqPath)),
|
|
|
|
Type: utils.GetFileType(obj.GetName()),
|
|
|
|
Thumb: thumb,
|
2022-06-29 08:08:55 +00:00
|
|
|
},
|
2022-08-07 16:58:32 +00:00
|
|
|
RawURL: rawURL,
|
2022-11-30 13:38:00 +00:00
|
|
|
Readme: getReadme(meta, reqPath),
|
2023-10-02 08:43:29 +00:00
|
|
|
Header: getHeader(meta, reqPath),
|
2022-08-07 16:58:32 +00:00
|
|
|
Provider: provider,
|
2022-11-28 05:45:25 +00:00
|
|
|
Related: toObjsResp(related, parentPath, isEncrypt(parentMeta, parentPath)),
|
2022-06-29 08:08:55 +00:00
|
|
|
})
|
|
|
|
}
|
2022-08-03 06:14:37 +00:00
|
|
|
|
2022-08-10 02:48:14 +00:00
|
|
|
func filterRelated(objs []model.Obj, obj model.Obj) []model.Obj {
|
|
|
|
var related []model.Obj
|
2022-08-07 13:01:29 +00:00
|
|
|
nameWithoutExt := strings.TrimSuffix(obj.GetName(), stdpath.Ext(obj.GetName()))
|
|
|
|
for _, o := range objs {
|
|
|
|
if o.GetName() == obj.GetName() {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
if strings.HasPrefix(o.GetName(), nameWithoutExt) {
|
2022-08-10 02:48:14 +00:00
|
|
|
related = append(related, o)
|
2022-08-07 13:01:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return related
|
|
|
|
}
|
|
|
|
|
2022-08-03 06:14:37 +00:00
|
|
|
type FsOtherReq struct {
|
|
|
|
model.FsOtherArgs
|
|
|
|
Password string `json:"password" form:"password"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func FsOther(c *gin.Context) {
|
|
|
|
var req FsOtherReq
|
|
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
|
|
common.ErrorResp(c, err, 400)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
user := c.MustGet("user").(*model.User)
|
2022-11-30 13:38:00 +00:00
|
|
|
var err error
|
|
|
|
req.Path, err = user.JoinPath(req.Path)
|
|
|
|
if err != nil {
|
|
|
|
common.ErrorResp(c, err, 403)
|
|
|
|
return
|
|
|
|
}
|
2022-12-18 11:51:20 +00:00
|
|
|
meta, err := op.GetNearestMeta(req.Path)
|
2022-08-03 06:14:37 +00:00
|
|
|
if err != nil {
|
|
|
|
if !errors.Is(errors.Cause(err), errs.MetaNotFound) {
|
|
|
|
common.ErrorResp(c, err, 500)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
c.Set("meta", meta)
|
2022-11-22 08:14:01 +00:00
|
|
|
if !common.CanAccess(user, meta, req.Path, req.Password) {
|
2022-11-30 14:01:33 +00:00
|
|
|
common.ErrorStrResp(c, "password is incorrect or you have no permission", 403)
|
2022-08-03 06:14:37 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
res, err := fs.Other(c, req.FsOtherArgs)
|
|
|
|
if err != nil {
|
|
|
|
common.ErrorResp(c, err, 500)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
common.SuccessResp(c, res)
|
|
|
|
}
|