From 98c2c88fa44d2b37c60639245b9dfd559568ed39 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Fri, 21 Apr 2023 21:35:16 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=96=93=E9=81=95=E3=81=88=E3=81=A6post?= =?UTF-8?q?Entity=E3=82=92=E3=83=87=E3=82=B7=E3=83=AA=E3=82=A2=E3=83=A9?= =?UTF-8?q?=E3=82=A4=E3=82=BA=E3=81=97=E3=81=A6=E3=81=84=E3=81=9F=E3=81=AE?= =?UTF-8?q?=E3=81=A7=E5=A4=89=E6=8F=9B=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activitypub/ActivityPubNoteServiceImpl.kt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt index f5a76bb3..6d38a7d3 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt @@ -11,6 +11,7 @@ import dev.usbharu.hideout.service.job.JobQueueParentService import io.ktor.client.* import kjob.core.job.JobProps import org.slf4j.LoggerFactory +import java.time.Instant class ActivityPubNoteServiceImpl( private val httpClient: HttpClient, @@ -36,9 +37,17 @@ class ActivityPubNoteServiceImpl( override suspend fun createNoteJob(props: JobProps) { val actor = props[DeliverPostJob.actor] - val note = Config.configData.objectMapper.readValue(props[DeliverPostJob.post]) + val postEntity = Config.configData.objectMapper.readValue(props[DeliverPostJob.post]) + val note = Note( + name = "Note", + id = postEntity.url, + attributedTo = actor, + content = postEntity.text, + published = Instant.ofEpochMilli(postEntity.createdAt).toString(), + to = listOf("https://www.w3.org/ns/activitystreams#Public", actor + "/followers") + ) val inbox = props[DeliverPostJob.inbox] - logger.debug("createNoteJob: actor={}, note={}, inbox={}", actor, note, inbox) + logger.debug("createNoteJob: actor={}, note={}, inbox={}", actor, postEntity, inbox) httpClient.postAp( urlString = inbox, username = "$actor#pubkey",