aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server/api/activity
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-04 22:48:13 +0300
committerGravatar Vitaly Takmazov2018-10-04 22:48:13 +0300
commit9f7150aa4419380bdc75d7c0edaa2c6ff7d86ba9 (patch)
tree9b6c30c4adfcc11ba101a6d866e22885297e5302 /juick-server/src/main/java/com/juick/server/api/activity
parent3a9dc0eb9d633c1ec068772ed1cd7e53b44c452a (diff)
ActivityPub: log unknown activities
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/api/activity')
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/Profile.java11
1 files changed, 9 insertions, 2 deletions
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 115ca89a..146e78f0 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,6 +1,7 @@
package com.juick.server.api.activity;
-import com.juick.Message;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.juick.User;
import com.juick.server.ActivityPubManager;
import com.juick.server.KeystoreManager;
@@ -17,6 +18,8 @@ import com.juick.service.UserService;
import com.juick.service.activities.DeleteUserEvent;
import com.juick.service.activities.FollowEvent;
import com.juick.service.activities.UndoFollowEvent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.http.HttpStatus;
@@ -36,6 +39,7 @@ import java.util.stream.Stream;
@RestController
public class Profile {
+ private static final Logger logger = LoggerFactory.getLogger(Profile.class);
@Inject
private UserService userService;
@Inject
@@ -54,6 +58,8 @@ public class Profile {
private String baseUri;
@Value("${img_url:http://localhost:8080/i/}")
private String baseImagesUri;
+ @Inject
+ private ObjectMapper jsonMapper;
@GetMapping(value = "/u/{userName}", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_JSON_MEDIA_TYPE})
public Person getUser(@PathVariable String userName) {
@@ -236,7 +242,7 @@ public class Profile {
@RequestHeader(name = "Content-Type") String contentType,
@RequestHeader(name = "User-Agent", required = false) String userAgent,
@RequestHeader(name = "Accept-Encoding", required = false) String acceptEncoding,
- @RequestHeader(name = "Signature", required = false) String signature) {
+ @RequestHeader(name = "Signature", required = false) String signature) throws JsonProcessingException {
UriComponents componentsBuilder = ServletUriComponentsBuilder.fromCurrentRequestUri().build();
Map<String, String> headers = new HashMap<>();
headers.put("host", host);
@@ -265,6 +271,7 @@ public class Profile {
applicationEventPublisher.publishEvent(new DeleteUserEvent(this, (String)activity.getObject()));
}
}
+ logger.warn("Unknown activity: {}", jsonMapper.writeValueAsString(activity));
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);