Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Tweets are not shown #7

Open
freemountain opened this issue Jun 23, 2018 · 7 comments
Open

Tweets are not shown #7

freemountain opened this issue Jun 23, 2018 · 7 comments
Labels

Comments

@freemountain
Copy link
Contributor

Hi,
i am not sure if this i an issue with emuarius, go-ostatus or mastodon but i am not able to see tweets from twitter users inside mastodon (v2.4.0), only the profile with an empty timeline is visible. The output from the emuarius http api looks good and contains all the information.

I am willing to help with a PR but have no clue where to start.

@emersion
Copy link
Owner

It's possible that this is because of an incorrect signature. I've also seen issues with base64 encoding in the past.

I'd start by looking at Mastodon logs to see if there's anything interesting there.

@emersion emersion added the bug label Jun 23, 2018
@Luzifer
Copy link

Luzifer commented Nov 19, 2018

Looks like a bug in the salmon part of go-ostatus: I'm constantly recording HTTP 400 responses to a Mastodon instance when the /salmon path is posted.

One issue is: Mastodon sends a charset in their XRD responses: application/xrd+xml; charset=utf-8. This is fairly easy to fix:

diff --git a/xrd/client.go b/xrd/client.go
index 3e31c59..cb6d964 100644
--- a/xrd/client.go
+++ b/xrd/client.go
@@ -5,6 +5,7 @@ import (
        "encoding/xml"
        "errors"
        "net/http"
+       "strings"
 )

 // An HTTPError is returned when an HTTP error has occured. Its value is the
@@ -29,13 +30,13 @@ func Get(url string) (*Resource, error) {
        }

        resource := new(Resource)
-       switch resp.Header.Get("Content-Type") {
+       switch strings.Split(resp.Header.Get("Content-Type"), ";")[0] {
        case "application/xrd+xml", "application/xml", "text/xml":
                err = xml.NewDecoder(resp.Body).Decode(resource)
        case "application/jrd+json", "application/json", "":
                err = json.NewDecoder(resp.Body).Decode(resource)
        default:
-               err = errors.New("xrd: unsupported format")
+               err = errors.New("xrd: unsupported format: " + resp.Header.Get("Content-Type"))
        }
        return resource, err
 }

Then another problem is either something with the cryptographic signature in Mastodon or the verification in go-ostatus is broken… Until now I did not find the mismatch in there… The response sent to the Mastodon instance is: crypto/rsa: verification error

@emersion
Copy link
Owner

Yeah, I recall having similar issues. IIRC there were also some issues with the base64 mode we're using...

(In any case, can you submit a PR for this first patch? Also, using mime.ParseMediaType is preferred)

@Luzifer
Copy link

Luzifer commented Nov 19, 2018

Sure, as soon as my copy of the library is cleaned up from tons of debugging code I'm trying to hunt the issue down with… :D

@Luzifer
Copy link

Luzifer commented Nov 19, 2018

The hint for base64 issues was marvellous: Spared me much time and therefore emersion/go-ostatus#10 fixes both issues and restores communication with a Mastodon instance. Sadly that wasn't everything to fix this issue… Older Toots still are not loaded…

@emersion
Copy link
Owner

The hint for base64 issues was marvellous: Spared me much time and therefore emersion/go-ostatus#10 fixes both issues and restores communication with a Mastodon instance.

Cheers!

Sadly that wasn't everything to fix this issue… Older Toots still are not loaded…

Do you mean older tweets are not displayed as toots on Mastodon? Maybe that's some sort of pagination issue?

@Luzifer
Copy link

Luzifer commented Nov 20, 2018

When the account is first subscribed it shows an entirely empty Timeline instead of posts from the past. As soon as there was a first push those toots are shown. (When pushing old toots from before the subscribe they are displayed on top of the Timeline instead of being sorted so this might be an intended behavior of mastodon)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants