make HTTP shares browsable

if you share a single folder with read scope, you can now browse the share
and download single files

Fixes #674
See #677

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2022-02-06 16:46:43 +01:00
parent 7e2a8e70c9
commit 9382db751c
18 changed files with 1138 additions and 75 deletions

View File

@@ -1007,6 +1007,8 @@ func (s *httpdServer) initializeRouter() {
s.router.Get(sharesPath+"/{id}", downloadFromShare)
s.router.Post(sharesPath+"/{id}", uploadFilesToShare)
s.router.Post(sharesPath+"/{id}/{name}", uploadFileToShare)
s.router.Get(sharesPath+"/{id}/dirs", readBrowsableShareContents)
s.router.Get(sharesPath+"/{id}/files", downloadBrowsableSharedFile)
s.router.Get(tokenPath, s.getToken)
s.router.Post(adminPath+"/{username}/forgot-password", forgotAdminPassword)
@@ -1226,6 +1228,8 @@ func (s *httpdServer) initializeRouter() {
Post(webClientTwoFactorRecoveryPath, s.handleWebClientTwoFactorRecoveryPost)
// share API exposed to external users
s.router.Get(webClientPubSharesPath+"/{id}", downloadFromShare)
s.router.Get(webClientPubSharesPath+"/{id}/browse", s.handleShareGetFiles)
s.router.Get(webClientPubSharesPath+"/{id}/dirs", s.handleShareGetDirContents)
s.router.Post(webClientPubSharesPath+"/{id}", uploadFilesToShare)
s.router.Post(webClientPubSharesPath+"/{id}/{name}", uploadFileToShare)