package dav import ( "log" "net/http" "github.com/debridmediamanager.com/zurg/internal/config" "github.com/debridmediamanager.com/zurg/internal/torrent" "github.com/hashicorp/golang-lru/v2/expirable" ) // Router creates a WebDAV router func Router(mux *http.ServeMux, c config.ConfigInterface, t *torrent.TorrentManager, cache *expirable.LRU[string, string]) { mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { switch r.Method { case "PROPFIND": HandlePropfindRequest(w, r, t, c, cache) case http.MethodGet: HandleGetRequest(w, r, t, c, cache) case http.MethodOptions: w.WriteHeader(http.StatusOK) default: log.Println("Method not implemented", r.Method) http.Error(w, "Method not implemented", http.StatusMethodNotAllowed) } }) }