mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-22 22:48:00 +00:00
add missing AP routes
Adds routes for "/outbox", "/following", and "/followers"
This commit is contained in:
parent
62555b3591
commit
0d50215fc1
|
@ -148,6 +148,7 @@ class Message(aputils.Message):
|
|||
'followers': f'https://{host}/followers',
|
||||
'following': f'https://{host}/following',
|
||||
'inbox': f'https://{host}/inbox',
|
||||
'outbox': f'https://{host}/outbox',
|
||||
'url': f'https://{host}/',
|
||||
'endpoints': {
|
||||
'sharedInbox': f'https://{host}/inbox'
|
||||
|
|
|
@ -125,6 +125,39 @@ class ActorView(View):
|
|||
return None
|
||||
|
||||
|
||||
@register_route('/outbox')
|
||||
class OutboxView(View):
|
||||
async def get(self, request: Request) -> Response:
|
||||
msg = aputils.Message.new(
|
||||
aputils.ObjectType.ORDERED_COLLECTION,
|
||||
{
|
||||
"id": f'https://{self.config.domain}/outbox',
|
||||
"totalItems": 0,
|
||||
"orderedItems": []
|
||||
}
|
||||
)
|
||||
|
||||
return Response.new(msg, ctype = 'activity')
|
||||
|
||||
|
||||
@register_route('/following', '/followers')
|
||||
class RelationshipView(View):
|
||||
async def get(self, request: Request) -> Response:
|
||||
with self.database.session(False) as s:
|
||||
inboxes = [row['actor'] for row in s.get_inboxes()]
|
||||
|
||||
msg = aputils.Message.new(
|
||||
aputils.ObjectType.COLLECTION,
|
||||
{
|
||||
"id": f'https://{self.config.domain}{request.path}',
|
||||
"totalItems": len(inboxes),
|
||||
"items": inboxes
|
||||
}
|
||||
)
|
||||
|
||||
return Response.new(msg, ctype = 'activity')
|
||||
|
||||
|
||||
@register_route('/.well-known/webfinger')
|
||||
class WebfingerView(View):
|
||||
async def get(self, request: Request) -> Response:
|
||||
|
|
Loading…
Reference in a new issue