From e50ca63d32f765a75a9248caf92cf98233ce097c Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 24 Dec 2022 09:35:50 +0300 Subject: ActivityPub Update compatibility improvements --- src/main/java/com/juick/ActivityPubManager.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java index 1fff41fc..63417626 100644 --- a/src/main/java/com/juick/ActivityPubManager.java +++ b/src/main/java/com/juick/ActivityPubManager.java @@ -51,6 +51,7 @@ import java.io.StringWriter; import java.io.Writer; import java.net.URI; import java.security.NoSuchAlgorithmException; +import java.time.Instant; import java.util.*; import java.util.stream.Collectors; @@ -127,6 +128,8 @@ public class ActivityPubManager implements ActivityListener, NotificationListene signatureManager.post(me, follower, delete); } catch (IOException | NoSuchAlgorithmException e) { logger.warn("activitypub exception", e); + } catch (NoSuchElementException ex) { + logger.warn("Can not find {}", acct); } }); } @@ -172,9 +175,10 @@ public class ActivityPubManager implements ActivityListener, NotificationListene update.setId(note.getId() + "#update"); update.setActor(me.getId()); update.setObject(note); + update.setPublished(Instant.now()); logger.info("Update to follower {}", follower.getId()); signatureManager.post(me, follower, update); - } catch (IOException | NoSuchAlgorithmException e) { + } catch (Exception e) { logger.warn("{} exception", acct, e); } }); @@ -201,10 +205,11 @@ public class ActivityPubManager implements ActivityListener, NotificationListene Update update = new Update(); update.setId(userUri + "#update"); update.setActor(me.getId()); - update.setObject(new Context(userUri)); + update.setObject(me); + update.setPublished(Instant.now()); logger.info("Update to follower {}", follower.getId()); signatureManager.post(me, follower, update); - } catch (IOException | NoSuchAlgorithmException e) { + } catch (Exception e) { logger.warn("activitypub exception", e); } }); -- cgit v1.2.3