Added file count to HTML debug endpoint

This commit is contained in:
Seednode 2023-06-02 21:00:44 -05:00
parent 4679208eae
commit 99ad647614
2 changed files with 6 additions and 2 deletions

View File

@ -74,5 +74,5 @@ func init() {
}) })
rootCmd.SetVersionTemplate("roulette v{{.Version}}\n") rootCmd.SetVersionTemplate("roulette v{{.Version}}\n")
rootCmd.Version = "0.49.0" rootCmd.Version = "0.49.1"
} }

View File

@ -631,6 +631,8 @@ func serveDebugHtml(args []string, index *Index) http.HandlerFunc {
indexDump := index.Index() indexDump := index.Index()
fileCount := strconv.Itoa(len(indexDump))
sort.SliceStable(indexDump, func(p, q int) bool { sort.SliceStable(indexDump, func(p, q int) bool {
return indexDump[p] < indexDump[q] return indexDump[p] < indexDump[q]
}) })
@ -639,7 +641,9 @@ func serveDebugHtml(args []string, index *Index) http.HandlerFunc {
htmlBody.WriteString(`<!DOCTYPE html><html lang="en"><head>`) htmlBody.WriteString(`<!DOCTYPE html><html lang="en"><head>`)
htmlBody.WriteString(`<style>a{display:block;height:100%;width:100%;text-decoration:none;color:inherit;cursor:auto;}</style>`) htmlBody.WriteString(`<style>a{display:block;height:100%;width:100%;text-decoration:none;color:inherit;cursor:auto;}</style>`)
htmlBody.WriteString(`<title>Debug</title></head><body>`) htmlBody.WriteString(`<title>Listing `)
htmlBody.WriteString(fileCount)
htmlBody.WriteString(` files</title></head><body>`)
for _, v := range indexDump { for _, v := range indexDump {
var shouldSort = "" var shouldSort = ""