NodeInfo: implement nodeinfo fetching

main
Alibek Omarov 5 years ago
parent 2e7913df23
commit b4dbee0acd
  1. 63
      app/src/main/java/com/keylesspalace/tusky/entity/NodeInfo.kt
  2. 7
      app/src/main/java/com/keylesspalace/tusky/network/MastodonApi.kt

@ -0,0 +1,63 @@
/* Copyright 2020 Alibek Omarov
*
* This file is a part of Husky.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tusky; if not,
* see <http://www.gnu.org/licenses>. */
package com.keylesspalace.tusky.entity
import com.google.gson.annotations.SerializedName
import java.util.*
// .well-known/nodeinfo
data class NodeInfoLink(
val href: String,
val rel: String
)
data class NodeInfoLinks(
val links: ArrayList<NodeInfoLink>
)
// we care only about supported postFormats
// so implement only metadata fetching
data class NodeInfo(
val metadata: NodeInfoMetadata? = null,
val software: NodeInfoSoftware
)
data class NodeInfoSoftware(
val name: String,
val version: String
)
data class NodeInfoPleromaUploadLimits(
val avatar: Int?,
val background: Int?,
val banner: Int?,
val general: Int?
)
data class NodeInfoPixelfedUploadLimits(
@SerializedName("max_photo_size") val maxPhotoSize: Int?
)
data class NodeInfoPixelfedConfig(
val uploader: NodeInfoPixelfedUploadLimits?
)
data class NodeInfoMetadata(
val postFormats: ArrayList<String>?,
val uploadLimits: NodeInfoPleromaUploadLimits?,
val config: NodeInfoPixelfedConfig?
)

@ -556,5 +556,10 @@ interface MastodonApi {
@Query("offset") offset: Int? = null,
@Query("following") following: Boolean? = null
): Single<SearchResult>
@GET(".well-known/nodeinfo")
fun getNodeinfoLinks() : Single<NodeInfoLinks>
@GET
fun getNodeinfo(@Url url: String) : Single<NodeInfo>
}

Loading…
Cancel
Save