Commit 39a25537 authored by gled's avatar gled

use urllib.parse.urlsplit instead of regex

parent fb669f12
......@@ -3,9 +3,9 @@ import aiohttp.web
import asyncio
import logging
import uuid
import re
import urllib.parse
import simplejson as json
import re
import cgi
from Crypto.PublicKey import RSA
from .database import DATABASE
......@@ -186,7 +186,7 @@ async def handle_follow(actor, data, request):
following = DATABASE.get('relay-list', [])
inbox = get_actor_inbox(actor)
if re.search('https://(.*)/inbox',inbox).group(1) in AP_CONFIG['blocked_instances']:
if urllib.parse.urlsplit(inbox).hostname in AP_CONFIG['blocked_instances']:
return
if inbox not in following:
......
import asyncio
import logging
import re
import urllib.parse
import simplejson as json
......@@ -16,7 +16,7 @@ except:
following = DATABASE.get('relay-list', [])
for inbox in following:
if re.search('https://(.*)/inbox',inbox).group(1) in CONFIG['ap']['blocked_instances']:
if urllib.parse.urlsplit(inbox).hostname in CONFIG['ap']['blocked_instances']:
following.remove(inbox)
DATABASE['relay-list'] = following
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment