Refactor routing
This commit is contained in:
@@ -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("<ol>")
|
||||
directories := torMgr.DirectoryMap.Keys()
|
||||
@@ -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)
|
||||
@@ -49,7 +49,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)
|
||||
|
||||
Reference in New Issue
Block a user