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 97280087..36b4d80d 100644 --- a/src/main/kotlin/dev/usbharu/hideout/routing/activitypub/UserRouting.kt +++ b/src/main/kotlin/dev/usbharu/hideout/routing/activitypub/UserRouting.kt @@ -1,6 +1,5 @@ package dev.usbharu.hideout.routing.activitypub -import dev.usbharu.hideout.config.Config import dev.usbharu.hideout.exception.ParameterNotExistException import dev.usbharu.hideout.plugins.respondAp import dev.usbharu.hideout.service.activitypub.ActivityPubUserService @@ -9,7 +8,6 @@ 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) { diff --git a/src/main/kotlin/dev/usbharu/hideout/routing/userActivityPubRouting.kt b/src/main/kotlin/dev/usbharu/hideout/routing/userActivityPubRouting.kt deleted file mode 100644 index 73d54fa8..00000000 --- a/src/main/kotlin/dev/usbharu/hideout/routing/userActivityPubRouting.kt +++ /dev/null @@ -1,54 +0,0 @@ -package dev.usbharu.hideout.routing - -import com.fasterxml.jackson.module.kotlin.readValue -import dev.usbharu.hideout.ap.Follow -import dev.usbharu.hideout.config.Config -import dev.usbharu.hideout.service.impl.ActivityPubService -import dev.usbharu.hideout.service.impl.ActivityPubUserService -import dev.usbharu.hideout.util.HttpUtil -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 Application.userActivityPubRouting(activityPubService: ActivityPubService, activityPubUserService: ActivityPubUserService) { - routing { - route("/users/{name}") { - route("/inbox") { - get { - call.respond(HttpStatusCode.MethodNotAllowed) - } - post { - if (!HttpUtil.isContentTypeOfActivityPub(call.request.contentType())) { - return@post call.respond(HttpStatusCode.BadRequest) - } - val bodyText = call.receiveText() - println(bodyText) - when (activityPubService.switchApType(bodyText)) { - ActivityPubService.ActivityType.Follow -> { - val readValue = Config.configData.objectMapper.readValue(bodyText) - activityPubUserService.receiveFollow(readValue) - return@post call.respond(HttpStatusCode.Accepted) - } - - ActivityPubService.ActivityType.Undo -> { - return@post call.respond(HttpStatusCode.Accepted) - } - } - - } - } - route("/outbox") { - get { - call.respond(HttpStatusCode.MethodNotAllowed) - - } - post { - - call.respond(HttpStatusCode.MethodNotAllowed) - } - } - } - } -} diff --git a/src/test/kotlin/dev/usbharu/hideout/routing/UserRoutingKtTest.kt b/src/test/kotlin/dev/usbharu/hideout/routing/UserRoutingKtTest.kt deleted file mode 100644 index 6027b7e2..00000000 --- a/src/test/kotlin/dev/usbharu/hideout/routing/UserRoutingKtTest.kt +++ /dev/null @@ -1,12 +0,0 @@ -package dev.usbharu.hideout.routing - -import org.junit.jupiter.api.Test - -class UserRoutingKtTest { - @Test - fun userIconTest() { - println(String.Companion::class.java.classLoader) - println(String::class.java.classLoader) - println(String.javaClass.classLoader.getResourceAsStream("icon.png")?.readAllBytes()) - } -} diff --git a/src/test/kotlin/dev/usbharu/hideout/routing/activitypub/InboxRoutingKtTest.kt b/src/test/kotlin/dev/usbharu/hideout/routing/activitypub/InboxRoutingKtTest.kt new file mode 100644 index 00000000..3ad053bf --- /dev/null +++ b/src/test/kotlin/dev/usbharu/hideout/routing/activitypub/InboxRoutingKtTest.kt @@ -0,0 +1,4 @@ +package dev.usbharu.hideout.routing.activitypub +class InboxRoutingKtTest { + +}