fix: show only trusted

This commit is contained in:
rebelonion 2024-05-20 07:28:35 -05:00
parent 91f728150c
commit 1dd3bddeb9

View file

@ -1,26 +1,27 @@
package ani.dantotsu.connections.github
import ani.dantotsu.Mapper
import ani.dantotsu.client
import ani.dantotsu.settings.Developer
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.decodeFromJsonElement
class Forks {
fun getForks(): Array<Developer> {
var forks = arrayOf<Developer>()
runBlocking(Dispatchers.IO) {
val res =
client.get("https://api.github.com/repos/rebelonion/Dantotsu/forks?sort=stargazers")
.parsed<JsonArray>().map {
Mapper.json.decodeFromJsonElement<GithubResponse>(it)
}
res.forEach {
val trustedForks = arrayOf(
GithubResponse(
"Awery",
GithubResponse.Owner(
"MrBoomDeveloper",
"https://avatars.githubusercontent.com/u/92123190?v=4"
),
"https://github.com/MrBoomDeveloper/Awery"
),
)
trustedForks.forEach {
forks = forks.plus(
Developer(
it.name,