From 4ac23c225a492dd078455fceed6faf948099153b Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Sat, 29 Apr 2023 13:02:38 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BB=BD=E5=BE=AE=E3=81=AA=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E3=80=81=E3=83=AD=E3=82=AC=E3=83=BC=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dev/usbharu/hideout/routing/activitypub/UserRouting.kt | 3 ++- .../hideout/service/activitypub/ActivityPubNoteServiceImpl.kt | 2 +- .../hideout/service/activitypub/ActivityPubUserServiceImpl.kt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/routing/activitypub/UserRouting.kt b/src/main/kotlin/dev/usbharu/hideout/routing/activitypub/UserRouting.kt index 95b22635..6f5e8f2b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/routing/activitypub/UserRouting.kt +++ b/src/main/kotlin/dev/usbharu/hideout/routing/activitypub/UserRouting.kt @@ -31,10 +31,11 @@ fun Routing.usersAP(activityPubUserService: ActivityPubUserService, userService: } class ContentTypeRouteSelector(private vararg val contentType: ContentType) : RouteSelector() { - override fun evaluate(context: RoutingResolveContext, segmentIndex: Int): RouteSelectorEvaluation { + override fun evaluate(context: RoutingResolveContext, segmentIndex: Int): RouteSelectorEvaluation { val requestContentType = ContentType.parse(context.call.request.accept() ?: return RouteSelectorEvaluation.FailedParameter) + context.call.application.log.debug("Content-Type: {}", contentType) return if (contentType.any { contentType -> contentType.match(requestContentType) }) { RouteSelectorEvaluation.Constant } else { 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 f9b4702c..bca90430 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt @@ -45,7 +45,7 @@ class ActivityPubNoteServiceImpl( attributedTo = actor, content = postEntity.text, published = Instant.ofEpochMilli(postEntity.createdAt).toString(), - to = listOf("https://www.w3.org/ns/activitystreams#Public", actor + "/followers") + to = listOf("https://www.w3.org/ns/activitystreams#Public", actor + "/follower") ) val inbox = props[DeliverPostJob.inbox] logger.debug("createNoteJob: actor={}, note={}, inbox={}", actor, postEntity, inbox) diff --git a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUserServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUserServiceImpl.kt index d63c048f..e8444ba0 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUserServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUserServiceImpl.kt @@ -89,7 +89,7 @@ class ActivityPubUserServiceImpl( RemoteUserCreateDto( name = person.preferredUsername ?: throw IllegalActivityPubObjectException("preferredUsername is null"), - domain = url.substringAfter("://").substringBefore("/"), + domain = url.substringAfter("://").substringBeforeLast("/"), screenName = (person.name ?: person.preferredUsername) ?: throw IllegalActivityPubObjectException("preferredUsername is null"), description = person.summary ?: "", inbox = person.inbox ?: throw IllegalActivityPubObjectException("inbox is null"),