mirror of https://github.com/usbharu/Hideout.git
fix: webfingerのif式を修正
This commit is contained in:
parent
1ff8d48cb5
commit
819ec3ba52
|
@ -49,15 +49,15 @@ fun Application.wellKnown(userService: UserService) {
|
||||||
val uri = call.request.queryParameters["resource"] ?: return@get call.respondText("resource was not found",
|
val uri = call.request.queryParameters["resource"] ?: return@get call.respondText("resource was not found",
|
||||||
status = HttpStatusCode.BadRequest
|
status = HttpStatusCode.BadRequest
|
||||||
)
|
)
|
||||||
|
val decodeURLPart = uri.decodeURLPart()
|
||||||
if (uri.decodeURLPart().startsWith("acct:")) {
|
if (!decodeURLPart.startsWith("acct:")) {
|
||||||
return@get call.respondText("$uri was not found.",status =HttpStatusCode.BadRequest)
|
return@get call.respondText("$uri was not found.",status =HttpStatusCode.BadRequest)
|
||||||
}
|
}
|
||||||
val accountName = uri.substringBeforeLast("@")
|
val accountName = uri.substringBeforeLast("@").substringAfter("@")
|
||||||
val userEntity = userService.findByName(accountName)
|
val userEntity = userService.findByName(accountName)
|
||||||
|
|
||||||
return@get call.respond(WebFingerResource(
|
return@get call.respond(WebFingerResource(
|
||||||
subject = userEntity.name,
|
subject = decodeURLPart,
|
||||||
listOf(
|
listOf(
|
||||||
WebFingerResource.Link(
|
WebFingerResource.Link(
|
||||||
rel ="self",
|
rel ="self",
|
||||||
|
|
Loading…
Reference in New Issue