mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-22 14:38: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',
|
'followers': f'https://{host}/followers',
|
||||||
'following': f'https://{host}/following',
|
'following': f'https://{host}/following',
|
||||||
'inbox': f'https://{host}/inbox',
|
'inbox': f'https://{host}/inbox',
|
||||||
|
'outbox': f'https://{host}/outbox',
|
||||||
'url': f'https://{host}/',
|
'url': f'https://{host}/',
|
||||||
'endpoints': {
|
'endpoints': {
|
||||||
'sharedInbox': f'https://{host}/inbox'
|
'sharedInbox': f'https://{host}/inbox'
|
||||||
|
|
|
@ -125,6 +125,39 @@ class ActorView(View):
|
||||||
return None
|
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')
|
@register_route('/.well-known/webfinger')
|
||||||
class WebfingerView(View):
|
class WebfingerView(View):
|
||||||
async def get(self, request: Request) -> Response:
|
async def get(self, request: Request) -> Response:
|
||||||
|
|
Loading…
Reference in a new issue