hscontrol: convert BlankHandler to use elem-go

This commit is contained in:
Kristoffer Dalby
2025-11-12 04:54:29 +01:00
committed by Kristoffer Dalby
parent 75e24de7bd
commit 09c9762fe0
2 changed files with 29 additions and 10 deletions

View File

@@ -286,12 +286,16 @@ func FaviconHandler(writer http.ResponseWriter, req *http.Request) {
http.ServeContent(writer, req, "favicon.ico", time.Unix(0, 0), bytes.NewReader(favicon))
}
// Returns a blank page with favicon linked.
// BlankHandler returns a blank page with favicon linked.
func BlankHandler(writer http.ResponseWriter, res *http.Request) {
writer.Header().Set("Content-Type", "text/html; charset=utf-8")
io.WriteString(writer, `
<!doctype html><html><head>
<link rel="icon" href="/favicon.ico">
</head><body></body></html>
`)
writer.WriteHeader(http.StatusOK)
_, err := writer.Write([]byte(templates.BlankPage().Render()))
if err != nil {
log.Error().
Caller().
Err(err).
Msg("Failed to write HTTP response")
}
}