From f119493b1975506bae8f60ad7703743903dd1384 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Fri, 24 Mar 2023 18:17:46 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20activity=E3=81=AE=E5=88=A4=E5=AE=9A?= =?UTF-8?q?=E3=82=92=E3=82=86=E3=82=8B=E3=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dev/usbharu/hideout/routing/UserRouting.kt | 13 +++++++------ .../kotlin/dev/usbharu/hideout/util/HttpUtil.kt | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/routing/UserRouting.kt b/src/main/kotlin/dev/usbharu/hideout/routing/UserRouting.kt index 781bc07e..28bc70bd 100644 --- a/src/main/kotlin/dev/usbharu/hideout/routing/UserRouting.kt +++ b/src/main/kotlin/dev/usbharu/hideout/routing/UserRouting.kt @@ -16,10 +16,10 @@ import io.ktor.server.routing.* import io.ktor.server.sessions.* @Suppress("unused") -fun Application.user(userService: UserService,activityPubUserService: ActivityPubUserService) { +fun Application.user(userService: UserService, activityPubUserService: ActivityPubUserService) { routing { route("/users") { - authenticate( tokenAuth,optional = true) { + authenticate(tokenAuth, optional = true) { get { val limit = call.request.queryParameters["limit"]?.toInt() @@ -37,7 +37,8 @@ fun Application.user(userService: UserService,activityPubUserService: ActivityPu call.respond(HttpStatusCode.Created) } get("/{name}") { - val contentType = ContentType.parse(call.request.accept()?:"*/*") + val contentType = ContentType.parse(call.request.accept() ?: "*/*") + call.application.environment.log.debug("Accept Content-Type : ${contentType.contentType}/${contentType.contentSubtype} ${contentType.parameters}") val typeOfActivityPub = HttpUtil.isContentTypeOfActivityPub( contentType.contentType, contentType.contentSubtype, @@ -67,9 +68,9 @@ fun Application.user(userService: UserService,activityPubUserService: ActivityPu } authenticate(tokenAuth) { - get("/admin"){ - println("cccccccccccc "+call.principal()) - println("cccccccccccc "+call.principal()) + get("/admin") { + println("cccccccccccc " + call.principal()) + println("cccccccccccc " + call.principal()) return@get call.respondText { "you alredy in admin !! hello " + diff --git a/src/main/kotlin/dev/usbharu/hideout/util/HttpUtil.kt b/src/main/kotlin/dev/usbharu/hideout/util/HttpUtil.kt index 98fa8eaa..a014b824 100644 --- a/src/main/kotlin/dev/usbharu/hideout/util/HttpUtil.kt +++ b/src/main/kotlin/dev/usbharu/hideout/util/HttpUtil.kt @@ -15,7 +15,7 @@ object HttpUtil { if (subType == "activity+json") { return true } - if (subType == "ld+json" && parameter == "https://www.w3.org/ns/activitystreams") { + if (subType == "ld+json") { return true }