add more info to actor endpoint

This commit is contained in:
Izalia Mae 2022-12-13 10:09:12 -05:00
parent c41cd6e015
commit ed066d94af
2 changed files with 8 additions and 4 deletions

View file

@ -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',

View file

@ -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')