AS2: change Application actor types to Person for users, Service for bots

for #1482
pull/1599/head
Ryan Barrett 2024-12-03 21:16:11 -08:00
rodzic c069d18bbb
commit fbb82d2e26
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
11 zmienionych plików z 20 dodań i 20 usunięć

Wyświetl plik

@ -4,7 +4,7 @@
"https://w3id.org/security/v1",
{"alsoKnownAs": {"@id": "as:alsoKnownAs", "@type": "@id"}}
],
"type": "Application",
"type": "Service",
"id": "https://ap.brid.gy/ap.brid.gy",
"url": [
"https://fed.brid.gy/",

Wyświetl plik

@ -4,7 +4,7 @@
"https://w3id.org/security/v1",
{"alsoKnownAs": {"@id": "as:alsoKnownAs", "@type": "@id"}}
],
"type": "Application",
"type": "Service",
"id": "https://bsky.brid.gy/bsky.brid.gy",
"url": [
"https://bsky.brid.gy/",

Wyświetl plik

@ -1,5 +1,5 @@
{
"type": "Application",
"type": "Service",
"id": "https://eefake.brid.gy/eefake.brid.gy",
"url": "https://eefake.brid.gy/",
"preferredUsername": "eefake.brid.gy",

Wyświetl plik

@ -1,5 +1,5 @@
{
"type": "Application",
"type": "Service",
"id": "https://fake.brid.gy/fake.brid.gy",
"url": "https://fake.brid.gy/",
"preferredUsername": "fake.brid.gy",

Wyświetl plik

@ -4,7 +4,7 @@
"https://w3id.org/security/v1",
{"alsoKnownAs": {"@id": "as:alsoKnownAs", "@type": "@id"}}
],
"type": "Application",
"type": "Service",
"id": "https://fed.brid.gy/fed.brid.gy",
"url": "https://fed.brid.gy/",
"preferredUsername": "fed.brid.gy",

Wyświetl plik

@ -1,5 +1,5 @@
{
"type": "Application",
"type": "Service",
"id": "https://other.brid.gy/other.brid.gy",
"url": "https://other.brid.gy/",
"preferredUsername": "other.brid.gy",

Wyświetl plik

@ -565,7 +565,7 @@ class Protocol:
obj.our_as1 = copy.deepcopy(obj.as1)
actor = as1.get_object(obj.as1) if is_activity else obj.as1
actor['objectType'] = 'application'
actor['objectType'] = 'person'
cls.add_source_links(actor=actor, obj=obj, from_user=from_user)
converted = cls._convert(obj, from_user=from_user, **kwargs)

Wyświetl plik

@ -61,7 +61,7 @@ ACTOR_BASE = {
activitypub.SECURITY_CONTEXT,
activitypub.AKA_CONTEXT,
],
'type': 'Application',
'type': 'Person',
'id': 'http://localhost/user.com',
'url': 'http://localhost/r/https://user.com/',
'preferredUsername': 'user.com',
@ -112,7 +112,7 @@ ACTOR_FAKE_USER = {
activitypub.AKA_CONTEXT,
],
'name': 'fake:handle:user',
'type': 'Application',
'type': 'Person',
'summary': '[<a href="https://fed.brid.gy/fa/fake:handle:user">bridged</a> from <a href="web:fake:user">fake:handle:user</a> on fake-phrase by <a href="https://fed.brid.gy/">Bridgy Fed</a>]',
'discoverable': True,
'indexable': True,

Wyświetl plik

@ -820,7 +820,7 @@ class IntegrationTests(TestCase):
"""
self.make_user(id='https://inst/actor', cls=ActivityPub,
obj_as2=add_key({
'type': 'Application',
'type': 'Person',
'id': 'https://inst/actor',
'preferredUsername': 'inst',
}))

Wyświetl plik

@ -802,7 +802,7 @@ class ObjectTest(TestCase):
def test_as1_from_as2_protocol_bot_user(self):
self.assert_equals({
'objectType': 'application',
'objectType': 'service',
'id': 'fed.brid.gy',
'url': 'https://fed.brid.gy/',
'displayName': 'Bridgy Fed',

Wyświetl plik

@ -771,13 +771,13 @@ class ProtocolTest(TestCase):
def test_convert_object_is_from_user_adds_source_links(self):
alice = Fake(id='fake:alice')
self.assertEqual({
'objectType': 'application',
'objectType': 'person',
'id': 'other:u:fake:alice',
'url': 'http://unused',
'summary': 'something about me<br><br>[<a href="https://fed.brid.gy/fa/fake:handle:alice">bridged</a> from <a href="web:fake:alice">fake:handle:alice</a> on fake-phrase by <a href="https://fed.brid.gy/">Bridgy Fed</a>]',
}, OtherFake.convert(Object(
id='fake:profile:alice', source_protocol='fake', our_as1={
'objectType': 'application',
'objectType': 'person',
'id': 'fake:alice',
'url': 'http://unused',
'summary': 'something about me',
@ -786,23 +786,23 @@ class ProtocolTest(TestCase):
def test_convert_object_isnt_from_user_adds_source_links(self):
bob = Fake(id='fake:bob')
self.assertEqual({
'objectType': 'application',
'objectType': 'person',
'id': 'other:u:fake:alice',
'url': 'http://al/ice',
'summary': '[bridged from <a href="http://al/ice">al/ice</a> on fake-phrase by <a href="https://fed.brid.gy/">Bridgy Fed</a>]',
}, OtherFake.convert(Object(id='fake:alice', source_protocol='fake', our_as1={
'objectType': 'application',
'objectType': 'person',
'id': 'fake:alice',
'url': 'http://al/ice',
}), from_user=bob))
def test_convert_actor_without_from_user_doesnt_add_source_links(self):
self.assertEqual({
'objectType': 'application',
'objectType': 'person',
'id': 'other:u:fake:alice',
'url': 'http://al/ice',
}, OtherFake.convert(Object(id='fake:alice', source_protocol='fake', our_as1={
'objectType': 'application',
'objectType': 'person',
'id': 'fake:alice',
'url': 'http://al/ice',
})))
@ -811,7 +811,7 @@ class ProtocolTest(TestCase):
alice = Fake(id='fake:alice')
summary = 'something about me<br><br>[bridged from <a href="http://al/ice">someone else</a> by <a href="https://fed.brid.gy/">Bridgy Fed</a>]'
self.assertEqual({
'objectType': 'application',
'objectType': 'person',
'id': 'other:u:fake:alice',
'summary': summary,
}, OtherFake.convert(Object(id='fake:alice', source_protocol='fake', our_as1={
@ -828,7 +828,7 @@ class ProtocolTest(TestCase):
'verb': verb,
'id': 'other:o:fa:fake:profile:update',
'object': {
'objectType': 'application',
'objectType': 'person',
'id': 'other:u:fake:profile:alice',
'summary': 'something about me<br><br>[<a href="https://fed.brid.gy/fa/fake:handle:alice">bridged</a> from <a href="web:fake:alice">fake:handle:alice</a> on fake-phrase by <a href="https://fed.brid.gy/">Bridgy Fed</a>]',
},
@ -838,7 +838,7 @@ class ProtocolTest(TestCase):
'verb': verb,
'object': {
'id': 'fake:profile:alice',
'objectType': 'application',
'objectType': 'person',
'summary': 'something about me',
},
}), from_user=alice))