From ea8d7674e7ed751cc8cd3abffc37ba2b96a4c569 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 18 Jun 2019 14:37:03 +0300 Subject: ActivityPub: top Announces should be public --- src/main/java/com/juick/server/ActivityPubManager.java | 3 ++- src/main/java/com/juick/server/api/activity/model/Context.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/juick/server/ActivityPubManager.java b/src/main/java/com/juick/server/ActivityPubManager.java index a5398325..94a8434e 100644 --- a/src/main/java/com/juick/server/ActivityPubManager.java +++ b/src/main/java/com/juick/server/ActivityPubManager.java @@ -266,7 +266,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene if (MessageUtils.isPM(msg)) { note.setTo(Collections.singletonList(personUri(msg.getTo()))); } else { - note.setTo(Collections.singletonList("https://www.w3.org/ns/activitystreams#Public")); + note.setTo(Collections.singletonList(Context.ACTIVITYSTREAMS_PUBLIC)); note.setCc(Collections.singletonList(followersUri(msg.getUser()))); } note.setPublished(msg.getCreated()); @@ -355,6 +355,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene Announce announce = new Announce(); announce.setId(note.getId() + "#top"); announce.setActor(personUri(serviceUser)); + announce.setTo(Collections.singletonList(Context.ACTIVITYSTREAMS_PUBLIC)); announce.setObject(note); Person me = (Person) signatureManager.getContext(URI.create(announce.getActor())).get(); socialService.getFollowers(serviceUser).forEach(acct -> { diff --git a/src/main/java/com/juick/server/api/activity/model/Context.java b/src/main/java/com/juick/server/api/activity/model/Context.java index 1d3f238c..87e04a89 100644 --- a/src/main/java/com/juick/server/api/activity/model/Context.java +++ b/src/main/java/com/juick/server/api/activity/model/Context.java @@ -75,6 +75,7 @@ public abstract class Context { public final static String LD_JSON_MEDIA_TYPE = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""; public final static String ACTIVITY_MEDIA_TYPE = "application/activity+json"; public final static String ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE = ACTIVITY_MEDIA_TYPE + "; profile=\"https://www.w3.org/ns/activitystreams\""; + public final static String ACTIVITYSTREAMS_PUBLIC = "https://www.w3.org/ns/activitystreams#Public"; public Instant getPublished() { return published; -- cgit v1.2.3