MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / SharingList

Function SharingList

server/handles/sharing.go:68–105  ·  view source on GitHub ↗
(c *gin.Context, req *ListReq)

Source from the content-addressed store, hash-verified

66}
67
68func 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
107func SharingArchiveMeta(c *gin.Context, req *ArchiveMetaReq) {
108 if !setting.GetBool(conf.ShareArchivePreview) {

Callers 1

FsListSplitFunction · 0.85

Calls 15

ErrorStrRespFunction · 0.92
ListFunction · 0.92
SuccessRespFunction · 0.92
MustSliceConvertFunction · 0.92
GetThumbFunction · 0.92
GetObjTypeFunction · 0.92
dealErrorFunction · 0.85
countAccessFunction · 0.85
paginationFunction · 0.85
ExportMethod · 0.80
GetNameMethod · 0.65
GetSizeMethod · 0.65

Tested by

no test coverage detected