From 52bb774f7380f739f88b84379b5a2a6e845c5567 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 23 Sep 2021 09:57:24 +0200 Subject: [PATCH] internal: add asset paths for user interface Signed-off-by: Jens Langhammer --- internal/web/static.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/web/static.go b/internal/web/static.go index 0780377bb..24fc8da8c 100644 --- a/internal/web/static.go +++ b/internal/web/static.go @@ -36,13 +36,15 @@ func (ws *WebServer) configureStatic() { } statRouter.PathPrefix("/static/dist/").Handler(distHandler) statRouter.PathPrefix("/static/authentik/").Handler(authentikHandler) + // 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) { 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))