mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2025-12-21 03:52:34 +01:00
Info Queries (#627)
This commit is contained in:
@@ -33,13 +33,13 @@ object AppUpdate {
|
|||||||
val stableJson = json.parseToJsonElement(
|
val stableJson = json.parseToJsonElement(
|
||||||
network.client.newCall(
|
network.client.newCall(
|
||||||
GET(LATEST_STABLE_CHANNEL_URL)
|
GET(LATEST_STABLE_CHANNEL_URL)
|
||||||
).await().body!!.string()
|
).await().body.string()
|
||||||
).jsonObject
|
).jsonObject
|
||||||
|
|
||||||
val previewJson = json.parseToJsonElement(
|
val previewJson = json.parseToJsonElement(
|
||||||
network.client.newCall(
|
network.client.newCall(
|
||||||
GET(LATEST_PREVIEW_CHANNEL_URL)
|
GET(LATEST_PREVIEW_CHANNEL_URL)
|
||||||
).await().body!!.string()
|
).await().body.string()
|
||||||
).jsonObject
|
).jsonObject
|
||||||
|
|
||||||
return listOf(
|
return listOf(
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package suwayomi.tachidesk.graphql.queries
|
||||||
|
|
||||||
|
import suwayomi.tachidesk.global.impl.AppUpdate
|
||||||
|
import suwayomi.tachidesk.server.BuildConfig
|
||||||
|
import suwayomi.tachidesk.server.JavalinSetup.future
|
||||||
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
|
class InfoQuery {
|
||||||
|
data class AboutPayload(
|
||||||
|
val name: String,
|
||||||
|
val version: String,
|
||||||
|
val revision: String,
|
||||||
|
val buildType: String,
|
||||||
|
val buildTime: Long,
|
||||||
|
val github: String,
|
||||||
|
val discord: String
|
||||||
|
)
|
||||||
|
|
||||||
|
fun about(): AboutPayload {
|
||||||
|
return AboutPayload(
|
||||||
|
BuildConfig.NAME,
|
||||||
|
BuildConfig.VERSION,
|
||||||
|
BuildConfig.REVISION,
|
||||||
|
BuildConfig.BUILD_TYPE,
|
||||||
|
BuildConfig.BUILD_TIME,
|
||||||
|
BuildConfig.GITHUB,
|
||||||
|
BuildConfig.DISCORD
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
data class CheckForUpdatesPayload(
|
||||||
|
/** [channel] mirrors [suwayomi.tachidesk.server.BuildConfig.BUILD_TYPE] */
|
||||||
|
val channel: String,
|
||||||
|
val tag: String,
|
||||||
|
val url: String
|
||||||
|
)
|
||||||
|
|
||||||
|
fun checkForUpdates(): CompletableFuture<List<CheckForUpdatesPayload>> {
|
||||||
|
return future {
|
||||||
|
AppUpdate.checkUpdate().map {
|
||||||
|
CheckForUpdatesPayload(
|
||||||
|
channel = it.channel,
|
||||||
|
tag = it.tag,
|
||||||
|
url = it.url
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,6 +27,7 @@ import suwayomi.tachidesk.graphql.queries.CategoryQuery
|
|||||||
import suwayomi.tachidesk.graphql.queries.ChapterQuery
|
import suwayomi.tachidesk.graphql.queries.ChapterQuery
|
||||||
import suwayomi.tachidesk.graphql.queries.DownloadQuery
|
import suwayomi.tachidesk.graphql.queries.DownloadQuery
|
||||||
import suwayomi.tachidesk.graphql.queries.ExtensionQuery
|
import suwayomi.tachidesk.graphql.queries.ExtensionQuery
|
||||||
|
import suwayomi.tachidesk.graphql.queries.InfoQuery
|
||||||
import suwayomi.tachidesk.graphql.queries.MangaQuery
|
import suwayomi.tachidesk.graphql.queries.MangaQuery
|
||||||
import suwayomi.tachidesk.graphql.queries.MetaQuery
|
import suwayomi.tachidesk.graphql.queries.MetaQuery
|
||||||
import suwayomi.tachidesk.graphql.queries.SourceQuery
|
import suwayomi.tachidesk.graphql.queries.SourceQuery
|
||||||
@@ -61,6 +62,7 @@ val schema = toSchema(
|
|||||||
TopLevelObject(ChapterQuery()),
|
TopLevelObject(ChapterQuery()),
|
||||||
TopLevelObject(DownloadQuery()),
|
TopLevelObject(DownloadQuery()),
|
||||||
TopLevelObject(ExtensionQuery()),
|
TopLevelObject(ExtensionQuery()),
|
||||||
|
TopLevelObject(InfoQuery()),
|
||||||
TopLevelObject(MangaQuery()),
|
TopLevelObject(MangaQuery()),
|
||||||
TopLevelObject(MetaQuery()),
|
TopLevelObject(MetaQuery()),
|
||||||
TopLevelObject(SourceQuery()),
|
TopLevelObject(SourceQuery()),
|
||||||
|
|||||||
Reference in New Issue
Block a user