Cleanup of old code, moved Node class, many improvements on file handling
This commit is contained in:
parent
65f8cd14a7
commit
16992db6b1
19 changed files with 485 additions and 3281 deletions
21
main.go
21
main.go
|
|
@ -149,8 +149,9 @@ func main() { // {{{
|
|||
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))
|
||||
http.HandleFunc("/file/server_uuids/{offset}", authenticated(actionFileServerUUIDs))
|
||||
http.HandleFunc("/file/uuid/{uuid}", authenticated(actionFile))
|
||||
http.HandleFunc("/file/uuid/{uuid}/metadata", authenticated(actionFileMetadata))
|
||||
|
||||
http.HandleFunc("/service_worker.js", pageServiceWorker)
|
||||
|
||||
|
|
@ -515,6 +516,22 @@ func actionFileCount(w http.ResponseWriter, r *http.Request) {// {{{
|
|||
"Count": count,
|
||||
})
|
||||
}// }}}
|
||||
func actionFileServerUUIDs(w http.ResponseWriter, r *http.Request) {// {{{
|
||||
session := getUserSession(r)
|
||||
offset, _ := strconv.Atoi(r.PathValue("offset"))
|
||||
uuids, more, err := FileServerUUIDsForUser(session.UserID, offset)
|
||||
if err != nil {
|
||||
Log.Error("file_server_uuids", "error", err)
|
||||
httpError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
responseData(w, map[string]any{
|
||||
"OK": true,
|
||||
"UUIDs": uuids,
|
||||
"MoreRowsExist": more,
|
||||
})
|
||||
}// }}}
|
||||
func actionFile(w http.ResponseWriter, r *http.Request) {// {{{
|
||||
uuid := r.PathValue("uuid")
|
||||
session := getUserSession(r)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue