GTS does not support multiple redirect_uris
This commit is contained in:
parent
db8f42aae7
commit
1c4e703f6f
2 changed files with 13 additions and 2 deletions
|
@ -376,7 +376,10 @@ def get_or_create_fediverse_application(login_domain):
|
||||||
app = MastodonApplication.objects.filter(domain_name__iexact=domain).first()
|
app = MastodonApplication.objects.filter(domain_name__iexact=domain).first()
|
||||||
if app:
|
if app:
|
||||||
return app
|
return app
|
||||||
allow_multiple_redir = True # TODO detect site supports multiple redirect uris
|
allow_multiple_redir = True
|
||||||
|
if "; Pixelfed" in server_version or server_version.startswith("0."):
|
||||||
|
# Pixelfed and GoToSocial don't support multiple redirect uris
|
||||||
|
allow_multiple_redir = False
|
||||||
response = create_app(api_domain, allow_multiple_redir)
|
response = create_app(api_domain, allow_multiple_redir)
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
logger.error(
|
logger.error(
|
||||||
|
|
|
@ -2,7 +2,7 @@ import pprint
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
from mastodon.api import create_app
|
from mastodon.api import create_app, detect_server_info
|
||||||
from mastodon.models import MastodonApplication
|
from mastodon.models import MastodonApplication
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,15 @@ class Command(BaseCommand):
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
if options["refresh"]:
|
if options["refresh"]:
|
||||||
for site in MastodonApplication.objects.exclude(disabled=True):
|
for site in MastodonApplication.objects.exclude(disabled=True):
|
||||||
|
try:
|
||||||
|
_, _, server_version = detect_server_info(site.api_domain)
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
allow_multiple_redir = True
|
allow_multiple_redir = True
|
||||||
|
if "; Pixelfed" in server_version or server_version.startswith("0."):
|
||||||
|
allow_multiple_redir = False
|
||||||
|
if allow_multiple_redir:
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
response = create_app(site.api_domain, allow_multiple_redir)
|
response = create_app(site.api_domain, allow_multiple_redir)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Add table
Reference in a new issue