Refactor routing
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/debridmediamanager/zurg/pkg/logutil"
|
||||
)
|
||||
|
||||
func HandleInfuseListDirectories(torMgr *torrent.TorrentManager) ([]byte, error) {
|
||||
func ServeRootDirectoryForInfuse(torMgr *torrent.TorrentManager) ([]byte, error) {
|
||||
var buf bytes.Buffer
|
||||
buf.WriteString("<?xml version=\"1.0\" encoding=\"utf-8\"?><d:multistatus xmlns:d=\"DAV:\">")
|
||||
directories := torMgr.DirectoryMap.Keys()
|
||||
@@ -27,7 +27,7 @@ func HandleInfuseListDirectories(torMgr *torrent.TorrentManager) ([]byte, error)
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
func HandleInfuseListTorrents(directory string, torMgr *torrent.TorrentManager, log *logutil.Logger) ([]byte, error) {
|
||||
func ServeTorrentsListForInfuse(directory string, torMgr *torrent.TorrentManager, log *logutil.Logger) ([]byte, error) {
|
||||
torrents, ok := torMgr.DirectoryMap.Get(directory)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("cannot find directory %s", directory)
|
||||
@@ -48,7 +48,7 @@ func HandleInfuseListTorrents(directory string, torMgr *torrent.TorrentManager,
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
func HandleInfuseListFiles(directory, torrentName string, torMgr *torrent.TorrentManager, log *logutil.Logger) ([]byte, error) {
|
||||
func ServeFilesListForInfuse(directory, torrentName string, torMgr *torrent.TorrentManager, log *logutil.Logger) ([]byte, error) {
|
||||
torrents, ok := torMgr.DirectoryMap.Get(directory)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("cannot find directory %s", directory)
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"github.com/debridmediamanager/zurg/pkg/logutil"
|
||||
)
|
||||
|
||||
func HandleListDirectories(torMgr *torrent.TorrentManager) ([]byte, error) {
|
||||
func ServeRootDirectory(torMgr *torrent.TorrentManager) ([]byte, error) {
|
||||
var buf bytes.Buffer
|
||||
buf.WriteString("<?xml version=\"1.0\" encoding=\"utf-8\"?><d:multistatus xmlns:d=\"DAV:\">")
|
||||
buf.WriteString(dav.BaseDirectory("", ""))
|
||||
@@ -29,7 +29,7 @@ func HandleListDirectories(torMgr *torrent.TorrentManager) ([]byte, error) {
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
func HandleListTorrents(directory string, torMgr *torrent.TorrentManager, log *logutil.Logger) ([]byte, error) {
|
||||
func ServeTorrentsList(directory string, torMgr *torrent.TorrentManager, log *logutil.Logger) ([]byte, error) {
|
||||
torrents, ok := torMgr.DirectoryMap.Get(directory)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("cannot find directory %s", directory)
|
||||
@@ -51,7 +51,7 @@ func HandleListTorrents(directory string, torMgr *torrent.TorrentManager, log *l
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
func HandleListFiles(directory, torrentName string, torMgr *torrent.TorrentManager, log *logutil.Logger) ([]byte, error) {
|
||||
func ServeFilesList(directory, torrentName string, torMgr *torrent.TorrentManager, log *logutil.Logger) ([]byte, error) {
|
||||
torrents, ok := torMgr.DirectoryMap.Get(directory)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("cannot find directory %s", directory)
|
||||
@@ -86,7 +86,7 @@ func HandleListFiles(directory, torrentName string, torMgr *torrent.TorrentManag
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
func HandlePropfindFile(directory, torrentName, fileName string, torMgr *torrent.TorrentManager, log *logutil.Logger) ([]byte, error) {
|
||||
func HandleSingleFile(directory, torrentName, fileName string, torMgr *torrent.TorrentManager, log *logutil.Logger) ([]byte, error) {
|
||||
torrents, ok := torMgr.DirectoryMap.Get(directory)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("cannot find directory %s", directory)
|
||||
|
||||
Reference in New Issue
Block a user