From 8d91d619dd34f5be1a5bd730cf66f8e3b87acc97 Mon Sep 17 00:00:00 2001 From: hkc Date: Sun, 2 Jul 2023 20:51:48 +0300 Subject: [PATCH] Workaround for wrong redirects on some instances --- config.ini | 5 +++++ mastoposter/__main__.py | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config.ini b/config.ini index 230c539..8a313b1 100644 --- a/config.ini +++ b/config.ini @@ -6,6 +6,11 @@ modules = telegram # Mastodon instance to grab posts from instance = mastodon.example.org +# Uncomment and change this if your instance makes invalid redirects +# on the streaming path (like mastodon.social does). Check the following issue +# for more details: https://github.com/hatkidchan/mastoposter/issues/45 +#streaming-url = wss://streaming.mastodon.example.org/api/v1/streaming + # Mastodon user token. # Required permissions: read:accounts read:statuses read:lists # You can get your token by creating application in diff --git a/mastoposter/__main__.py b/mastoposter/__main__.py index 24188e8..d360fa7 100644 --- a/mastoposter/__main__.py +++ b/mastoposter/__main__.py @@ -136,7 +136,10 @@ def main(): logger.info("account.id=%s", user_id) - url = "wss://{}/api/v1/streaming".format(conf["main"]["instance"]) + url = conf["main"].get( + "streaming_url", + "wss://{}/api/v1/streaming".format(conf["main"]["instance"]), + ) run( listen(