diff --git a/relay/actor.py b/relay/actor.py index 578f041..f4555a0 100644 --- a/relay/actor.py +++ b/relay/actor.py @@ -334,13 +334,13 @@ async def inbox(request): if 'actor' not in data or not request['validated']: logging.info('Actor not in data or request not validated') raise aiohttp.web.HTTPUnauthorized(body='access denied', content_type='text/plain') - - if instance in AP_CONFIG['blocked_instances'] or instance in DATABASE.get('FAILED_CHECKS',{}): + + elif instance in AP_CONFIG['blocked_instances']: INBOUND_STATS['rejected']+=1 logging.info('Blocked instance') raise aiohttp.web.HTTPUnauthorized(body='access denied', content_type='text/plain') - if data['type'] != 'Follow' and 'https://{}/inbox'.format(instance) not in DATABASE['relay-list']: + elif data['type'] != 'Follow' and 'https://{}/inbox'.format(instance) not in DATABASE['relay-list']: logging.info('Datatype not follow or instance not in relay-list: %r',instance) if data['type'] not in ['Announce','Delete']: logging.info('data: %r',data) @@ -352,6 +352,10 @@ async def inbox(request): DATABASE['not-subscribed'] = not_subd return aiohttp.web.Response(body=b'{}', content_type='application/activity+json') + elif AP_CONFIG['whitelist_enabled'] is True and instance not in AP_CONFIG['whitelist']: + raise aiohttp.web.HTTPUnauthorized(body='access denied', content_type='text/plain') + + # let's give a try and remove the instance from backoff if it sends us a message bi = DATABASE.get('backoff-instances',{}) if instance in bi: