lemmy compatibility

This commit is contained in:
rimu 2023-11-22 22:12:58 +13:00
parent 53a1531820
commit 1d013693fa

View file

@ -157,7 +157,7 @@ def community_profile(actor):
else: else:
community: Community = Community.query.filter_by(name=actor, banned=False, ap_id=None).first() community: Community = Community.query.filter_by(name=actor, banned=False, ap_id=None).first()
if community is not None: if community is not None:
if 'application/ld+json' in request.headers.get('Accept', ''): if 'application/ld+json' in request.headers.get('Accept', '') or 'application/activity+json' in request.headers.get('Accept', ''):
server = current_app.config['SERVER_NAME'] server = current_app.config['SERVER_NAME']
actor_data = {"@context": default_context(), actor_data = {"@context": default_context(),
"type": "Group", "type": "Group",
@ -177,13 +177,13 @@ def community_profile(actor):
"publicKey": { "publicKey": {
"id": f"https://{server}/c/{actor}#main-key", "id": f"https://{server}/c/{actor}#main-key",
"owner": f"https://{server}/c/{actor}", "owner": f"https://{server}/c/{actor}",
"publicKeyPem": community.public_key.replace("\n", "\\n") "publicKeyPem": community.public_key
}, },
"endpoints": { "endpoints": {
"sharedInbox": f"https://{server}/inbox" "sharedInbox": f"https://{server}/inbox"
}, },
"published": community.created_at.isoformat(), "published": community.created_at.isoformat() + '+00:00',
"updated": community.last_active.isoformat(), "updated": community.last_active.isoformat() + '+00:00',
} }
if community.icon_id is not None: if community.icon_id is not None:
actor_data["icon"] = { actor_data["icon"] = {