improve #239, read contact.email

This commit is contained in:
tateisu 2023-04-30 18:19:35 +09:00
parent 2b1c5878c0
commit 8494bcf0d9
1 changed files with 5 additions and 1 deletions

View File

@ -233,7 +233,11 @@ class TootInstance(parser: TootParser, src: JsonObject) {
this.apDomain = src.string("uri")?.let { Host.parse(it) } ?: parser.apDomain
this.title = src.string("title")
val sv = src.string("email")
val sv =
// mastodon /api/v2/instance
src.jsonObject("contact")?.string("email")
// mastodon /api/v1/instance
?: src.string("email")
this.email = when {
sv?.startsWith("mailto:") == true -> sv.substring(7)
else -> sv