Apply auth to http path as well

This commit is contained in:
Ben Sarmiento
2024-01-11 03:57:34 +01:00
parent e2ca383035
commit dfa3ef99b0
3 changed files with 6 additions and 6 deletions

View File

@@ -6,9 +6,9 @@ token: YOUR_RD_API_TOKEN # https://real-debrid.com/apitoken
host: "[::]" host: "[::]"
port: 9999 port: 9999
# you can protect zurg's webdav server with username+password auth # you can protect your zurg server with username+password auth
# webdav_username: yowmamasita # username: yowmamasita
# webdav_password: 1234 # password: 1234
# How many requests in parallel should we send to Real-Debrid API? # How many requests in parallel should we send to Real-Debrid API?
concurrent_workers: 20 concurrent_workers: 20

View File

@@ -37,8 +37,8 @@ type ZurgConfig struct {
Host string `yaml:"host" json:"host"` Host string `yaml:"host" json:"host"`
Port string `yaml:"port" json:"port"` Port string `yaml:"port" json:"port"`
Username string `yaml:"webdav_username" json:"webdav_username"` Username string `yaml:"username" json:"username"`
Password string `yaml:"webdav_password" json:"webdav_password"` Password string `yaml:"password" json:"password"`
NumOfWorkers int `yaml:"concurrent_workers" json:"concurrent_workers"` NumOfWorkers int `yaml:"concurrent_workers" json:"concurrent_workers"`
RefreshEverySeconds int `yaml:"check_for_changes_every_secs" json:"check_for_changes_every_secs"` RefreshEverySeconds int `yaml:"check_for_changes_every_secs" json:"check_for_changes_every_secs"`

View File

@@ -21,7 +21,7 @@ func (hs *Handlers) basicAuth(next http.Handler) http.Handler {
// needsAuth checks if the given path requires authentication. // needsAuth checks if the given path requires authentication.
func needsAuth(path string) bool { func needsAuth(path string) bool {
authenticatedPaths := []string{"/dav/", "/infuse/"} authenticatedPaths := []string{"/http/", "/dav/", "/infuse/"}
for _, p := range authenticatedPaths { for _, p := range authenticatedPaths {
if strings.HasPrefix(path, p) { if strings.HasPrefix(path, p) {
return true return true