From 18c37c0c2fb96c4a8dd7b08c5abc88f4c3283605 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Mon, 13 Nov 2023 11:41:08 +0300 Subject: [PATCH] true remote timeline params tweaks --- mastodon/status.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/mastodon/status.go b/mastodon/status.go index 7c9896a..7fbbe79 100644 --- a/mastodon/status.go +++ b/mastodon/status.go @@ -108,6 +108,7 @@ type MisskeyStatus struct { type AccountMisskey struct { ID string `json:"id"` + Host string `json:"host"` Name string `json:"name"` Username string `json:"username"` AvatarURL string `json:"avatarUrl"` @@ -272,12 +273,17 @@ func (c *Client) TrueRemoteTimeline(ctx context.Context, instance string, instan } withFiles := "false" withReplies := "false" + globalTimeline := false for _, instanceParam := range instanceParams { switch instanceParam { case "withFiles": withFiles = "true" + params.Set("only_media", "true") case "withReplies": withReplies = "true" + case "remote": + globalTimeline = true + params.Set(instanceParam, "true") default: params.Set(instanceParam, "true") } @@ -288,7 +294,11 @@ func (c *Client) TrueRemoteTimeline(ctx context.Context, instance string, instan var bytesAttach []byte switch instance_type { case "misskey": - perform.Path = "api/notes/local-timeline" + if globalTimeline { + perform.Path = "api/notes/global-timeline" + } else { + perform.Path = "api/notes/local-timeline" + } perform.RawQuery = "" method = http.MethodPost ContentType = "application/json" @@ -335,7 +345,11 @@ func (c *Client) TrueRemoteTimeline(ctx context.Context, instance string, instan status.ID = statusMisskey.ID status.Account.ID = statusMisskey.User.ID status.Account.DisplayName = statusMisskey.User.Name - status.Account.Acct = statusMisskey.User.Username + if statusMisskey.User.Host != "" { + status.Account.Acct = statusMisskey.User.Username + "@" + statusMisskey.User.Host + } else { + status.Account.Acct = statusMisskey.User.Username + } status.Account.Username = statusMisskey.User.Username status.Account.Avatar = statusMisskey.User.AvatarURL status.CreatedAt = statusMisskey.CreatedAt