modified: web/assets/css/styles.css

modified:   web/components/base/input.templ
	modified:   web/components/base/input_templ.go
	modified:   web/components/base/range.templ
	modified:   web/components/base/range_templ.go
	modified:   web/components/base/select.templ
	modified:   web/components/base/select_templ.go
	modified:   web/components/base/textarea.templ
	modified:   web/components/base/textarea_templ.go
	modified:   web/components/icons.templ
	modified:   web/components/icons_templ.go
	modified:   web/components/issue.templ
	modified:   web/components/issue_templ.go
	modified:   web/components/layout.templ
	modified:   web/components/layout_templ.go
	new file:   web/components/sidebar.templ
	new file:   web/components/sidebar_templ.go
	new file:   web/components/status.templ
	new file:   web/components/status_templ.go
	modified:   web/handler/issues.go
	new file:   web/handler/task.go
	modified:   web/input.css
	deleted:    web/package-lock.json
	deleted:    web/package.json
	modified:   web/routes/layout.templ
	modified:   web/routes/layout_templ.go
	modified:   web/server/routes.go
	modified:   web/server/server.go
	modified:   web/web.go
This commit is contained in:
viljarb
2026-02-18 20:41:52 +01:00
parent ed8a0d02ec
commit 1d92041538
29 changed files with 1050 additions and 5847 deletions

View File

@@ -27,6 +27,7 @@ func (s *Server) RegisterRoutes(assets embed.FS) http.Handler {
s.handleAssets(r, assets)
r.Get("/", handler.IndexHandler)
r.Get("/status", handler.HandleTaskStatus)
r.Route("/issues", func(r chi.Router) {
r.Get("/", handler.ListIssues)
@@ -35,7 +36,7 @@ func (s *Server) RegisterRoutes(assets embed.FS) http.Handler {
r.Route("/{id}", func(r chi.Router) {
r.Use(handler.IssueCtx)
r.Get("/", handler.GetIssue)
r.Put("/", handler.UpdateIssue)
r.Patch("/", handler.UpdateIssue)
r.Delete("/", handler.DeleteIssue)
})
})
@@ -43,10 +44,15 @@ func (s *Server) RegisterRoutes(assets embed.FS) http.Handler {
}
func (s *Server) handleAssets(r chi.Router, assets embed.FS) {
r.Handle("/assets/*", http.StripPrefix("/assets/",
http.FileServer(http.Dir("pkg/web/assets"))))
fileServer := http.FileServer(http.Dir("pkg/web/assets"))
r.HandleFunc("GET /robots.txt", func(w http.ResponseWriter, r *http.Request) {
r.Handle("/assets/*",
http.StripPrefix("/assets/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "public, max-age=31536000, immutable")
fileServer.ServeHTTP(w, r)
})))
r.Get("/robots.txt", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache")
http.ServeContent(w, r, "robots.txt", time.Now(), strings.NewReader("User-agent: *\nAllow: /"))
})

View File

@@ -17,7 +17,7 @@ type Server struct {
// NewServer creates and configures a new HTTP server instance.
func NewServer(props Server) *http.Server {
if props.Address == "" {
props.Address = "localhost:8080"
props.Address = ":8080"
}
handler := props.RegisterRoutes(props.Assets)