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