From 71031e22225a3c145f5b9e5bf42892300441ee5d Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 31 Dec 2025 01:21:47 +0800 Subject: [PATCH] :bug: Adjusted delivery of actor update --- .../ActivityPub/ActivityPubDeliveryService.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/DysonNetwork.Sphere/ActivityPub/ActivityPubDeliveryService.cs b/DysonNetwork.Sphere/ActivityPub/ActivityPubDeliveryService.cs index a382e5d..5b87ad2 100644 --- a/DysonNetwork.Sphere/ActivityPub/ActivityPubDeliveryService.cs +++ b/DysonNetwork.Sphere/ActivityPub/ActivityPubDeliveryService.cs @@ -228,7 +228,7 @@ public class ActivityPubDeliveryService( ["id"] = postUrl, ["type"] = post.Type == PostType.Article ? "Article" : "Note", ["published"] = (post.PublishedAt ?? post.CreatedAt).ToDateTimeOffset(), - ["updated"] = post.EditedAt?.ToDateTimeOffset(), + ["updated"] = post.EditedAt?.ToDateTimeOffset() ?? new DateTimeOffset(), ["attributedTo"] = actorUrl, ["content"] = post.Content ?? "", ["to"] = new[] { "https://www.w3.org/ns/activitystreams#Public" }, @@ -312,7 +312,7 @@ public class ActivityPubDeliveryService( var actorUrl = actor.Uri; - var actorObject = new Dictionary + var actorObject = new Dictionary { ["id"] = actorUrl, ["type"] = actor.Type, @@ -325,7 +325,7 @@ public class ActivityPubDeliveryService( ["outbox"] = actor.OutboxUri, ["followers"] = actor.FollowersUri, ["following"] = actor.FollowingUri, - ["publicKey"] = new Dictionary + ["publicKey"] = new Dictionary { ["id"] = actor.PublicKeyId, ["owner"] = actorUrl, @@ -335,7 +335,7 @@ public class ActivityPubDeliveryService( if (publisher.Picture != null) { - actorObject["icon"] = new Dictionary + actorObject["icon"] = new Dictionary { ["type"] = "Image", ["mediaType"] = publisher.Picture.MimeType, @@ -345,7 +345,7 @@ public class ActivityPubDeliveryService( if (publisher.Background != null) { - actorObject["image"] = new Dictionary + actorObject["image"] = new Dictionary { ["type"] = "Image", ["mediaType"] = publisher.Background.MimeType, @@ -364,7 +364,7 @@ public class ActivityPubDeliveryService( ["type"] = "Update", ["actor"] = actorUrl, ["published"] = DateTimeOffset.UtcNow, - ["to"] = new[] { "https://www.w3.org/ns/activitystreams#Public" }, + ["to"] = Array.Empty(), ["cc"] = new[] { $"{actorUrl}/followers" }, ["object"] = actorObject };