diff --git a/src/main/kotlin/dev/usbharu/hideout/plugins/Routing.kt b/src/main/kotlin/dev/usbharu/hideout/plugins/Routing.kt index 474cff2a..fc4f0742 100644 --- a/src/main/kotlin/dev/usbharu/hideout/plugins/Routing.kt +++ b/src/main/kotlin/dev/usbharu/hideout/plugins/Routing.kt @@ -25,10 +25,10 @@ fun Application.configureRouting( routing { inbox(httpSignatureVerifyService, activityPubService) outbox() - usersAP(activityPubUserService) + usersAP(activityPubUserService,userService) webfinger(userService) - route("api/v1") { + route("/api/v1") { statuses(postService) } 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 36b4d80d..9d4a99e1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/routing/activitypub/UserRouting.kt +++ b/src/main/kotlin/dev/usbharu/hideout/routing/activitypub/UserRouting.kt @@ -3,14 +3,16 @@ package dev.usbharu.hideout.routing.activitypub import dev.usbharu.hideout.exception.ParameterNotExistException import dev.usbharu.hideout.plugins.respondAp import dev.usbharu.hideout.service.activitypub.ActivityPubUserService +import dev.usbharu.hideout.service.impl.UserService import dev.usbharu.hideout.util.HttpUtil.Activity import dev.usbharu.hideout.util.HttpUtil.JsonLd import io.ktor.http.* import io.ktor.server.application.* import io.ktor.server.request.* +import io.ktor.server.response.* import io.ktor.server.routing.* -fun Routing.usersAP(activityPubUserService: ActivityPubUserService) { +fun Routing.usersAP(activityPubUserService: ActivityPubUserService,userService:UserService) { route("/users/{name}") { createChild(ContentTypeRouteSelector(ContentType.Application.Activity, ContentType.Application.JsonLd)).handle { val name = @@ -21,6 +23,9 @@ fun Routing.usersAP(activityPubUserService: ActivityPubUserService) { HttpStatusCode.OK ) } + get { + call.respondText(userService.findByName(call.parameters["name"]!!).toString()) + } } } diff --git a/src/main/kotlin/dev/usbharu/hideout/routing/api/v1/Statuses.kt b/src/main/kotlin/dev/usbharu/hideout/routing/api/v1/Statuses.kt index e5194667..710354a0 100644 --- a/src/main/kotlin/dev/usbharu/hideout/routing/api/v1/Statuses.kt +++ b/src/main/kotlin/dev/usbharu/hideout/routing/api/v1/Statuses.kt @@ -10,7 +10,7 @@ import io.ktor.server.response.* import io.ktor.server.routing.* fun Route.statuses(postService: IPostService) { - route("statuses") { + route("/statuses") { post { val status: StatusForPost = call.receive() val post = Post(