aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2024-01-06 19:28:33 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2024-01-06 19:28:33 -0500
commit49b009d60433ce0fb419644fecc4ea8f3afac27f (patch)
treec839edf38dbd0fc60fb5528cde32c5f70cd04dbd
parentbd5a00c61b355c857b5c99323592ca432dea5d0a (diff)
downloadpaste-htmx_wip.tar.gz
paste-htmx_wip.tar.xz
-rw-r--r--htmx/base.html2
-rw-r--r--htmx/error.html6
-rw-r--r--htmx/index.html6
-rw-r--r--main.go15
4 files changed, 14 insertions, 15 deletions
diff --git a/htmx/base.html b/htmx/base.html
index c02e2c6..68aae76 100644
--- a/htmx/base.html
+++ b/htmx/base.html
@@ -22,7 +22,7 @@
</ul>
<ul>
<li>
- <a href="/login">Login</a> |
+ <a href="/login">Login</a>
</li>
</ul>
{{end}}
diff --git a/htmx/error.html b/htmx/error.html
new file mode 100644
index 0000000..2e12bdf
--- /dev/null
+++ b/htmx/error.html
@@ -0,0 +1,6 @@
+{{define "title"}}{{.}}{{end}}
+{{define "main"}}
+
+<h1>{{.}}</h1>
+
+{{end}}
diff --git a/htmx/index.html b/htmx/index.html
new file mode 100644
index 0000000..68d9f93
--- /dev/null
+++ b/htmx/index.html
@@ -0,0 +1,6 @@
+{{define "title"}}Index{{end}}
+{{define "main"}}
+
+todo
+
+{{end}}
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"))
})
}