diff --git a/webapi/formatting.go b/webapi/formatting.go index d9358b8..47d59c8 100644 --- a/webapi/formatting.go +++ b/webapi/formatting.go @@ -1,7 +1,10 @@ package webapi import ( + "bytes" + "encoding/json" "fmt" + "html/template" "strings" "time" ) @@ -33,3 +36,14 @@ func stripWss(input string) string { input = strings.ReplaceAll(input, "/ws", "") return input } + +func indentJSON(input string) template.HTML { + var indented bytes.Buffer + err := json.Indent(&indented, []byte(input), "
", "    ") + if err != nil { + log.Errorf("Failed to indent JSON: %w", err) + return template.HTML(input) + } + + return template.HTML(indented.String()) +} diff --git a/webapi/public/css/vspd.css b/webapi/public/css/vspd.css index 928914e..7ff3d30 100644 --- a/webapi/public/css/vspd.css +++ b/webapi/public/css/vspd.css @@ -117,7 +117,6 @@ footer .code { } .block__content table th { - vertical-align: top; white-space: nowrap; } @@ -128,6 +127,7 @@ footer .code { .ticket-table td { font-size: 14px; text-align: left; + padding-right: 0; } @@ -160,4 +160,4 @@ footer .code { #status-table .with-text { padding-left: 40px; -} \ No newline at end of file +} diff --git a/webapi/templates/admin.html b/webapi/templates/admin.html index 5118402..9f49868 100644 --- a/webapi/templates/admin.html +++ b/webapi/templates/admin.html @@ -193,7 +193,7 @@ - + @@ -201,7 +201,7 @@ - + diff --git a/webapi/webapi.go b/webapi/webapi.go index c9310ee..fc01b1e 100644 --- a/webapi/webapi.go +++ b/webapi/webapi.go @@ -182,6 +182,7 @@ func router(debugMode bool, cookieSecret []byte, dcrd rpc.DcrdConnect, wallets r "blockURL": blockURL(cfg.BlockExplorerURL), "dateTime": dateTime, "stripWss": stripWss, + "indentJSON": indentJSON, }) router.LoadHTMLGlob("webapi/templates/*.html")
Request{{ $value.Request }}{{ indentJSON $value.Request }}
Request
Signature
Response{{ $value.Response }}{{ indentJSON $value.Response }}
Response
Signature