Compare commits
No commits in common. "main" and "1.2" have entirely different histories.
7
main.go
7
main.go
|
@ -22,6 +22,11 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type OriginalBlog struct {
|
||||||
|
Id string `json:"id"`
|
||||||
|
Author Account `json:"account"`
|
||||||
|
}
|
||||||
|
|
||||||
type Blog struct {
|
type Blog struct {
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
|
@ -29,7 +34,7 @@ type Blog struct {
|
||||||
Author Account `json:"account"`
|
Author Account `json:"account"`
|
||||||
Tags []Tag `json:"tags"`
|
Tags []Tag `json:"tags"`
|
||||||
Mentions []Mention `json:"mentions"`
|
Mentions []Mention `json:"mentions"`
|
||||||
Reblog *Blog `json:"reblog"`
|
Reblog *OriginalBlog `json:"reblog"`
|
||||||
Medias []Media `json:"media_attachments"`
|
Medias []Media `json:"media_attachments"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
util.go
7
util.go
|
@ -89,12 +89,7 @@ func removeHTMLTags(content string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func formatBlog(toot Blog) string {
|
func formatBlog(toot Blog) string {
|
||||||
var content string
|
content := toot.Content
|
||||||
if toot.Reblog == nil {
|
|
||||||
content = toot.Content
|
|
||||||
} else {
|
|
||||||
content = toot.Reblog.Content
|
|
||||||
}
|
|
||||||
content = removeHTMLTags(content)
|
content = removeHTMLTags(content)
|
||||||
content = strings.Trim(content, " \n\r")
|
content = strings.Trim(content, " \n\r")
|
||||||
content = strings.ReplaceAll(content, "\n#", "\n[#]")
|
content = strings.ReplaceAll(content, "\n#", "\n[#]")
|
||||||
|
|
Loading…
Reference in New Issue