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

@@ -14,8 +14,6 @@ var headscaleCSS string
//go:embed headscale.svg
var headscaleSVG string
// mdTypesetBody creates a body element with md-typeset styling
// that matches the official Headscale documentation design.
// Uses CSS classes with styles defined in headscaleCSS.
@@ -191,8 +189,8 @@ func HtmlStructure(head, body *elem.Element) *elem.Element {
}),
// Google Fonts for Roboto and Roboto Mono
elem.Link(attrs.Props{
attrs.Rel: "preconnect",
attrs.Href: "https://fonts.gstatic.com",
attrs.Rel: "preconnect",
attrs.Href: "https://fonts.gstatic.com",
"crossorigin": "",
}),
elem.Link(attrs.Props{
@@ -206,3 +204,20 @@ func HtmlStructure(head, body *elem.Element) *elem.Element {
body,
)
}
// BlankPage creates a minimal blank HTML page with favicon.
// Used for endpoints that need to return a valid HTML page with no content.
func BlankPage() *elem.Element {
return elem.Html(attrs.Props{attrs.Lang: "en"},
elem.Head(nil,
elem.Meta(attrs.Props{
attrs.Charset: "UTF-8",
}),
elem.Link(attrs.Props{
attrs.Rel: "icon",
attrs.Href: "/favicon.ico",
}),
),
elem.Body(nil),
)
}