Slight formatting change to HTML output, for consistency's sake

This commit is contained in:
Seednode 2022-10-28 19:18:34 -05:00
parent 5c7bb60dcb
commit 920bdb2615
2 changed files with 11 additions and 10 deletions

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
var Version = "0.20.1" var Version = "0.20.2"
func init() { func init() {
rootCmd.AddCommand(versionCmd) rootCmd.AddCommand(versionCmd)

View File

@ -76,11 +76,11 @@ func notFound(w http.ResponseWriter, r *http.Request) error {
htmlBody := `<html lang="en"> htmlBody := `<html lang="en">
<head> <head>
<style> <style>
a{display:block;height:100%;width:100%;text-decoration:none;color:inherit;cursor:auto;} a{display:block;height:100%;width:100%;text-decoration:none;color:inherit;cursor:auto;}
</style> </style>
<title> <title>
Not Found Not Found
</title> </title>
</head> </head>
<body> <body>
<a href="/">404 page not found</a> <a href="/">404 page not found</a>
@ -166,25 +166,26 @@ func serveHtml(w http.ResponseWriter, r *http.Request, filePath, dimensions stri
htmlBody += fmt.Sprintf("%v (%v)", fileName, dimensions) htmlBody += fmt.Sprintf("%v (%v)", fileName, dimensions)
htmlBody += `</title> htmlBody += `</title>
</head> </head>
<body>` <body>
`
switch { switch {
case Filter && Sort: case Filter && Sort:
htmlBody += fmt.Sprintf(`<a href="/?include=%v&exclude=%v&sort=%v"><img src="`, htmlBody += fmt.Sprintf(` <a href="/?include=%v&exclude=%v&sort=%v"><img src="`,
r.URL.Query().Get("include"), r.URL.Query().Get("include"),
r.URL.Query().Get("exclude"), r.URL.Query().Get("exclude"),
r.URL.Query().Get("sort"), r.URL.Query().Get("sort"),
) )
case Filter && !Sort: case Filter && !Sort:
htmlBody += fmt.Sprintf(`<a href="/?include=%v&exclude=%v"><img src="`, htmlBody += fmt.Sprintf(` <a href="/?include=%v&exclude=%v"><img src="`,
r.URL.Query().Get("include"), r.URL.Query().Get("include"),
r.URL.Query().Get("exclude"), r.URL.Query().Get("exclude"),
) )
case !Filter && Sort: case !Filter && Sort:
htmlBody += fmt.Sprintf(`<a href="/?sort=%v"><img src="`, htmlBody += fmt.Sprintf(` <a href="/?sort=%v"><img src="`,
r.URL.Query().Get("sort"), r.URL.Query().Get("sort"),
) )
default: default:
htmlBody += `<a href="/"><img src="` htmlBody += ` <a href="/"><img src="`
} }
htmlBody += PREFIX htmlBody += PREFIX
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {