👔 Drop sensitive posts from mastodon
This commit is contained in:
parent
14335084a1
commit
7a12d375c1
@ -21,10 +21,11 @@ type MastodomAttachment struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MastodonPost struct {
|
type MastodonPost struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Account struct {
|
Sensitive bool `json:"sensitive"`
|
||||||
|
Account struct {
|
||||||
Acct string `json:"acct"`
|
Acct string `json:"acct"`
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
DisplayName string `json:"display_name"`
|
DisplayName string `json:"display_name"`
|
||||||
@ -84,6 +85,10 @@ func FetchTimeline(server string, limit int) ([]MastodonPost, error) {
|
|||||||
return nil, fmt.Errorf("failed to parse timeline JSON: %v", err)
|
return nil, fmt.Errorf("failed to parse timeline JSON: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
posts = lo.Filter(posts, func(item MastodonPost, index int) bool {
|
||||||
|
return !item.Sensitive
|
||||||
|
})
|
||||||
|
|
||||||
for idx := range posts {
|
for idx := range posts {
|
||||||
posts[idx].Server = strings.Replace(strings.Replace(server, "https://", "", 1), "http://", "", 1)
|
posts[idx].Server = strings.Replace(strings.Replace(server, "https://", "", 1), "http://", "", 1)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user