kensanata / bitlbee-mastodon

A Mastodon plugin for Bitlbee
https://alexschroeder.ch/software/Bitlbee_Mastodon
GNU General Public License v2.0
30 stars 7 forks source link

Pleroma and GoToSocial support #37

Open velartrill opened 4 years ago

velartrill commented 4 years ago

bitlbee-mastodon currently does not support pleroma, because pleroma requires the use of websockets to subscribe to its event stream, and bitlbee-mastodon uses the mastodon-style streaming API instead. we may want to look at bitlbee-discord, which already uses websocket - it might be possible to translate its implementation to the pleroma API.

kensanata commented 4 years ago

Anybody interested in helping out, the beginning of some code is in the websockets branch: #43.

kensanata commented 4 years ago

I currently able to sign in to a Pleroma instance, but I keep getting disconnected:

pleroma - Logging in: Verifying credentials
pleroma - Logging in: Getting home timeline
pleroma - Login error: Failed to switch to websocket mode for /api/v1/streaming?stream=user
pleroma - Logging in: Signing off..
fedialexschroederch_kens QUIT bitlbee.localhost mastodon.localhost

Looks like the request I'm sending is something like this:

HTTP/1.1 
Host: fedi.alexschroeder.ch 
Connection: keep-alive, Upgrade 
Upgrade: websocket 
Origin: https://fedi.alexschroeder.ch 
Pragma: no-cache 
Cache-Control: no-cache 
Authorization: Bearer XXXXXXXXXXXXXXXXXXXX
Sec-WebSocket-Version: 13 
Sec-WebSocket-Key: 57tuV1d0Q1g6fZmC3nnwTQ== 
User-Agent: BitlBee 3.6 

And the reply I'm getting from my Pleroma instance is something like this:

HTTP/1.1 403 Forbidden 
content-length: 0 
date: Sun, 08 Dec 2019 19:43:48 GMT 
server: Cowboy 
kensanata commented 4 years ago

That issue was solved by also appending the access token as a parameter to the URL. This goes against what I believe is correct. It should be passed along as an HTTP header. Oh well.

kensanata commented 4 years ago

Next problem: I'm getting empty websocket messages that cannot be parsed, I'm not seeing any statuses in my timeline and I'm being disconnected after 2min.

23:12 <root> pleroma - Logging in: Websocket connected: /api/v1/streaming?stream=user
23:12 <root> pleroma - Logging in: Logged in
23:12 <root> pleroma - Data to parse /api/v1/streaming?stream=user:  (0 bytes)
23:12 <root> pleroma - Error: Unparsed data on /api/v1/streaming?stream=user: 
23:12 <root> pleroma - Data to parse /api/v1/streaming?stream=user:  (0 bytes)
23:12 <root> pleroma - Error: Unparsed data on /api/v1/streaming?stream=user: 
23:13 <root> pleroma - Data to parse /api/v1/streaming?stream=user:  (0 bytes)
23:13 <root> pleroma - Error: Unparsed data on /api/v1/streaming?stream=user: 
23:13 <root> pleroma - Data to parse /api/v1/streaming?stream=user:  (0 bytes)
23:13 <root> pleroma - Error: Unparsed data on /api/v1/streaming?stream=user: 
23:14 <root> pleroma - Error: Connection timeout
23:14 <root> pleroma - Signing off..
23:14 *** fedialexschroederch_kens QUIT bitlbee.localhost mastodon.localhost
23:14 <root> pleroma - Logging in: Reconnecting in 5 seconds..
23:14 <root> pleroma - Logging in: Login
23:14 <root> pleroma - Logging in: Connecting
23:14 *** fedialexschroederch_kens JOIN
velartrill commented 4 years ago

i'll see about compiling the branch and trying it with my pleroma account when i have time later this evening

On Sunday, December 8, 2019, Alex Schroeder wrote:

I'm still getting this error, even if I'm using the branch with websocket support #43:

Login error: OAuth failure (unsupported_grant_type)

I don't know what to do about that. I think support for OAuth scopes got added with MR #1643 closing issue #1234. I guess my Pleroma instance is too old?

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/kensanata/bitlbee-mastodon/issues/37#issuecomment-56298171

ToxicFrog commented 1 year ago

This also affects support for GoToSocial, which implements the websocket API but not the SSE one.