File count on storage page
This commit is contained in:
parent
6df2be7944
commit
65f8cd14a7
8 changed files with 319 additions and 16 deletions
16
main.go
16
main.go
|
|
@ -148,6 +148,7 @@ func main() { // {{{
|
|||
http.HandleFunc("/node/history/retrieve/{uuid}/{offset}", authenticated(actionNodeHistoryRetrieve))
|
||||
http.HandleFunc("/node/history/count/{uuid}", authenticated(actionNodeHistoryCount))
|
||||
|
||||
http.HandleFunc("/file/count", authenticated(actionFileCount))
|
||||
http.HandleFunc("/file/{uuid}", authenticated(actionFile))
|
||||
http.HandleFunc("/file/{uuid}/metadata", authenticated(actionFileMetadata))
|
||||
|
||||
|
|
@ -500,9 +501,22 @@ func actionUserSetPreferences(w http.ResponseWriter, r *http.Request) { // {{{
|
|||
})
|
||||
} // }}}
|
||||
|
||||
func actionFileCount(w http.ResponseWriter, r *http.Request) {// {{{
|
||||
session := getUserSession(r)
|
||||
count, err := FileCountForUser(session.UserID)
|
||||
if err != nil {
|
||||
Log.Error("file_count", "error", err)
|
||||
httpError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
responseData(w, map[string]any{
|
||||
"OK": true,
|
||||
"Count": count,
|
||||
})
|
||||
}// }}}
|
||||
func actionFile(w http.ResponseWriter, r *http.Request) {// {{{
|
||||
uuid := r.PathValue("uuid")
|
||||
Log.Info("FOO", "uuid", uuid)
|
||||
session := getUserSession(r)
|
||||
f, md, err := FileForUser(session.UserID, uuid)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue