aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-04 17:58:11 +0300
committerGravatar Vitaly Takmazov2018-10-04 17:58:11 +0300
commitb67f2b80fad5413de4f7cd145942196cee861c63 (patch)
treedaf5c5121c8aa6c249ae0b9227b3fb8878e599f0 /juick-server/src/main/java/com/juick
parente2b09858835ca0a956b83a2eb78a621693640389 (diff)
add Note endpoint
Diffstat (limited to 'juick-server/src/main/java/com/juick')
-rw-r--r--juick-server/src/main/java/com/juick/server/ActivityPubManager.java5
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/Profile.java6
2 files changed, 7 insertions, 4 deletions
diff --git a/juick-server/src/main/java/com/juick/server/ActivityPubManager.java b/juick-server/src/main/java/com/juick/server/ActivityPubManager.java
index e590f4f9..2e511738 100644
--- a/juick-server/src/main/java/com/juick/server/ActivityPubManager.java
+++ b/juick-server/src/main/java/com/juick/server/ActivityPubManager.java
@@ -20,7 +20,6 @@ import org.springframework.stereotype.Component;
import org.springframework.web.util.UriComponentsBuilder;
import javax.annotation.Nonnull;
-import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.io.IOException;
import java.net.URI;
@@ -32,8 +31,6 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
@Inject
SignatureManager signatureManager;
@Inject
- ActivityPubManager activityPubManager;
- @Inject
SocialService socialService;
@Value("${ap_base_uri:http://localhost:8080/}")
private String baseUri;
@@ -173,7 +170,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
note.setInReplyTo(messageUri(msg.getMid(), msg.getReplyto()));
}
if (MessageUtils.isPM(msg)) {
- note.setTo(Collections.singletonList(activityPubManager.personUri(msg.getTo())));
+ note.setTo(Collections.singletonList(personUri(msg.getTo())));
} else {
note.setTo(Collections.singletonList("https://www.w3.org/ns/activitystreams#Public"));
note.setCc(Collections.singletonList(followersUri(msg.getUser())));
diff --git a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java
index bbb7761f..76b82d79 100644
--- a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java
+++ b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java
@@ -1,5 +1,6 @@
package com.juick.server.api.activity;
+import com.juick.Message;
import com.juick.User;
import com.juick.server.ActivityPubManager;
import com.juick.server.KeystoreManager;
@@ -220,6 +221,11 @@ public class Profile {
}
throw new HttpNotFoundException();
}
+ @GetMapping(value = "/m/{mid}", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_JSON_MEDIA_TYPE})
+ public Context showNote(@PathVariable int mid) {
+ Message message = messagesService.getMessage(mid);
+ return Context.build(activityPubManager.makeNote(message));
+ }
@PostMapping(value = "/api/inbox", consumes = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_JSON_MEDIA_TYPE})
public ResponseEntity<Void> processInbox(@RequestBody Activity activity,