internal: add asset paths for user interface

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-23 09:57:24 +02:00
parent f26fcaf825
commit 52bb774f73
1 changed files with 4 additions and 2 deletions

View File

@ -36,13 +36,15 @@ func (ws *WebServer) configureStatic() {
} }
statRouter.PathPrefix("/static/dist/").Handler(distHandler) statRouter.PathPrefix("/static/dist/").Handler(distHandler)
statRouter.PathPrefix("/static/authentik/").Handler(authentikHandler) statRouter.PathPrefix("/static/authentik/").Handler(authentikHandler)
// Prevent font-loading issues on safari, which loads fonts relatively to the URL the browser is on // Prevent font-loading issues on safari, which loads fonts relatively to the URL the browser is on
statRouter.PathPrefix("/if/flow/{flow_slug}/assets").HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { statRouter.PathPrefix("/if/flow/{flow_slug}/assets").HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r) vars := mux.Vars(r)
http.StripPrefix(fmt.Sprintf("/if/flow/%s", vars["flow_slug"]), distFs).ServeHTTP(rw, r) disableIndex(http.StripPrefix(fmt.Sprintf("/if/flow/%s", vars["flow_slug"]), distFs)).ServeHTTP(rw, r)
}) })
statRouter.PathPrefix("/if/admin/assets").Handler(http.StripPrefix("/if/admin", distFs)) statRouter.PathPrefix("/if/admin/assets").Handler(disableIndex(http.StripPrefix("/if/admin", distFs)))
statRouter.PathPrefix("/if/user/assets").Handler(disableIndex(http.StripPrefix("/if/admin", distFs)))
statRouter.PathPrefix("/media/").Handler(http.StripPrefix("/media", fs)) statRouter.PathPrefix("/media/").Handler(http.StripPrefix("/media", fs))