diff options
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/api')
3 files changed, 14 insertions, 11 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 ce09436d..10390ea1 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 @@ -82,7 +82,7 @@ public class Profile { @Inject private ObjectMapper jsonMapper; - @GetMapping(value = "/u/{userName}", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_JSON_MEDIA_TYPE}) + @GetMapping(value = "/u/{userName}", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE}) public Person getUser(@PathVariable String userName) { User user = userService.getUserByName(userName); if (!user.isAnonymous()) { @@ -111,7 +111,7 @@ public class Profile { throw new HttpNotFoundException(); } - @GetMapping(value = "/u/{userName}/blog/toc", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_JSON_MEDIA_TYPE}) + @GetMapping(value = "/u/{userName}/blog/toc", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE}) public OrderedCollection getOutbox(@PathVariable String userName) { User user = userService.getUserByName(userName); if (!user.isAnonymous()) { @@ -125,7 +125,7 @@ public class Profile { throw new HttpNotFoundException(); } - @GetMapping(value = "/u/{userName}/blog", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_JSON_MEDIA_TYPE}) + @GetMapping(value = "/u/{userName}/blog", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE}) public OrderedCollectionPage getOutboxPage(@PathVariable String userName, @RequestParam(required = false, defaultValue = "0") int before) { User visitor = UserUtils.getCurrentUser(); @@ -158,7 +158,7 @@ public class Profile { throw new HttpNotFoundException(); } - @GetMapping(value = "/u/{userName}/followers/toc", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_JSON_MEDIA_TYPE}) + @GetMapping(value = "/u/{userName}/followers/toc", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE}) public OrderedCollection getFollowers(@PathVariable String userName) { User user = userService.getUserByName(userName); if (!user.isAnonymous()) { @@ -172,7 +172,7 @@ public class Profile { throw new HttpNotFoundException(); } - @GetMapping(value = "/u/{userName}/followers", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_JSON_MEDIA_TYPE}) + @GetMapping(value = "/u/{userName}/followers", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE}) public OrderedCollectionPage getFollowersPage(@PathVariable String userName, @RequestParam(required = false, defaultValue = "0") int page) { User user = userService.getUserByName(userName); @@ -200,7 +200,7 @@ public class Profile { throw new HttpNotFoundException(); } - @GetMapping(value = "/u/{userName}/following/toc", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_JSON_MEDIA_TYPE}) + @GetMapping(value = "/u/{userName}/following/toc", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE}) public OrderedCollection getFollowing(@PathVariable String userName) { User user = userService.getUserByName(userName); if (!user.isAnonymous()) { @@ -214,7 +214,7 @@ public class Profile { throw new HttpNotFoundException(); } - @GetMapping(value = "/u/{userName}/following", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_JSON_MEDIA_TYPE}) + @GetMapping(value = "/u/{userName}/following", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE}) public OrderedCollectionPage getFollowingPage(@PathVariable String userName, @RequestParam(required = false, defaultValue = "0") int page) { User user = userService.getUserByName(userName); @@ -242,7 +242,7 @@ public class Profile { throw new HttpNotFoundException(); } - @GetMapping(value = "/n/{mid}-{rid}", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_JSON_MEDIA_TYPE}) + @GetMapping(value = "/n/{mid}-{rid}", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE}) public Context showNote(@PathVariable int mid, @PathVariable int rid) { if (rid > 0) { // reply @@ -253,7 +253,7 @@ public class Profile { messagesService.getMessage(mid))); } - @PostMapping(value = "/api/inbox", consumes = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_JSON_MEDIA_TYPE}) + @PostMapping(value = "/api/inbox", consumes = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE}) public ResponseEntity<Void> processInbox(@RequestBody Activity activity, @RequestHeader(name = "Host") String host, @RequestHeader(name = "Date") String date, diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/Context.java b/juick-server/src/main/java/com/juick/server/api/activity/model/Context.java index 544f1aa2..0df8f8c7 100644 --- a/juick-server/src/main/java/com/juick/server/api/activity/model/Context.java +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/Context.java @@ -71,7 +71,8 @@ public abstract class Context { public final static String ACTIVITY_STREAMS_URI = "https://www.w3.org/ns/activitystreams"; public final static String SECURITY_URI = "https://w3id.org/security/v1"; public final static String LD_JSON_MEDIA_TYPE = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""; - public final static String ACTIVITY_JSON_MEDIA_TYPE = "application/activity+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 Instant getPublished() { return published; diff --git a/juick-server/src/main/java/com/juick/server/api/webfinger/Resource.java b/juick-server/src/main/java/com/juick/server/api/webfinger/Resource.java index 2df895fd..71a0ca31 100644 --- a/juick-server/src/main/java/com/juick/server/api/webfinger/Resource.java +++ b/juick-server/src/main/java/com/juick/server/api/webfinger/Resource.java @@ -15,6 +15,8 @@ import rocks.xmpp.addr.Jid; import javax.inject.Inject; import java.util.Collections; +import static com.juick.server.api.activity.model.Context.ACTIVITY_MEDIA_TYPE; + @RestController public class Resource { @Inject @@ -35,7 +37,7 @@ public class Resource { builder.path(String.format("/u/%s", user.getName())); Link blog = new Link(); blog.setRel("self"); - blog.setType("application/activity+json"); + blog.setType(ACTIVITY_MEDIA_TYPE); blog.setHref(builder.toUriString()); Account result = new Account(); result.setSubject(resource); |