diff --git a/activitypub.py b/activitypub.py index 703da80..d6b35e3 100644 --- a/activitypub.py +++ b/activitypub.py @@ -803,6 +803,8 @@ def actor(handle_or_id): cls = Protocol.for_request(fed='web') if not cls: error(f"Couldn't determine protocol", status=404) + elif not common.is_enabled(cls, ActivityPub): + error(f'{cls.LABEL} <=> activitypub not enabled') elif cls.LABEL == 'web' and request.path.startswith('/ap/'): # we started out with web users' AP ids as fed.brid.gy/[domain], so we # need to preserve those for backward compatibility diff --git a/tests/test_activitypub.py b/tests/test_activitypub.py index a947a0b..828c214 100644 --- a/tests/test_activitypub.py +++ b/tests/test_activitypub.py @@ -437,7 +437,16 @@ class ActivityPubTest(TestCase): 'type': 'Application', }, got.json, ignore=['publicKeyPem']) - def test_actor_no_handle(self, *_): + def test_actor_atproto_not_enabled(self, *_): + # self.store_object(id='at://did:plc:user/app.bsky.actor.profile/self', + # our_as1={'foo': 'bar'}, source_protocol='atproto') + self.store_object(id='did:plc:user', raw={'foo': 'baz'}) + self.make_user('did:plc:user', cls=ATProto) + got = self.client.get('/ap/did:plc:user', base_url='https://atproto.brid.gy/') + self.assertEqual(400, got.status_code) + + @patch('common.ENABLED_BRIDGES', new=[('activitypub', 'atproto')]) + def test_actor_atproto_no_handle(self, *_): self.store_object(id='did:plc:user', raw={'foo': 'bar'}) self.make_user('did:plc:user', cls=ATProto) got = self.client.get('/ap/did:plc:user', base_url='https://atproto.brid.gy/')