diff options
author | Vitaly Takmazov | 2022-04-14 17:12:51 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-04-14 17:12:51 +0300 |
commit | 055cda0267efd41678cf0dcdbefa7de821b3db23 (patch) | |
tree | dd44c151f7a1de7d231b99fdf0cff2efde1efa8c | |
parent | dae1b7cd38fbdae22cdcf79fb9ea09e2ab640255 (diff) |
ActivityPub: handle followers exceptions
-rw-r--r-- | src/main/java/com/juick/ActivityPubManager.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java index b0e77c63..a86fc301 100644 --- a/src/main/java/com/juick/ActivityPubManager.java +++ b/src/main/java/com/juick/ActivityPubManager.java @@ -416,11 +416,15 @@ public class ActivityPubManager implements ActivityListener, NotificationListene socialService.getFollowers(user).forEach(acct -> { var follower = signatureManager.getContext(URI.create(acct)); follower.ifPresentOrElse((person) -> { - try { - logger.info("{} announcing {} to {}", user.getName(), message.getMid(), acct); - signatureManager.post((Actor)ctx, (Actor) person, announce); - } catch (IOException | NoSuchAlgorithmException e) { - logger.warn("activitypub exception", e); + if (person instanceof Actor) { + try { + logger.info("{} announcing {} to {}", user.getName(), message.getMid(), acct); + signatureManager.post((Actor) ctx, (Actor) person, announce); + } catch (IOException | NoSuchAlgorithmException e) { + logger.warn("activitypub exception", e); + } + } else { + logger.warn("Unhandled context: {}", acct); } }, () -> logger.warn("Follower not found: {}", acct)); }); |