flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit af3bd88136b48b6a411adf610ba87d63e08385a4
parent 189e8335353ec3b951d337e7fa4346cfadc80035
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Thu, 28 Jan 2021 21:55:57 -0800

Remove webdav support

Clunky, used by literally no one

Diffstat:
Mgo.mod | 1-
Mhttp.go | 2--
Dwebdav.go | 30------------------------------
3 files changed, 0 insertions(+), 33 deletions(-)

diff --git a/go.mod b/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 diff --git a/http.go b/http.go @@ -792,8 +792,6 @@ func runHTTPServer() { // 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 diff --git a/webdav.go b/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) - } -}