fix: 軽微な修正、ロガーを追加

This commit is contained in:
usbharu 2023-04-29 13:02:38 +09:00
parent a31b1226e9
commit c61710f476
3 changed files with 4 additions and 3 deletions

View File

@ -31,10 +31,11 @@ fun Routing.usersAP(activityPubUserService: ActivityPubUserService, userService:
} }
class ContentTypeRouteSelector(private vararg val contentType: ContentType) : RouteSelector() { 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 = val requestContentType =
ContentType.parse(context.call.request.accept() ?: return RouteSelectorEvaluation.FailedParameter) 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) }) { return if (contentType.any { contentType -> contentType.match(requestContentType) }) {
RouteSelectorEvaluation.Constant RouteSelectorEvaluation.Constant
} else { } else {

View File

@ -45,7 +45,7 @@ class ActivityPubNoteServiceImpl(
attributedTo = actor, attributedTo = actor,
content = postEntity.text, content = postEntity.text,
published = Instant.ofEpochMilli(postEntity.createdAt).toString(), 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] val inbox = props[DeliverPostJob.inbox]
logger.debug("createNoteJob: actor={}, note={}, inbox={}", actor, postEntity, inbox) logger.debug("createNoteJob: actor={}, note={}, inbox={}", actor, postEntity, inbox)

View File

@ -89,7 +89,7 @@ class ActivityPubUserServiceImpl(
RemoteUserCreateDto( RemoteUserCreateDto(
name = person.preferredUsername name = person.preferredUsername
?: throw IllegalActivityPubObjectException("preferredUsername is null"), ?: throw IllegalActivityPubObjectException("preferredUsername is null"),
domain = url.substringAfter("://").substringBefore("/"), domain = url.substringAfter("://").substringBeforeLast("/"),
screenName = (person.name ?: person.preferredUsername) ?: throw IllegalActivityPubObjectException("preferredUsername is null"), screenName = (person.name ?: person.preferredUsername) ?: throw IllegalActivityPubObjectException("preferredUsername is null"),
description = person.summary ?: "", description = person.summary ?: "",
inbox = person.inbox ?: throw IllegalActivityPubObjectException("inbox is null"), inbox = person.inbox ?: throw IllegalActivityPubObjectException("inbox is null"),