diff --git a/server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/InfoQuery.kt b/server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/InfoQuery.kt index c2b7dfca..bf3e8c0e 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/InfoQuery.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/InfoQuery.kt @@ -10,7 +10,7 @@ import suwayomi.tachidesk.server.util.WebInterfaceManager import java.util.concurrent.CompletableFuture class InfoQuery { - data class AboutPayload( + data class AboutServerPayload( val name: String, val version: String, val revision: String, @@ -20,8 +20,8 @@ class InfoQuery { val discord: String, ) - fun about(): AboutPayload { - return AboutPayload( + fun aboutServer(): AboutServerPayload { + return AboutServerPayload( BuildConfig.NAME, BuildConfig.VERSION, BuildConfig.REVISION, @@ -51,6 +51,12 @@ class InfoQuery { } } + fun aboutWebUI(): CompletableFuture { + return future { + WebInterfaceManager.getAboutInfo() + } + } + fun checkForWebUIUpdate(): CompletableFuture { return future { val (version, updateAvailable) = WebInterfaceManager.isUpdateAvailable() diff --git a/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt b/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt index 6d13b2fb..efcd44bf 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt @@ -167,6 +167,21 @@ object WebInterfaceManager { ) } + suspend fun getAboutInfo(): WebUIUpdateInfo { + val currentVersion = getLocalVersion() + + val failedToGetVersion = currentVersion === "r-1" + if (failedToGetVersion) { + throw Exception("Failed to get current version") + } + + return WebUIUpdateInfo( + channel = serverConfig.webUIChannel.value, + tag = currentVersion, + updateAvailable = isUpdateAvailable(currentVersion).second, + ) + } + private var serveWebUI: () -> Unit = {} fun setServeWebUI(serveWebUI: () -> Unit) {