We now have a library browsable via activitypub

This commit is contained in:
Eliot Berriot 2018-04-06 17:59:06 +02:00
parent 393110a7f0
commit a03f0ffea5
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
4 changed files with 169 additions and 5 deletions

View file

@ -50,6 +50,11 @@ class SystemActor(object):
additional_attributes = {}
manually_approves_followers = False
def serialize(self):
actor = self.get_actor_instance()
serializer = serializers.ActorSerializer()
return serializer.data
def get_actor_instance(self):
args = self.get_instance_argument(
self.id,
@ -172,6 +177,17 @@ class LibraryActor(SystemActor):
'manually_approves_followers': True
}
def serialize(self):
data = super().serialize()
urls = data.setdefault('url', [])
urls.append({
'type': 'Link',
'mediaType': 'application/activity+json',
'name': 'library',
'href': utils.full_url(reverse('federation:music:files-list'))
})
return data
@property
def manually_approves_followers(self):
return settings.FEDERATION_MUSIC_NEEDS_APPROVAL