Add downloads dir to http, not sure if working
This commit is contained in:
@@ -105,9 +105,9 @@ func (zr *ZurgRouter) infuseDavRootHandler(resp http.ResponseWriter, req *http.R
|
||||
zr.handleRootRequest(resp, req, params, dav.ServeRootDirectoryForInfuse, "text/xml; charset=\"utf-8\"")
|
||||
}
|
||||
|
||||
func (zr *ZurgRouter) handleTorrentsListRequest(resp http.ResponseWriter, req *http.Request, params httprouter.Params, handleFunc func(string, *torrent.TorrentManager, *logutil.Logger) ([]byte, error), contentType string) {
|
||||
func (zr *ZurgRouter) handleTorrentsListRequest(resp http.ResponseWriter, req *http.Request, params httprouter.Params, handleFunc func(string, *torrent.TorrentManager) ([]byte, error), contentType string) {
|
||||
directory := params.ByName("directory")
|
||||
out, err := handleFunc(directory, zr.torMgr, zr.log)
|
||||
out, err := handleFunc(directory, zr.torMgr)
|
||||
if err != nil {
|
||||
http.Error(resp, "Not Found", http.StatusNotFound)
|
||||
return
|
||||
@@ -118,7 +118,14 @@ func (zr *ZurgRouter) handleTorrentsListRequest(resp http.ResponseWriter, req *h
|
||||
}
|
||||
|
||||
func (zr *ZurgRouter) httpTorrentsListHandler(resp http.ResponseWriter, req *http.Request, params httprouter.Params) {
|
||||
zr.handleTorrentsListRequest(resp, req, params, intHttp.ServeTorrentsList, "text/html; charset=\"utf-8\"")
|
||||
directory := params.ByName("directory")
|
||||
handlerFunc := intHttp.ServeTorrentsList
|
||||
if directory == config.DOWNLOADS {
|
||||
handlerFunc = func(_ string, torMgr *torrent.TorrentManager) ([]byte, error) {
|
||||
return intHttp.ServeDownloadsList(torMgr)
|
||||
}
|
||||
}
|
||||
zr.handleTorrentsListRequest(resp, req, params, handlerFunc, "text/html; charset=\"utf-8\"")
|
||||
}
|
||||
|
||||
func (zr *ZurgRouter) davTorrentsListHandler(resp http.ResponseWriter, req *http.Request, params httprouter.Params) {
|
||||
@@ -129,10 +136,10 @@ func (zr *ZurgRouter) infuseDavTorrentsListHandler(resp http.ResponseWriter, req
|
||||
zr.handleTorrentsListRequest(resp, req, params, dav.ServeTorrentsListForInfuse, "text/xml; charset=\"utf-8\"")
|
||||
}
|
||||
|
||||
func (zr *ZurgRouter) handleFilesListRequest(resp http.ResponseWriter, req *http.Request, params httprouter.Params, handleFunc func(string, string, *torrent.TorrentManager, *logutil.Logger) ([]byte, error), contentType string) {
|
||||
func (zr *ZurgRouter) handleFilesListRequest(resp http.ResponseWriter, req *http.Request, params httprouter.Params, handleFunc func(string, string, *torrent.TorrentManager) ([]byte, error), contentType string) {
|
||||
directory := params.ByName("directory")
|
||||
torrentName := params.ByName("torrent")
|
||||
out, err := handleFunc(directory, torrentName, zr.torMgr, zr.log)
|
||||
out, err := handleFunc(directory, torrentName, zr.torMgr)
|
||||
if err != nil {
|
||||
http.Error(resp, "Not Found", http.StatusNotFound)
|
||||
return
|
||||
@@ -179,7 +186,7 @@ func (zr *ZurgRouter) davCheckSingleFileHandler(resp http.ResponseWriter, req *h
|
||||
directory := params.ByName("directory")
|
||||
torrentName := params.ByName("torrent")
|
||||
fileName := params.ByName("file")
|
||||
out, err := dav.HandleSingleFile(directory, torrentName, fileName, zr.torMgr, zr.log)
|
||||
out, err := dav.HandleSingleFile(directory, torrentName, fileName, zr.torMgr)
|
||||
if err != nil {
|
||||
fmt.Println(">>>>>>>>>>>>>>>>>>>. not found", err)
|
||||
http.Error(resp, "Not Found", http.StatusNotFound)
|
||||
|
||||
Reference in New Issue
Block a user