diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/juick/server/api/activity/Profile.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/com/juick/server/api/activity/Profile.java b/src/main/java/com/juick/server/api/activity/Profile.java index 3e0179c8..84a3de33 100644 --- a/src/main/java/com/juick/server/api/activity/Profile.java +++ b/src/main/java/com/juick/server/api/activity/Profile.java @@ -30,6 +30,7 @@ import com.juick.service.MessagesService; import com.juick.service.UserService; import com.juick.service.activities.*; import com.overzealous.remark.Remark; +import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,7 +52,9 @@ import org.springframework.web.util.UriComponents; import org.springframework.web.util.UriComponentsBuilder; import javax.inject.Inject; +import java.io.InputStream; import java.net.URI; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -256,7 +259,10 @@ public class Profile { } @PostMapping(value = "/api/inbox", consumes = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE}) - public ResponseEntity<Void> processInbox(@RequestBody Activity activity) throws Exception { + public ResponseEntity<Void> processInbox(InputStream inboxData) throws Exception { + String inbox = IOUtils.toString(inboxData, StandardCharsets.UTF_8); + logger.debug("Inbox: {}", inbox); + Activity activity = jsonMapper.readValue(inbox, Activity.class); User visitor = UserUtils.getCurrentUser(); if ((StringUtils.isNotEmpty(visitor.getUri().toString()) && visitor.getUri().equals(URI.create(activity.getActor()))) || !visitor.isAnonymous()) { if (activity instanceof Follow) { |