Skip to content

Commit 1c4e703

Browse files
Your Namealphatownsman
Your Name
authored andcommitted
GTS does not support multiple redirect_uris
1 parent db8f42a commit 1c4e703

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

mastodon/api.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,10 @@ def get_or_create_fediverse_application(login_domain):
376376
app = MastodonApplication.objects.filter(domain_name__iexact=domain).first()
377377
if app:
378378
return app
379-
allow_multiple_redir = True # TODO detect site supports multiple redirect uris
379+
allow_multiple_redir = True
380+
if "; Pixelfed" in server_version or server_version.startswith("0."):
381+
# Pixelfed and GoToSocial don't support multiple redirect uris
382+
allow_multiple_redir = False
380383
response = create_app(api_domain, allow_multiple_redir)
381384
if response.status_code != 200:
382385
logger.error(

mastodon/management/commands/mastodon_sites.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from django.core.management.base import BaseCommand
44

5-
from mastodon.api import create_app
5+
from mastodon.api import create_app, detect_server_info
66
from mastodon.models import MastodonApplication
77

88

@@ -20,7 +20,15 @@ def add_arguments(self, parser):
2020
def handle(self, *args, **options):
2121
if options["refresh"]:
2222
for site in MastodonApplication.objects.exclude(disabled=True):
23+
try:
24+
_, _, server_version = detect_server_info(site.api_domain)
25+
except Exception:
26+
continue
2327
allow_multiple_redir = True
28+
if "; Pixelfed" in server_version or server_version.startswith("0."):
29+
allow_multiple_redir = False
30+
if allow_multiple_redir:
31+
continue
2432
try:
2533
response = create_app(site.api_domain, allow_multiple_redir)
2634
except Exception as e:

0 commit comments

Comments
 (0)