From fc24ba0e59e213c3b29b964adb85182ae60e7e72 Mon Sep 17 00:00:00 2001 From: silverpill Date: Thu, 18 Nov 2021 15:57:44 +0000 Subject: [PATCH] Change default activity content type --- src/activitypub/constants.rs | 4 +++- src/activitypub/views.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/activitypub/constants.rs b/src/activitypub/constants.rs index d94d885..c7bf2f4 100644 --- a/src/activitypub/constants.rs +++ b/src/activitypub/constants.rs @@ -1,3 +1,5 @@ -pub const ACTIVITY_CONTENT_TYPE: &str = "application/activity+json"; +// https://www.w3.org/TR/activitypub/#server-to-server-interactions +pub const ACTIVITY_CONTENT_TYPE: &str = r#"application/ld+json; profile="https://www.w3.org/ns/activitystreams""#; + pub const AP_CONTEXT: &str = "https://www.w3.org/ns/activitystreams"; pub const AP_PUBLIC: &str = "https://www.w3.org/ns/activitystreams#Public"; diff --git a/src/activitypub/views.rs b/src/activitypub/views.rs index af43348..1739d59 100644 --- a/src/activitypub/views.rs +++ b/src/activitypub/views.rs @@ -46,8 +46,10 @@ pub fn get_object_url(instance_url: &str, object_uuid: &Uuid) -> String { } fn is_activitypub_request(request: &HttpRequest) -> bool { - const CONTENT_TYPES: [&str; 3] = [ + const CONTENT_TYPES: [&str; 5] = [ ACTIVITY_CONTENT_TYPE, + "application/activity+json, application/ld+json", // Mastodon + "application/activity+json", "application/ld+json", "application/json", ];