(c *gin.Context, req *ArchiveListReq)
| 148 | } |
| 149 | |
| 150 | func SharingArchiveList(c *gin.Context, req *ArchiveListReq) { |
| 151 | if !setting.GetBool(conf.ShareArchivePreview) { |
| 152 | common.ErrorStrResp(c, "sharing archives previewing is not allowed", 403) |
| 153 | return |
| 154 | } |
| 155 | sid, path, _ := strings.Cut(strings.TrimPrefix(req.Path, "/"), "/") |
| 156 | if sid == "" { |
| 157 | common.ErrorStrResp(c, "invalid share id", 400) |
| 158 | return |
| 159 | } |
| 160 | innerArgs := model.ArchiveInnerArgs{ |
| 161 | ArchiveArgs: model.ArchiveArgs{ |
| 162 | LinkArgs: model.LinkArgs{ |
| 163 | Header: c.Request.Header, |
| 164 | Type: c.Query("type"), |
| 165 | }, |
| 166 | Password: req.ArchivePass, |
| 167 | }, |
| 168 | InnerPath: utils.FixAndCleanPath(req.InnerPath), |
| 169 | } |
| 170 | s, objs, err := sharing.ArchiveList(c.Request.Context(), sid, path, model.SharingArchiveListArgs{ |
| 171 | ArchiveListArgs: model.ArchiveListArgs{ |
| 172 | ArchiveInnerArgs: innerArgs, |
| 173 | Refresh: req.Refresh, |
| 174 | }, |
| 175 | Pwd: req.Password, |
| 176 | }) |
| 177 | if dealError(c, err) { |
| 178 | return |
| 179 | } |
| 180 | _ = countAccess(c.ClientIP(), s) |
| 181 | total, objs := pagination(objs, &req.PageReq) |
| 182 | ret, _ := utils.SliceConvert(objs, func(src model.Obj) (ObjResp, error) { |
| 183 | return toObjsRespWithoutSignAndThumb(src), nil |
| 184 | }) |
| 185 | common.SuccessResp(c, common.PageResp{ |
| 186 | Content: ret, |
| 187 | Total: int64(total), |
| 188 | }) |
| 189 | } |
| 190 | |
| 191 | func SharingDown(c *gin.Context) { |
| 192 | sid := c.Request.Context().Value(conf.SharingIDKey).(string) |
no test coverage detected