aboutsummaryrefslogtreecommitdiff
path: root/mastodon
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2021-01-30 04:13:22 +0000
committerr <r@freesoftwareextremist.com>2021-01-30 04:13:22 +0000
commit9f34b607498c09b4a21bdcc82b3295f6c94bd058 (patch)
treec5a528cad05227f15f30b07f6d0056045176166b /mastodon
parentc3f39210d8451d65f3ecaa88046380f42dc536a1 (diff)
parent3ac95ab3b117ee8867a30c8e4b30ab37411e5ccf (diff)
downloadbloat-9f34b607498c09b4a21bdcc82b3295f6c94bd058.tar.gz
bloat-9f34b607498c09b4a21bdcc82b3295f6c94bd058.zip
Merge branch 'master' into absolute_fluoride
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/accounts.go2
-rw-r--r--mastodon/mastodon.go7
-rw-r--r--mastodon/status.go6
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")
}