diff --git a/cmd/server/main.go b/cmd/server/main.go index f398b78..13bd2cc 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -21,8 +21,8 @@ func main() { router := http.NewServeMux() notesRouter := views.GetRoutes("/notes") - router.Handle("/", logger(http.RedirectHandler("/notes/", http.StatusFound))) - router.Handle("/notes/", logger(http.StripPrefix("/notes", notesRouter))) + router.Handle("/", http.RedirectHandler("/notes/", http.StatusFound)) + router.Handle("/notes/", http.StripPrefix("/notes", notesRouter)) router.Handle( "/static/", logger( @@ -37,27 +37,9 @@ func main() { log.Fatal(http.Serve(listener, router)) } -type loggingResponseWriter struct { - http.ResponseWriter - statusCode int -} - -func NewLoggingResponseWriter(w http.ResponseWriter) *loggingResponseWriter { - return &loggingResponseWriter{w, http.StatusOK} -} - -func (w *loggingResponseWriter) WriteHeader(code int) { - w.statusCode = code - w.ResponseWriter.WriteHeader(code) -} - func logger(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - lwr := NewLoggingResponseWriter(w) - next.ServeHTTP(lwr, r) - - if conf.Conf.LogAccess { - log.Printf("%s %s %s%s %d", r.RemoteAddr, r.Method, r.Host, r.URL.Path, lwr.statusCode) - } + log.Print(r.URL.Path) + next.ServeHTTP(w, r) }) } diff --git a/conf.example.toml b/conf.example.toml index a606f72..99899e3 100644 --- a/conf.example.toml +++ b/conf.example.toml @@ -2,4 +2,3 @@ extension = "md" notesdir = "/var/lib/gonotes/saved_notes" address = ":8080" protocol = "tcp" -logAccess = false diff --git a/internal/conf/conf.go b/internal/conf/conf.go index 8815efc..64e7688 100644 --- a/internal/conf/conf.go +++ b/internal/conf/conf.go @@ -58,7 +58,6 @@ type Config struct { Protocol string Extension string NotesDir string - LogAccess bool } var ( diff --git a/internal/conf/static/icons/favicon.svg b/internal/conf/static/icons/favicon.svg deleted file mode 100644 index a56b4a7..0000000 --- a/internal/conf/static/icons/favicon.svg +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - diff --git a/internal/conf/templates/base.tmpl.html b/internal/conf/templates/base.tmpl.html index ee9e756..479636a 100644 --- a/internal/conf/templates/base.tmpl.html +++ b/internal/conf/templates/base.tmpl.html @@ -9,16 +9,11 @@ rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> -