mirror of https://github.com/usbharu/Hideout.git
feat: activityの判定をゆるく
This commit is contained in:
parent
de0516d710
commit
f119493b19
|
@ -16,10 +16,10 @@ import io.ktor.server.routing.*
|
||||||
import io.ktor.server.sessions.*
|
import io.ktor.server.sessions.*
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
fun Application.user(userService: UserService,activityPubUserService: ActivityPubUserService) {
|
fun Application.user(userService: UserService, activityPubUserService: ActivityPubUserService) {
|
||||||
routing {
|
routing {
|
||||||
route("/users") {
|
route("/users") {
|
||||||
authenticate( tokenAuth,optional = true) {
|
authenticate(tokenAuth, optional = true) {
|
||||||
|
|
||||||
get {
|
get {
|
||||||
val limit = call.request.queryParameters["limit"]?.toInt()
|
val limit = call.request.queryParameters["limit"]?.toInt()
|
||||||
|
@ -37,7 +37,8 @@ fun Application.user(userService: UserService,activityPubUserService: ActivityPu
|
||||||
call.respond(HttpStatusCode.Created)
|
call.respond(HttpStatusCode.Created)
|
||||||
}
|
}
|
||||||
get("/{name}") {
|
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(
|
val typeOfActivityPub = HttpUtil.isContentTypeOfActivityPub(
|
||||||
contentType.contentType,
|
contentType.contentType,
|
||||||
contentType.contentSubtype,
|
contentType.contentSubtype,
|
||||||
|
@ -67,9 +68,9 @@ fun Application.user(userService: UserService,activityPubUserService: ActivityPu
|
||||||
}
|
}
|
||||||
|
|
||||||
authenticate(tokenAuth) {
|
authenticate(tokenAuth) {
|
||||||
get("/admin"){
|
get("/admin") {
|
||||||
println("cccccccccccc "+call.principal<UserIdPrincipal>())
|
println("cccccccccccc " + call.principal<UserIdPrincipal>())
|
||||||
println("cccccccccccc "+call.principal<UserSession>())
|
println("cccccccccccc " + call.principal<UserSession>())
|
||||||
|
|
||||||
return@get call.respondText {
|
return@get call.respondText {
|
||||||
"you alredy in admin !! hello " +
|
"you alredy in admin !! hello " +
|
||||||
|
|
|
@ -15,7 +15,7 @@ object HttpUtil {
|
||||||
if (subType == "activity+json") {
|
if (subType == "activity+json") {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (subType == "ld+json" && parameter == "https://www.w3.org/ns/activitystreams") {
|
if (subType == "ld+json") {
|
||||||
return true
|
return true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue