(c *gin.Context, req *ListReq)
| 66 | } |
| 67 | |
| 68 | func SharingList(c *gin.Context, req *ListReq) { |
| 69 | sid, path, _ := strings.Cut(strings.TrimPrefix(req.Path, "/"), "/") |
| 70 | if sid == "" { |
| 71 | common.ErrorStrResp(c, "invalid share id", 400) |
| 72 | return |
| 73 | } |
| 74 | s, objs, err := sharing.List(c.Request.Context(), sid, path, model.SharingListArgs{ |
| 75 | Refresh: req.Refresh, |
| 76 | Pwd: req.Password, |
| 77 | }) |
| 78 | if dealError(c, err) { |
| 79 | return |
| 80 | } |
| 81 | _ = countAccess(c.ClientIP(), s) |
| 82 | total, objs := pagination(objs, &req.PageReq) |
| 83 | common.SuccessResp(c, FsListResp{ |
| 84 | Content: utils.MustSliceConvert(objs, func(obj model.Obj) ObjResp { |
| 85 | thumb, _ := model.GetThumb(obj) |
| 86 | return ObjResp{ |
| 87 | Name: obj.GetName(), |
| 88 | Size: obj.GetSize(), |
| 89 | IsDir: obj.IsDir(), |
| 90 | Modified: obj.ModTime(), |
| 91 | Created: obj.CreateTime(), |
| 92 | HashInfoStr: obj.GetHash().String(), |
| 93 | HashInfo: obj.GetHash().Export(), |
| 94 | Sign: "", |
| 95 | Thumb: thumb, |
| 96 | Type: utils.GetObjType(obj.GetName(), obj.IsDir()), |
| 97 | } |
| 98 | }), |
| 99 | Total: int64(total), |
| 100 | Readme: s.Readme, |
| 101 | Header: s.Header, |
| 102 | Write: false, |
| 103 | Provider: "unknown", |
| 104 | }) |
| 105 | } |
| 106 | |
| 107 | func SharingArchiveMeta(c *gin.Context, req *ArchiveMetaReq) { |
| 108 | if !setting.GetBool(conf.ShareArchivePreview) { |
no test coverage detected