This commit is contained in:
Magnus Åhall 2026-02-23 07:04:57 +01:00
parent 36baaf0caf
commit ad638acaf3
7 changed files with 120 additions and 37 deletions

View file

@ -11,6 +11,7 @@ import (
"net/http"
"os"
"slices"
"html/template"
)
var (
@ -65,12 +66,17 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
slices.SortFunc(entries, SortDNSRecord)
data["DNSRecords"] = entries
tree := RecordsTree{}
tree = tree.BuildTree(entries, 0, 1)
fmt.Printf("\n\x1b[32;1mSTART\x1b[0m\n")
tree := BuildRecordsTree(entries)
htmlTree := tree.ToHTML([]string{})
data["Tree"] = template.HTML(htmlTree)
fmt.Printf("\n\x1b[32;1mDONE\x1b[0m\n")
j, _ := json.Marshal(tree)
os.WriteFile("/tmp/tree.json", j, 0644)
data["VERSION"] = VERSION
page.Data = data
err = htmlEngine.Render(page, w, r)