Setup up a first desktop version

This commit is contained in:
Daniele Tonon
2023-05-22 15:46:39 +02:00
parent e8a2932e09
commit 2b10bc61b7
6 changed files with 267 additions and 31 deletions

View File

@@ -81,14 +81,14 @@ func mergeMaps[K comparable, V any](m1 map[K]V, m2 map[K]V) map[K]V {
return m1
}
func prettyJsonOrRaw(j string) string {
var parsedContent any
func prettyJsonOrRaw(j string) (map[string]interface{}, string) {
var parsedContent map[string]interface{}
if err := json.Unmarshal([]byte(j), &parsedContent); err == nil {
if t, err := toml.Marshal(parsedContent); err == nil && len(t) > 0 {
return string(t)
return parsedContent, string(t)
}
}
return j
return nil, j
}
func getPreviewStyle(r *http.Request) string {