fix: Serialize response correctly

This commit is contained in:
oSumAtrIX 2024-02-01 03:52:44 +01:00
parent e373d26998
commit 1dccfd2def
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
3 changed files with 6 additions and 9 deletions

View File

@ -23,6 +23,8 @@ import app.revanced.api.backend.github.api.Response.GitHubOrganization.GitHubMem
import io.ktor.client.plugins.resources.Resources
import io.ktor.serialization.kotlinx.json.*
import kotlinx.coroutines.*
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonNamingStrategy
@ -71,11 +73,9 @@ class GitHubBackend(token: String? = null) : Backend({
return BackendRelease(
tag = release.tagName,
releaseNote = release.body,
createdAt = release.createdAt,
createdAt = release.createdAt.toLocalDateTime(TimeZone.UTC),
assets = release.assets.map {
BackendAsset(
downloadUrl = it.browserDownloadUrl
)
BackendAsset(downloadUrl = it.browserDownloadUrl)
}.toSet()
)
}

View File

@ -1,7 +1,6 @@
package app.revanced.api.backend.github.api
import kotlinx.datetime.LocalDateTime
import kotlinx.serialization.SerialName
import kotlinx.datetime.Instant
import kotlinx.serialization.Serializable
@ -41,7 +40,7 @@ class Response {
class GitHubRelease(
val tagName: String,
val assets: Set<GitHubAsset>,
val createdAt: LocalDateTime,
val createdAt: Instant,
val body: String
) {
@Serializable

View File

@ -12,8 +12,6 @@ import io.ktor.server.routing.*
import io.ktor.util.pipeline.*
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.datetime.toKotlinLocalDateTime
import java.time.LocalDateTime
import org.koin.ktor.ext.get as koinGet
fun Application.configureRouting() {