mirror of
https://git.phreedom.club/localhost_frssoft/bloat.git
synced 2024-10-31 18:57:16 +00:00
separate misskey struct; small handler for renote
This commit is contained in:
parent
5d4aab1d58
commit
baf388cb42
27
mastodon/misskey.go
Normal file
27
mastodon/misskey.go
Normal file
|
@ -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"`
|
||||
}
|
||||
|
||||
|
|
@ -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", "<br>", -1)
|
||||
status.Pleroma.Quote = "e
|
||||
}
|
||||
status.Account.ID = statusMisskey.User.ID
|
||||
status.Account.DisplayName = statusMisskey.User.Name
|
||||
if statusMisskey.User.Host != "" {
|
||||
|
|
Loading…
Reference in a new issue