Fix/gql about webui query same response type as webui update info (#781)

* Use a new type for the webui about info query

Using the same type for this and the webui update queries/mutations caused apollo to save it as the same data in the cache, overwriting the "about info"

* Use a new type for the webui about check query

To prevent similar issues (cc3bf5f34a8afebadd306d037db1a10088ef9334) with the "update check" and the "update progress" payloads

* Throw update check error when calling it via the query

Otherwise, the error is never raised to the frontend

* Set "ERROR" state in case the update check failed on WebUI update trigger
This commit is contained in:
schroda
2023-11-26 23:17:28 +01:00
committed by GitHub
parent d65ed6ced7
commit 94b670eb81
4 changed files with 33 additions and 10 deletions

View File

@@ -1,7 +1,8 @@
package suwayomi.tachidesk.graphql.queries
import suwayomi.tachidesk.global.impl.AppUpdate
import suwayomi.tachidesk.graphql.types.WebUIUpdateInfo
import suwayomi.tachidesk.graphql.types.AboutWebUI
import suwayomi.tachidesk.graphql.types.WebUIUpdateCheck
import suwayomi.tachidesk.graphql.types.WebUIUpdateStatus
import suwayomi.tachidesk.server.JavalinSetup.future
import suwayomi.tachidesk.server.generated.BuildConfig
@@ -51,16 +52,16 @@ class InfoQuery {
}
}
fun aboutWebUI(): CompletableFuture<WebUIUpdateInfo> {
fun aboutWebUI(): CompletableFuture<AboutWebUI> {
return future {
WebInterfaceManager.getAboutInfo()
}
}
fun checkForWebUIUpdate(): CompletableFuture<WebUIUpdateInfo> {
fun checkForWebUIUpdate(): CompletableFuture<WebUIUpdateCheck> {
return future {
val (version, updateAvailable) = WebInterfaceManager.isUpdateAvailable()
WebUIUpdateInfo(
val (version, updateAvailable) = WebInterfaceManager.isUpdateAvailable(raiseError = true)
WebUIUpdateCheck(
channel = serverConfig.webUIChannel.value,
tag = version,
updateAvailable,