Use the chunk manager properly

This commit is contained in:
Ben Sarmiento
2023-11-18 01:51:25 +01:00
parent 4da9416bec
commit b669f8d673
10 changed files with 30 additions and 31 deletions

View File

@@ -7,7 +7,7 @@ import (
"github.com/debridmediamanager.com/zurg/internal/config"
"github.com/debridmediamanager.com/zurg/internal/dav"
intHttp "github.com/debridmediamanager.com/zurg/internal/http"
zurghttp "github.com/debridmediamanager.com/zurg/internal/http"
"github.com/debridmediamanager.com/zurg/internal/torrent"
"github.com/debridmediamanager.com/zurg/internal/universal"
"github.com/debridmediamanager.com/zurg/pkg/logutil"
@@ -25,11 +25,11 @@ func Router(mux *http.ServeMux, c config.ConfigInterface, t *torrent.TorrentMana
if countNonEmptySegments(strings.Split(requestPath, "/")) > 3 {
universal.HandleGetRequest(w, r, t, c, cache)
} else {
intHttp.HandleDirectoryListing(w, r, t, c)
zurghttp.HandleDirectoryListing(w, r, t, c)
}
case http.MethodHead:
universal.HandleHeadRequest(w, r, t, c, cache)
universal.HandleHeadRequest(w, r, t, cache)
default:
log.Errorf("Request %s %s not supported yet", r.Method, r.URL.Path)

View File

@@ -7,13 +7,12 @@ import (
"path/filepath"
"strings"
"github.com/debridmediamanager.com/zurg/internal/config"
"github.com/debridmediamanager.com/zurg/internal/torrent"
"github.com/debridmediamanager.com/zurg/pkg/logutil"
"github.com/hashicorp/golang-lru/v2/expirable"
)
func HandleHeadRequest(w http.ResponseWriter, r *http.Request, t *torrent.TorrentManager, c config.ConfigInterface, cache *expirable.LRU[string, string]) {
func HandleHeadRequest(w http.ResponseWriter, r *http.Request, t *torrent.TorrentManager, cache *expirable.LRU[string, string]) {
log := logutil.NewLogger().Named("unihead")
requestPath := path.Clean(r.URL.Path)