mirror of https://github.com/usbharu/Hideout.git
refactor: ActivityPubのルーティング定義を移動
This commit is contained in:
parent
0062829ffe
commit
db362fb48b
|
@ -0,0 +1,25 @@
|
|||
package dev.usbharu.hideout.routing.activitypub
|
||||
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.routing.*
|
||||
|
||||
fun Routing.inbox(){
|
||||
|
||||
route("/inbox") {
|
||||
get {
|
||||
|
||||
}
|
||||
post {
|
||||
|
||||
}
|
||||
}
|
||||
route("/users/{name}/inbox"){
|
||||
get {
|
||||
|
||||
}
|
||||
post {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package dev.usbharu.hideout.routing.activitypub
|
||||
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.routing.*
|
||||
|
||||
fun Routing.outbox() {
|
||||
|
||||
route("/outbox") {
|
||||
get {
|
||||
|
||||
}
|
||||
post {
|
||||
|
||||
}
|
||||
}
|
||||
route("/users/{name}/outbox"){
|
||||
get {
|
||||
|
||||
}
|
||||
post {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package dev.usbharu.hideout.routing.activitypub
|
||||
|
||||
import dev.usbharu.hideout.util.HttpUtil.Activity
|
||||
import io.ktor.http.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.request.*
|
||||
import io.ktor.server.routing.*
|
||||
|
||||
fun Routing.users(){
|
||||
route("/users/{name}"){
|
||||
createChild(ContentTypeRouteSelector(ContentType.Application.Activity)).handle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ContentTypeRouteSelector(private val contentType: ContentType) : RouteSelector() {
|
||||
override fun evaluate(context: RoutingResolveContext, segmentIndex: Int): RouteSelectorEvaluation {
|
||||
return if (context.call.request.contentType() == contentType) {
|
||||
RouteSelectorEvaluation.Constant
|
||||
} else {
|
||||
RouteSelectorEvaluation.Failed
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue