add configuration page, semantic uri fix, improve children macro

This commit is contained in:
Anya Tokugawa committed 2026-05-31 20:42:49 +09:00
1 parent 4da7d4e42d
commit 627466c935
9 files changed
+581 -263

No files matched your search

+64
View File
@@ -0,0 +1,64 @@
package server
import (
"net/http"
)
func (s *Server) handleConfig(
w http.ResponseWriter,
r *http.Request,
) {
if r.Method == http.MethodPost {
homePath := r.FormValue("home_path")
err := s.store.SetConfig(
"home_path",
homePath,
)
if err != nil {
http.Error(w, err.Error(), 500)
return
}
http.Redirect(
w,
r,
"/-/sys/config",
http.StatusFound,
)
return
}
homePath, err :=
s.store.GetConfig(
"home_path",
)
if err != nil {
http.Error(w, err.Error(), 500)
return
}
recent, err :=
s.store.ListRecentObjects(
50,
)
if err != nil {
http.Error(w, err.Error(), 500)
return
}
s.render(
w,
"config.gohtml",
map[string]any{
"HomePath": homePath,
"Objects": recent,
},
)
}