Skip to content

Commit

Permalink
Add "about" query for webUI
Browse files Browse the repository at this point in the history
  • Loading branch information
schroda committed Nov 18, 2023
1 parent 1a5e995 commit 55ec2de
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ class InfoQuery {
}
}

fun aboutWebUI(): CompletableFuture<WebUIUpdateInfo> {
return future {
WebInterfaceManager.getAboutInfo()
}
}

fun checkForWebUIUpdate(): CompletableFuture<WebUIUpdateInfo> {
return future {
val (version, updateAvailable) = WebInterfaceManager.isUpdateAvailable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 55ec2de

Please sign in to comment.