Files
vsix-hpl-toolbox/standalone/home.go
2026-05-27 18:37:52 +08:00

32 lines
781 B
Go

package main
import (
"net/http"
"strings"
)
func HomePage(w http.ResponseWriter, r *http.Request) {
cfg := LoadConfig()
var items strings.Builder
for _, n := range visibleNavItems(cfg.BetaToolsEnabled) {
if n.Path == "/" {
continue
}
label := n.Label
if n.Beta {
label += ` <span style="font-size:10px;opacity:0.65;text-transform:uppercase;">Beta</span>`
}
items.WriteString(`<li><a href="` + n.Path + `" style="color:#9cdcfe;">` + label + `</a> — ` + n.Description + `</li>`)
}
body := `
<h2>HPL Toolbox</h2>
<p class="hint">Standalone build. Pick a tool from the top bar.</p>
<ul style="line-height:1.9;">
` + items.String() + `
</ul>
`
w.Header().Set("Content-Type", "text/html; charset=utf-8")
_, _ = w.Write([]byte(Page("/", "Home", body)))
}