aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/api/activity/Profile.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/www/api/activity/Profile.java')
-rw-r--r--src/main/java/com/juick/www/api/activity/Profile.java32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/main/java/com/juick/www/api/activity/Profile.java b/src/main/java/com/juick/www/api/activity/Profile.java
index 751d0cff..724e0747 100644
--- a/src/main/java/com/juick/www/api/activity/Profile.java
+++ b/src/main/java/com/juick/www/api/activity/Profile.java
@@ -34,6 +34,8 @@ import com.juick.www.api.activity.model.activities.Flag;
import com.juick.www.api.activity.model.activities.Follow;
import com.juick.www.api.activity.model.activities.Like;
import com.juick.www.api.activity.model.activities.Undo;
+import com.juick.www.api.activity.model.objects.Actor;
+import com.juick.www.api.activity.model.objects.Application;
import com.juick.www.api.activity.model.objects.Image;
import com.juick.www.api.activity.model.objects.Key;
import com.juick.www.api.activity.model.objects.Note;
@@ -106,28 +108,28 @@ public class Profile {
@GetMapping(value = "/u/{userName}", produces = { Context.LD_JSON_MEDIA_TYPE,
Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE, Context.FALLBACK_JSON_MEDIA_TYPE })
- public Person getUser(@PathVariable String userName) {
+ public Actor getUser(@PathVariable String userName) {
User user = userService.getUserByName(userName);
if (!user.isAnonymous()) {
- Person person = new Person();
- person.setId(activityPubManager.personUri(user));
- person.setUrl(activityPubManager.personWebUri(user));
- person.setName(userName);
- person.setPreferredUsername(userName);
+ Actor profile = userService.isServiceUser(user) ? new Application() : new Person();
+ profile.setId(activityPubManager.personUri(user));
+ profile.setUrl(activityPubManager.personWebUri(user));
+ profile.setName(userName);
+ profile.setPreferredUsername(userName);
Key publicKey = new Key();
- publicKey.setId(person.getId() + "#main-key");
- publicKey.setOwner(person.getId());
+ publicKey.setId(profile.getId() + "#main-key");
+ publicKey.setOwner(profile.getId());
publicKey.setPublicKeyPem(keystoreManager.getPublicKeyPem());
- person.setPublicKey(publicKey);
- person.setInbox(activityPubManager.inboxUri());
- person.setOutbox(activityPubManager.outboxUri(user));
- person.setFollowers(activityPubManager.followersUri(user));
- person.setFollowing(activityPubManager.followingUri(user));
+ profile.setPublicKey(publicKey);
+ profile.setInbox(activityPubManager.inboxUri());
+ profile.setOutbox(activityPubManager.outboxUri(user));
+ profile.setFollowers(activityPubManager.followersUri(user));
+ profile.setFollowing(activityPubManager.followingUri(user));
Image avatar = new Image();
avatar.setUrl(webApp.getAvatarUrl(user));
avatar.setMediaType("image/png");
- person.setIcon(avatar);
- return (Person) Context.build(person);
+ profile.setIcon(avatar);
+ return (Actor) Context.build(profile);
}
throw new HttpNotFoundException();
}