From 49b009d60433ce0fb419644fecc4ea8f3afac27f Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Sat, 6 Jan 2024 19:28:33 -0500 Subject: wip --- main.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 0edf6e9..1de6b6c 100644 --- a/main.go +++ b/main.go @@ -317,20 +317,7 @@ func LoadUsersFromEnviron() UsersMap { func HandleIndex(f fs.FS) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - - pth := filepath.Clean(r.URL.Path) - fh, err := f.Open(pth) - if err != nil { - fh, err = f.Open("index.html") - if err != nil { - logger.Println(err) - sendPlain(Response{w, http.StatusInternalServerError, - "Internal server error", nil}, nil) - return - } - } - - _, _ = io.Copy(w, fh) + logIfErr(renderHX(f, isHTMX(r), w, nil, "index.html")) }) } -- cgit v1.2.3