mirror of https://github.com/usbharu/Hideout.git
fix: 軽微な修正、ロガーを追加
This commit is contained in:
parent
e4046b5c77
commit
4ac23c225a
|
@ -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 {
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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"),
|
||||||
|
|
Loading…
Reference in New Issue