New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweets are not shown #7

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

Comments

3 participants
@freemountain
Copy link
Contributor

freemountain commented Jun 23, 2018

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

This comment has been minimized.

Copy link
Owner

emersion commented Jun 23, 2018

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Owner

emersion commented Nov 19, 2018

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Owner

emersion commented Nov 20, 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.

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

This comment has been minimized.

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 join this conversation on GitHub. Already have an account? Sign in to comment