use urllib.parse.urlsplit instead of regex
This commit is contained in:
parent
fb669f124f
commit
39a255375e
|
@ -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:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue