Closed hatkidchan closed 2 years ago
Sending token both as access_token
query parameter and Authorization: Bearer XXX
does nothing, /api/v1/streaming
still fails with Unauthorized
status code. That's probably because default token doesn't have permissions to work with streaming.
# List streams.
def get_topic(
"list",
%User{id: user_id} = user,
%Token{user_id: user_id} = oauth_token,
%{"list" => id}
) do
cond do
OAuthScopesPlug.filter_descendants(["read", "read:lists"], oauth_token.scopes) == [] ->
{:error, :unauthorized}
Pleroma.List.get(id, user) ->
{:ok, "list:" <> to_string(id)}
true ->
{:error, :bad_topic}
end
end
I know nothing about Pleroma API nor I have any experience in Elixir. If anyone does, please, explain to me how should I authenticate myself to work with streaming API.
Ok turns out I was just dumb and forgot to change instance to Pleroma one :skull:
Anyways, it still fails because Pleroma (or at least EMR) doesn't return the "discoverable" field in the "account". I'll just make it fall back to False
for the time being. Not like it's important for the crossposter
@cmd410 pls confirm that Pleroma works
Nope, pleroma doesn't work apparently. Literally nothing happens
@cmd410: Literally nothing happens
Hmmm, dunno, i've set instance, token, user id, bot token, and channel, launched it, and it just hangs doing nothing
If you're on latest commit, try adding this into mastoposter/__init__.py
near line 18:
async for status in source(**kwargs): # <= this is line 18
print(f"{user=} {status.account.id=} {status.visibility=}")
if status.account.id != user:
continue
Was using it on Pleroma for a while already, seems to be working more or less fine. Closing it now. In case there's any issues with Pleroma, please, create separate one
For now it's not really possible to get posts from Pleroma instances. Though, it's kinda against "Mastodon" part of mastoposter, it still should be considered to be done.
For now all I know is that:
Authorization
header is not enoughTBD:
Status
object, as well as any other (Account
seems to be a bit different, that may cause some problems in the current implementation)