Add author name in thread
This commit is contained in:
parent
4ebfcd27f1
commit
c9fabd4967
13
server.go
13
server.go
|
@ -18,9 +18,10 @@ import (
|
|||
)
|
||||
|
||||
type Blog struct {
|
||||
Id string `json:"id"`
|
||||
Content string `json:"content"`
|
||||
Date string `json:"created_at"`
|
||||
Id string `json:"id"`
|
||||
Content string `json:"content"`
|
||||
Date string `json:"created_at"`
|
||||
Author Account `json:"account"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
|
@ -281,7 +282,7 @@ func printThread(conn *tls.Conn, baseURL, tootID string) {
|
|||
|
||||
// Print each anscestor
|
||||
for _, toot := range thread.Ancestors {
|
||||
_, err = fmt.Fprintf(conn, "\n```\n* Posted on " + toot.Date + " *\n```\n" + removeHTMLTags(toot.Content) + "\n")
|
||||
_, err = fmt.Fprintf(conn, "\n```\n* Posted on " + toot.Date + " by " + toot.Author.Name + " *\n```\n" + removeHTMLTags(toot.Content) + "\n")
|
||||
if err != nil {
|
||||
log.Println("handleConn: %s", err)
|
||||
return
|
||||
|
@ -289,7 +290,7 @@ func printThread(conn *tls.Conn, baseURL, tootID string) {
|
|||
}
|
||||
|
||||
// Print original toot
|
||||
_, err = fmt.Fprintf(conn, "\n# Toot\n\n```\n* Posted on " + originalToot.Date + " *\n```\n" + removeHTMLTags(originalToot.Content) + "\n")
|
||||
_, err = fmt.Fprintf(conn, "\n# Toot\n\n```\n* Posted on " + originalToot.Date + " by "+ originalToot.Author.Name +" *\n```\n" + removeHTMLTags(originalToot.Content) + "\n")
|
||||
if err != nil {
|
||||
log.Println("handleConn: %s", err)
|
||||
return
|
||||
|
@ -302,7 +303,7 @@ func printThread(conn *tls.Conn, baseURL, tootID string) {
|
|||
return
|
||||
}
|
||||
for _, toot := range thread.Descendants {
|
||||
_, err = fmt.Fprintf(conn, "\n```\n* Posted on " + toot.Date + " *\n```\n" + removeHTMLTags(toot.Content) + "\n")
|
||||
_, err = fmt.Fprintf(conn, "\n```\n* Posted on " + toot.Date + " by " + toot.Author.Name + " *\n```\n" + removeHTMLTags(toot.Content) + "\n")
|
||||
if err != nil {
|
||||
log.Println("handleConn: %s", err)
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue