feat: ユーザーページに仮の情報を表示するように

This commit is contained in:
usbharu 2023-04-21 19:47:15 +09:00
parent 7a11f3cd46
commit 48d49fe18d
3 changed files with 9 additions and 4 deletions

View File

@ -25,10 +25,10 @@ fun Application.configureRouting(
routing { routing {
inbox(httpSignatureVerifyService, activityPubService) inbox(httpSignatureVerifyService, activityPubService)
outbox() outbox()
usersAP(activityPubUserService) usersAP(activityPubUserService,userService)
webfinger(userService) webfinger(userService)
route("api/v1") { route("/api/v1") {
statuses(postService) statuses(postService)
} }

View File

@ -3,14 +3,16 @@ package dev.usbharu.hideout.routing.activitypub
import dev.usbharu.hideout.exception.ParameterNotExistException import dev.usbharu.hideout.exception.ParameterNotExistException
import dev.usbharu.hideout.plugins.respondAp import dev.usbharu.hideout.plugins.respondAp
import dev.usbharu.hideout.service.activitypub.ActivityPubUserService 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.Activity
import dev.usbharu.hideout.util.HttpUtil.JsonLd import dev.usbharu.hideout.util.HttpUtil.JsonLd
import io.ktor.http.* import io.ktor.http.*
import io.ktor.server.application.* import io.ktor.server.application.*
import io.ktor.server.request.* import io.ktor.server.request.*
import io.ktor.server.response.*
import io.ktor.server.routing.* import io.ktor.server.routing.*
fun Routing.usersAP(activityPubUserService: ActivityPubUserService) { fun Routing.usersAP(activityPubUserService: ActivityPubUserService,userService:UserService) {
route("/users/{name}") { route("/users/{name}") {
createChild(ContentTypeRouteSelector(ContentType.Application.Activity, ContentType.Application.JsonLd)).handle { createChild(ContentTypeRouteSelector(ContentType.Application.Activity, ContentType.Application.JsonLd)).handle {
val name = val name =
@ -21,6 +23,9 @@ fun Routing.usersAP(activityPubUserService: ActivityPubUserService) {
HttpStatusCode.OK HttpStatusCode.OK
) )
} }
get {
call.respondText(userService.findByName(call.parameters["name"]!!).toString())
}
} }
} }

View File

@ -10,7 +10,7 @@ import io.ktor.server.response.*
import io.ktor.server.routing.* import io.ktor.server.routing.*
fun Route.statuses(postService: IPostService) { fun Route.statuses(postService: IPostService) {
route("statuses") { route("/statuses") {
post { post {
val status: StatusForPost = call.receive() val status: StatusForPost = call.receive()
val post = Post( val post = Post(