diff --git a/web/handlers/admin/handler.go b/web/handlers/admin/handler.go index 02b2db2..86770f5 100644 --- a/web/handlers/admin/handler.go +++ b/web/handlers/admin/handler.go @@ -164,7 +164,7 @@ func Handler( // path:/ matches everything that isn't registerd (ie. its the "Not Found handler") mux.HandleFunc("/", http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { - r.Error(rw, req, 404, weberrors.ErrNotFound{What: req.URL.Path}) + r.Error(rw, req, 404, weberrors.PageNotFound{Path: req.URL.Path}) })) return customStripPrefix("/admin", mux) diff --git a/web/handlers/basic_test.go b/web/handlers/basic_test.go index e6e8465..b0c6e29 100644 --- a/web/handlers/basic_test.go +++ b/web/handlers/basic_test.go @@ -31,19 +31,6 @@ func TestIndex(t *testing.T) { a.Equal("Default Notice Content", content) } -func TestAbout(t *testing.T) { - ts := setup(t) - - a := assert.New(t) - - url := ts.URLTo(router.CompleteAbout) - - html, resp := ts.Client.GetHTML(url) - a.Equal(http.StatusOK, resp.Code, "wrong HTTP status code") - found := html.Find("h1").Text() - a.Equal("The about page", found) -} - func TestNotFound(t *testing.T) { ts := setup(t) diff --git a/web/handlers/http.go b/web/handlers/http.go index d310c5a..a0528fe 100644 --- a/web/handlers/http.go +++ b/web/handlers/http.go @@ -35,7 +35,6 @@ import ( var HTMLTemplates = []string{ "landing/index.tmpl", - "landing/about.tmpl", "alias.tmpl", "change-member-password.tmpl", @@ -407,7 +406,6 @@ func New( Language: notice.Language, }, nil })) - m.Get(router.CompleteAbout).Handler(r.StaticHTML("landing/about.tmpl")) // notices (the mini-CMS) var nh = noticeHandler{ @@ -446,22 +444,22 @@ func New( m.Get(router.CompleteInviteInsertID).Handler(r.HTML("invite/insert-id.tmpl", ih.presentInsert)) m.Get(router.CompleteInviteConsume).HandlerFunc(ih.consume) - // statuc assets + // static assets m.PathPrefix("/assets/").Handler(http.StripPrefix("/assets/", http.FileServer(web.Assets))) + // TODO: doesnt work because of of mainMux wrapper, see issue #35 m.NotFoundHandler = http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { eh.Handle(rw, req, http.StatusNotFound, weberrs.PageNotFound{Path: req.URL.Path}) }) // hook up main stdlib mux to the gorrilla/mux with named routes + // TODO: issue #35 mainMux.Handle("/", m) consumeURL := urlTo(router.CompleteInviteConsume) // apply HTTP middleware middlewares := []func(http.Handler) http.Handler{ - logging.RecoveryHandler(), - logging.InjectHandler(logger), members.ContextInjecter(dbs.Members, authWithPassword, authWithSSB), CSRF, @@ -477,6 +475,9 @@ func New( next.ServeHTTP(w, req) }) }, + + logging.InjectHandler(logger), + logging.RecoveryHandler(), } if !web.Production { diff --git a/web/templates/landing/about.tmpl b/web/templates/landing/about.tmpl deleted file mode 100644 index 7c0b06a..0000000 --- a/web/templates/landing/about.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -{{ define "title" }}Landing - About{{ end }} -{{ define "content" }} -
-

The about page

-
- -{{end}} \ No newline at end of file