From 62f653fc2828aec56841348f56b67c37e1c9b822 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Mon, 13 Nov 2023 13:40:42 +0300 Subject: [PATCH] allow params with values --- mastodon/status.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mastodon/status.go b/mastodon/status.go index 7fbbe79..806eb6c 100644 --- a/mastodon/status.go +++ b/mastodon/status.go @@ -269,8 +269,8 @@ func (c *Client) TrueRemoteTimeline(ctx context.Context, instance string, instan perform := url.URL{ Scheme: "https", Host: instance, - RawQuery: params.Encode(), } + var paramval []string withFiles := "false" withReplies := "false" globalTimeline := false @@ -285,7 +285,12 @@ func (c *Client) TrueRemoteTimeline(ctx context.Context, instance string, instan globalTimeline = true params.Set(instanceParam, "true") default: - params.Set(instanceParam, "true") + paramval = strings.Split(instanceParam, "=") + if len(paramval) == 2 { + params.Set(paramval[0], paramval[1]) + } else { + params.Set(instanceParam, "true") + } } } @@ -313,6 +318,10 @@ func (c *Client) TrueRemoteTimeline(ctx context.Context, instance string, instan } } default: + if globalTimeline { + params.Set("local", "false") + } + perform.RawQuery = params.Encode() perform.Path = "api/v1/timelines/public" method = http.MethodGet ContentType = "application/x-www-form-urlencoded"