Skip to content

Commit

Permalink
Feature/support different webui flavors (#863)
Browse files Browse the repository at this point in the history
* Run functions for specific webui flavor

* Set default flavor of WebUIFlavor enum

* Consider flavor of served webUI when checking for update

In case the flavor was changed and the served webui files are still for the previous flavor, the update check could incorrectly detect no update

* Skip validation during initial setup

In case initial setup is triggered because of an invalid local webUI, doing a validation again is unnecessary

* Handle changed flavor on startup
  • Loading branch information
schroda authored Feb 17, 2024
1 parent 8aa75be commit 9edbc7f
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import suwayomi.tachidesk.graphql.types.UpdateState.IDLE
import suwayomi.tachidesk.graphql.types.WebUIUpdateStatus
import suwayomi.tachidesk.server.JavalinSetup.future
import suwayomi.tachidesk.server.util.WebInterfaceManager
import suwayomi.tachidesk.server.util.WebUIFlavor
import java.util.concurrent.CompletableFuture
import kotlin.time.Duration.Companion.seconds

Expand All @@ -28,7 +29,9 @@ class InfoMutation {
return@withTimeout WebUIUpdatePayload(input.clientMutationId, WebInterfaceManager.status.value)
}

val (version, updateAvailable) = WebInterfaceManager.isUpdateAvailable()
val flavor = WebUIFlavor.current

val (version, updateAvailable) = WebInterfaceManager.isUpdateAvailable(flavor)

if (!updateAvailable) {
val didUpdateCheckFail = version.isEmpty()
Expand All @@ -39,7 +42,7 @@ class InfoMutation {
)
}
try {
WebInterfaceManager.startDownloadInScope(version)
WebInterfaceManager.startDownloadInScope(flavor, version)
} catch (e: Exception) {
// ignore since we use the status anyway
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import suwayomi.tachidesk.server.JavalinSetup.future
import suwayomi.tachidesk.server.generated.BuildConfig
import suwayomi.tachidesk.server.serverConfig
import suwayomi.tachidesk.server.util.WebInterfaceManager
import suwayomi.tachidesk.server.util.WebUIFlavor
import java.util.concurrent.CompletableFuture

class InfoQuery {
Expand Down Expand Up @@ -60,7 +61,7 @@ class InfoQuery {

fun checkForWebUIUpdate(): CompletableFuture<WebUIUpdateCheck> {
return future {
val (version, updateAvailable) = WebInterfaceManager.isUpdateAvailable(raiseError = true)
val (version, updateAvailable) = WebInterfaceManager.isUpdateAvailable(WebUIFlavor.current, raiseError = true)
WebUIUpdateCheck(
channel = serverConfig.webUIChannel.value,
tag = version,
Expand Down
Loading

0 comments on commit 9edbc7f

Please sign in to comment.