From ed066d94af73192c8fb17d837cd1429a8775cd5e Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Tue, 13 Dec 2022 10:09:12 -0500 Subject: [PATCH] add more info to actor endpoint --- relay/misc.py | 5 +++-- relay/views.py | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/relay/misc.py b/relay/misc.py index 9f5a96b..9eec324 100644 --- a/relay/misc.py +++ b/relay/misc.py @@ -192,14 +192,15 @@ class DotDict(dict): class Message(DotDict): @classmethod - def new_actor(cls, host, pubkey, description=None): + def new_actor(cls, host, pubkey, name=None, description=None, locked=False): return cls({ '@context': 'https://www.w3.org/ns/activitystreams', 'id': f'https://{host}/actor', 'type': 'Application', 'preferredUsername': 'relay', - 'name': 'ActivityRelay', + 'name': name or 'ActivityRelay', 'summary': description or 'ActivityRelay bot', + 'manuallyApprovesFollowers': locked, 'followers': f'https://{host}/followers', 'following': f'https://{host}/following', 'inbox': f'https://{host}/inbox', diff --git a/relay/views.py b/relay/views.py index 15c4317..90dfda8 100644 --- a/relay/views.py +++ b/relay/views.py @@ -68,10 +68,13 @@ a:hover {{ color: #8AF; }} @register_route('GET', '/actor', '/inbox') -async def actor(request): +async def actor(request, s): data = Message.new_actor( host = request.config.host, - pubkey = request.app.signer.pubkey + pubkey = request.app.signer.pubkey, + name = s.get_config('name'), + description = s.get_config('description'), + locked = s.get_config('require_approval') ) return Response.new(data, ctype='activity')