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 {
|
type Blog struct {
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
Date string `json:"created_at"`
|
Date string `json:"created_at"`
|
||||||
|
Author Account `json:"account"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
@ -281,7 +282,7 @@ func printThread(conn *tls.Conn, baseURL, tootID string) {
|
||||||
|
|
||||||
// Print each anscestor
|
// Print each anscestor
|
||||||
for _, toot := range thread.Ancestors {
|
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 {
|
if err != nil {
|
||||||
log.Println("handleConn: %s", err)
|
log.Println("handleConn: %s", err)
|
||||||
return
|
return
|
||||||
|
@ -289,7 +290,7 @@ func printThread(conn *tls.Conn, baseURL, tootID string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print original toot
|
// 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 {
|
if err != nil {
|
||||||
log.Println("handleConn: %s", err)
|
log.Println("handleConn: %s", err)
|
||||||
return
|
return
|
||||||
|
@ -302,7 +303,7 @@ func printThread(conn *tls.Conn, baseURL, tootID string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, toot := range thread.Descendants {
|
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 {
|
if err != nil {
|
||||||
log.Println("handleConn: %s", err)
|
log.Println("handleConn: %s", err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue