From d122d841e8b7dd7f8942b6f2fa84220f95f2cae4 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Wed, 10 Sep 2025 00:46:42 +0100 Subject: Add optional CSS to html --- api/handlers/html.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'api/handlers/html.go') diff --git a/api/handlers/html.go b/api/handlers/html.go index dd5d4e8..2f6688c 100644 --- a/api/handlers/html.go +++ b/api/handlers/html.go @@ -7,6 +7,28 @@ import ( "git.leonardobishop.net/history/pkg/html" ) +const style = `` + func GetEntriesHtml(entriesService entries.Service, htmlService html.Service) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { entries, err := entriesService.GetEntries() @@ -21,6 +43,20 @@ func GetEntriesHtml(entriesService entries.Service, htmlService html.Service) ht return } + if r.URL.Query().Get("css") == "no" { + goto send + } + + html = ` + + +History +` + style + ` + +` + html + ` +` + + send: w.Header().Set("Content-Type", "text/html;charset=UTF-8") w.Write([]byte(html)) } -- cgit v1.2.3-70-g09d2