diff --git a/bp/actors/routes.py b/bp/actors/routes.py index 060f867..bcb8979 100644 --- a/bp/actors/routes.py +++ b/bp/actors/routes.py @@ -353,13 +353,28 @@ def register(url_prefix="/users"): abort(404) domain = _domain() + collection_id = f"https://{domain}/users/{username}/followers" follower_list = await services.federation.get_followers(g.s, username) + page_param = request.args.get("page") + + if not page_param: + return Response( + response=json.dumps({ + "@context": "https://www.w3.org/ns/activitystreams", + "type": "OrderedCollection", + "id": collection_id, + "totalItems": len(follower_list), + "first": f"{collection_id}?page=1", + }), + content_type=AP_CONTENT_TYPE, + ) return Response( response=json.dumps({ "@context": "https://www.w3.org/ns/activitystreams", - "type": "OrderedCollection", - "id": f"https://{domain}/users/{username}/followers", + "type": "OrderedCollectionPage", + "id": f"{collection_id}?page=1", + "partOf": collection_id, "totalItems": len(follower_list), "orderedItems": [f.follower_actor_url for f in follower_list], }), @@ -373,11 +388,27 @@ def register(url_prefix="/users"): abort(404) domain = _domain() + collection_id = f"https://{domain}/users/{username}/following" + page_param = request.args.get("page") + + if not page_param: + return Response( + response=json.dumps({ + "@context": "https://www.w3.org/ns/activitystreams", + "type": "OrderedCollection", + "id": collection_id, + "totalItems": 0, + "first": f"{collection_id}?page=1", + }), + content_type=AP_CONTENT_TYPE, + ) + return Response( response=json.dumps({ "@context": "https://www.w3.org/ns/activitystreams", - "type": "OrderedCollection", - "id": f"https://{domain}/users/{username}/following", + "type": "OrderedCollectionPage", + "id": f"{collection_id}?page=1", + "partOf": collection_id, "totalItems": 0, "orderedItems": [], }),