Compare commits
1 Commits
856ba94f3b
...
14fbd59e7b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14fbd59e7b |
@@ -44,9 +44,15 @@ def _build_activity_json(activity: APActivity, actor: ActorProfile, domain: str)
|
||||
|
||||
obj = dict(activity.object_data or {})
|
||||
|
||||
# Object id MUST be on the actor's domain (Mastodon origin check).
|
||||
# The post URL (e.g. blog.rose-ash.com/slug/) goes in "url" only.
|
||||
object_id = activity.activity_id + "/object"
|
||||
# Rewrite activity ID to match the delivery domain so Mastodon's
|
||||
# origin check passes (activity ID host must equal actor host).
|
||||
# The stored activity_id uses the federation domain; we replace
|
||||
# just the host portion for per-app delivery.
|
||||
import re
|
||||
activity_id = re.sub(
|
||||
r"^https://[^/]+/", f"https://{domain}/", activity.activity_id,
|
||||
)
|
||||
object_id = activity_id + "/object"
|
||||
|
||||
if activity.activity_type == "Delete":
|
||||
obj.setdefault("id", object_id)
|
||||
@@ -67,7 +73,7 @@ def _build_activity_json(activity: APActivity, actor: ActorProfile, domain: str)
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
],
|
||||
"id": activity.activity_id,
|
||||
"id": activity_id,
|
||||
"type": activity.activity_type,
|
||||
"actor": actor_url,
|
||||
"published": activity.published.isoformat() if activity.published else None,
|
||||
|
||||
Reference in New Issue
Block a user