kopia lustrzana https://github.com/snarfed/bridgy-fed
Protocol.check_supported: block DMs (for now)
rodzic
22570881b7
commit
d769d03a4f
11
protocol.py
11
protocol.py
|
@ -1576,12 +1576,15 @@ class Protocol:
|
||||||
return
|
return
|
||||||
|
|
||||||
inner_type = as1.object_type(as1.get_object(obj.as1)) or ''
|
inner_type = as1.object_type(as1.get_object(obj.as1)) or ''
|
||||||
if (obj.type not in cls.SUPPORTED_AS1_TYPES or
|
if (obj.type not in cls.SUPPORTED_AS1_TYPES
|
||||||
(obj.type in as1.CRUD_VERBS
|
or (obj.type in as1.CRUD_VERBS
|
||||||
and inner_type
|
and inner_type
|
||||||
and inner_type not in cls.SUPPORTED_AS1_TYPES)):
|
and inner_type not in cls.SUPPORTED_AS1_TYPES)):
|
||||||
error(f"Bridgy Fed for {cls.LABEL} doesn't support {obj.type} {inner_type} yet", status=204)
|
error(f"Bridgy Fed for {cls.LABEL} doesn't support {obj.type} {inner_type} yet", status=204)
|
||||||
|
|
||||||
|
if as1.is_dm(obj.as1):
|
||||||
|
error(f"Bridgy Fed doesn't support DMs", status=204)
|
||||||
|
|
||||||
|
|
||||||
@cloud_tasks_only
|
@cloud_tasks_only
|
||||||
def receive_task():
|
def receive_task():
|
||||||
|
|
|
@ -720,6 +720,14 @@ class ProtocolTest(TestCase):
|
||||||
with self.assertRaises(NoContent):
|
with self.assertRaises(NoContent):
|
||||||
Fake.check_supported(Object(our_as1=obj))
|
Fake.check_supported(Object(our_as1=obj))
|
||||||
|
|
||||||
|
# DM
|
||||||
|
with self.assertRaises(NoContent):
|
||||||
|
Fake.check_supported(Object(our_as1={
|
||||||
|
'objectType': 'note',
|
||||||
|
'actor': 'did:alice',
|
||||||
|
'to': ['did:bob'],
|
||||||
|
'content': 'hello world',
|
||||||
|
}))
|
||||||
|
|
||||||
class ProtocolReceiveTest(TestCase):
|
class ProtocolReceiveTest(TestCase):
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue