diff options
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/accounts.go | 2 | ||||
-rw-r--r-- | mastodon/mastodon.go | 7 | ||||
-rw-r--r-- | mastodon/status.go | 6 |
3 files changed, 11 insertions, 4 deletions
diff --git a/mastodon/accounts.go b/mastodon/accounts.go index c5eb227..694e672 100644 --- a/mastodon/accounts.go +++ b/mastodon/accounts.go @@ -60,7 +60,7 @@ func (c *Client) GetAccount(ctx context.Context, id string) (*Account, error) { if err != nil { return nil, err } - if account.Pleroma == nil { + if account.Pleroma == nil || len(account.Pleroma.Relationship.ID) < 1 { rs, err := c.GetAccountRelationships(ctx, []string{id}) if err != nil { return nil, err diff --git a/mastodon/mastodon.go b/mastodon/mastodon.go index 658b09b..8678314 100644 --- a/mastodon/mastodon.go +++ b/mastodon/mastodon.go @@ -91,7 +91,12 @@ func (c *Client) doAPI(ctx context.Context, method string, uri string, params in var buf bytes.Buffer mw := multipart.NewWriter(&buf) - part, err := mw.CreateFormFile("file", filepath.Base(file.Filename)) + fname := filepath.Base(file.Filename) + err = mw.WriteField("description", fname) + if err != nil { + return err + } + part, err := mw.CreateFormFile("file", fname) if err != nil { return err } diff --git a/mastodon/status.go b/mastodon/status.go index c8555d6..80e7e0e 100644 --- a/mastodon/status.go +++ b/mastodon/status.go @@ -191,9 +191,11 @@ func (c *Client) GetTimelineHome(ctx context.Context, pg *Pagination) ([]*Status } // GetTimelinePublic return statuses from public timeline. -func (c *Client) GetTimelinePublic(ctx context.Context, isLocal bool, pg *Pagination) ([]*Status, error) { +func (c *Client) GetTimelinePublic(ctx context.Context, isLocal bool, instance string, pg *Pagination) ([]*Status, error) { params := url.Values{} - if isLocal { + if len(instance) > 0 { + params.Set("instance", instance) + } else if isLocal { params.Set("local", "true") } |