mirror of
https://gitlab.melroy.org/melroy/fediresolve.git
synced 2025-06-07 11:58:55 +00:00
Also add avatar link in summary
This commit is contained in:
parent
b5b569ddc5
commit
ce59e5a4a8
1 changed files with 7 additions and 7 deletions
|
@ -6,10 +6,10 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
h2m "github.com/JohannesKaufmann/html-to-markdown"
|
||||
"github.com/fatih/color"
|
||||
"github.com/tidwall/gjson"
|
||||
markdown "github.com/vlanse/go-term-markdown"
|
||||
h2m "github.com/JohannesKaufmann/html-to-markdown"
|
||||
)
|
||||
|
||||
// Format takes ActivityPub data and returns a formatted string representation
|
||||
|
@ -88,6 +88,12 @@ func formatActor(jsonStr string, parts []string, bold, cyan, green, red, yellow
|
|||
parts = append(parts, fmt.Sprintf("%s: %s", bold("URL"), green(url)))
|
||||
}
|
||||
|
||||
// Add avatar (icon) link if present
|
||||
iconUrl := gjson.Get(jsonStr, "icon.url").String()
|
||||
if iconUrl != "" {
|
||||
parts = append(parts, fmt.Sprintf("%s: %s", bold("Avatar"), green(iconUrl)))
|
||||
}
|
||||
|
||||
if summary := gjson.Get(jsonStr, "summary").String(); summary != "" {
|
||||
md := htmlToMarkdown(summary)
|
||||
parts = append(parts, fmt.Sprintf("%s:\n%s", bold("Summary"), renderMarkdown(md)))
|
||||
|
@ -105,12 +111,6 @@ func formatActor(jsonStr string, parts []string, bold, cyan, green, red, yellow
|
|||
parts = append(parts, fmt.Sprintf("%s: %s", bold("Following"), green(following)))
|
||||
}
|
||||
|
||||
// Add avatar (icon) link if present
|
||||
iconUrl := gjson.Get(jsonStr, "icon.url").String()
|
||||
if iconUrl != "" {
|
||||
parts = append(parts, fmt.Sprintf("%s: %s", bold("Avatar"), green(iconUrl)))
|
||||
}
|
||||
|
||||
return parts
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue