diff --git a/web/handlers/http.go b/web/handlers/http.go index 0368eda7..30a9e2ff 100644 --- a/web/handlers/http.go +++ b/web/handlers/http.go @@ -365,7 +365,6 @@ func New( m.Get(router.OpenModeCreateInvite).HandlerFunc(r.HTML("admin/invite-created.tmpl", ih.createOpenMode)) // static assets - m.PathPrefix("/assets/").Handler(http.StripPrefix("/assets/", http.FileServer(web.Assets))) // TODO: doesnt work because of of mainMux wrapper, see issue #35 @@ -375,12 +374,6 @@ func New( // hook up main stdlib mux to the gorrilla/mux with named routes // TODO: issue #35 - - http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("assets")))) - - m.PathPrefix("/test").HandlerFunc(IndexHandler2("../../web/assets/index.html")) - m.PathPrefix("/").HandlerFunc(IndexHandler("../../web/assets/index.html")) - mainMux.Handle("/", m) consumeURL := urlTo(router.CompleteInviteConsume) @@ -431,21 +424,3 @@ func concatTemplates(lst ...[]string) []string { } return catted } - -func IndexHandler2(entrypoint string) func(w http.ResponseWriter, r *http.Request) { - fn := func(w http.ResponseWriter, r *http.Request) { - // fmt.Fprint(w, web.Assets) - http.ServeFile(w, r, entrypoint) - } - - return http.HandlerFunc(fn) -} - -func IndexHandler(entrypoint string) func(w http.ResponseWriter, r *http.Request) { - fn := func(w http.ResponseWriter, r *http.Request) { - // fmt.Fprint(w, web.Assets) - http.ServeFile(w, r, entrypoint) - } - - return http.HandlerFunc(fn) -} diff --git a/web/router/complete.go b/web/router/complete.go index fbc2a7d7..3344f4fc 100644 --- a/web/router/complete.go +++ b/web/router/complete.go @@ -6,6 +6,8 @@ package router import ( "github.com/gorilla/mux" + "github.com/ssb-ngi-pointer/go-ssb-room/v2/web" + "net/http" ) // constant names for the named routes @@ -44,8 +46,6 @@ func CompleteApp() *mux.Router { Auth(m) Admin(m.PathPrefix("/admin").Subrouter()) - // m.Path("/").Methods("GET").Name(CompleteIndex) - m.Path("/alias/{alias}").Methods("GET").Name(CompleteAliasResolve) m.Path("/members/change-password").Methods("GET").Name(MembersChangePasswordForm) @@ -63,16 +63,7 @@ func CompleteApp() *mux.Router { m.Path("/set-language").Methods("POST").Name(CompleteSetLanguage) // Catch-all: Serve our JavaScript application's entry-point (index.html). - - // m.PathPrefix("/assets/").Handler(http.StripPrefix("/assets/", http.FileServer(web.Assets))) + m.Path("/").Handler(http.FileServer(web.Assets)) return m } - -// func HealthCheck(w http.ResponseWriter, r *http.Request) { -// fmt.Fprint(w, "API is alive and ready") -// } - -// func handle(w http.ResponseWriter, r *http.Request) { -// http.Redirect(w, r, "/notice/list", http.StatusMovedPermanently) -// }