Remove webdav support Clunky, used by literally no one
alex wennerberg alex@alexwennerberg.com
Thu, 28 Jan 2021 21:55:57 -0800
M
go.mod
→
go.mod
@@ -6,7 +6,6 @@ require (
git.sr.ht/~adnano/go-gemini v0.1.14-0.20210125155540-9e89b93bab84 github.com/BurntSushi/toml v0.3.1 github.com/LukeEmmet/html2gemini v0.0.0-20201115162526-e63bbe688236 - github.com/emersion/go-webdav v0.3.0 github.com/go-co-op/gocron v0.5.0 github.com/gorilla/feeds v1.1.1 github.com/gorilla/handlers v1.5.1
M
http.go
→
http.go
@@ -792,8 +792,6 @@
// admin commands serveMux.HandleFunc(hostname+"/admin/user/", adminUserHandler) - serveMux.HandleFunc(hostname+"/webdav/", webdavHandler) - wrapped := handlers.CustomLoggingHandler(log.Writer(), handlers.RecoveryHandler()(serveMux), logFormatter) // handle user files based on subdomain
D
webdav.go
@@ -1,30 +0,0 @@
-package main - -import ( - "fmt" - "golang.org/x/net/webdav" - "net/http" -) - -func webdavHandler(w http.ResponseWriter, r *http.Request) { - // get user - if r.Header.Get("Authorization") == "" { - w.Header().Set("WWW-Authenticate", "Basic realm=\"wevdav\"") - http.Error(w, "Authentication Error", http.StatusUnauthorized) - return - } - user, pass, ok := r.BasicAuth() - if ok && (checkAuth(user, pass) == nil) { - webdavHandler := webdav.Handler{ - FileSystem: webdav.Dir(getUserDirectory(user)), - Prefix: "/webdav/", - LockSystem: webdav.NewMemLS(), - Logger: func(r *http.Request, e error) { - fmt.Println(e) - }, - } - webdavHandler.ServeHTTP(w, r) - } else { - http.Error(w, "Authentication Error", http.StatusUnauthorized) - } -}