diff --git a/mastodon/misskey.go b/mastodon/misskey.go new file mode 100644 index 0000000..7edb8b4 --- /dev/null +++ b/mastodon/misskey.go @@ -0,0 +1,27 @@ +package mastodon + +type MisskeyStatus struct { + ID string `json:"id"` + User AccountMisskey `json:"user"` + Renote *MisskeyStatus `json:"renote"` + CreatedAt CreatedAt `json:"createdAt"` + Visibility string `json:"visibility"` + CW string `json:"cw"` + URL string `json:"url"` + Text string `json:"text"` + Files []Attachment `json:"files"` + RenoteCount int64 `json:"renoteCount"` + RepliesCount int64 `json:"repliesCount"` + Reactions map[string]int `json:"reactions"` +} + +type AccountMisskey struct { + ID string `json:"id"` + Host string `json:"host"` + Name string `json:"name"` + Username string `json:"username"` + AvatarURL string `json:"avatarUrl"` + IsBot bool `json:"isBot"` +} + + diff --git a/mastodon/status.go b/mastodon/status.go index 38a713b..7c83b24 100644 --- a/mastodon/status.go +++ b/mastodon/status.go @@ -92,29 +92,6 @@ type Status struct { RetweetedByID string `json:"retweeted_by_id"` } -type MisskeyStatus struct { - ID string `json:"id"` - User AccountMisskey `json:"user"` - CreatedAt CreatedAt `json:"createdAt"` - Visibility string `json:"visibility"` - CW string `json:"cw"` - URL string `json:"url"` - Text string `json:"text"` - Files []Attachment `json:"files"` - RenoteCount int64 `json:"renoteCount"` - RepliesCount int64 `json:"repliesCount"` - Reactions map[string]int `json:"reactions"` -} - -type AccountMisskey struct { - ID string `json:"id"` - Host string `json:"host"` - Name string `json:"name"` - Username string `json:"username"` - AvatarURL string `json:"avatarUrl"` - IsBot bool `json:"isBot"` -} - // Context hold information for mastodon context. type Context struct { Ancestors []*Status `json:"ancestors"` @@ -352,6 +329,14 @@ func (c *Client) TrueRemoteTimeline(ctx context.Context, instance string, instan for _, statusMisskey := range misskeyData { var status Status status.ID = statusMisskey.ID + if statusMisskey.Renote != nil { + // small handle for strange reblogs in misskey + // handle as quoted post because akkoma/pleroma makes same + var quote Status + quote.ID = statusMisskey.Renote.ID + quote.Content = strings.Replace(statusMisskey.Renote.Text, "\n", "
", -1) + status.Pleroma.Quote = "e + } status.Account.ID = statusMisskey.User.ID status.Account.DisplayName = statusMisskey.User.Name if statusMisskey.User.Host != "" {