mirror of
https://gitlab.com/brutaldon/brutaldon.git
synced 2024-11-02 16:37:19 -04:00
Merge pull request #74 from cyisfor/sophistifimacation
hiding, I mean, sophistimacatifying the instance url checking
This commit is contained in:
commit
a05d09289a
@ -200,8 +200,16 @@ SESSION_SERIALIZER = "django.contrib.sessions.serializers.PickleSerializer"
|
||||
# URL to redirect users to when not logged in
|
||||
ANONYMOUS_HOME_URL = "about"
|
||||
|
||||
# URL to redirect gab users to
|
||||
GAB_RICKROLL_URL = "https://invidio.us/watch?v=dQw4w9WgXcQ"
|
||||
# URL to redirect galaxy brain users to
|
||||
RICKROLL_URL = "https://invidio.us/watch?v=dQw4w9WgXcQ"
|
||||
|
||||
# Function to check if trying to add an account should trigger a special response
|
||||
def CHECK_INSTANCE_URL(url, redirect):
|
||||
if "gab.com" in url:
|
||||
return redirect(RICKROLL_URL)
|
||||
elif "shitposter.club" in url:
|
||||
return redirect(RICKROLL_URL)
|
||||
|
||||
|
||||
# Version number displayed on about page
|
||||
BRUTALDON_VERSION = "2.14.1"
|
||||
|
@ -392,8 +392,9 @@ def login(request):
|
||||
redirect_uris = request.build_absolute_uri(reverse("oauth_callback"))
|
||||
if form.is_valid():
|
||||
api_base_url = form.cleaned_data["instance"]
|
||||
if "gab.com" in api_base_url:
|
||||
return redirect(django_settings.GAB_RICKROLL_URL)
|
||||
resp = django_settings.CHECK_INSTANCE_URL(api_base_url, redirect)
|
||||
if resp is not None:
|
||||
return resp
|
||||
tmp_base = parse.urlparse(api_base_url.lower())
|
||||
if tmp_base.netloc == "":
|
||||
api_base_url = parse.urlunparse(
|
||||
|
Loading…
Reference in New Issue
Block a user