mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2025-12-10 23:02:06 +01:00
Compare webUI version with bundled webUI version (#969)
* Compare webUI version with bundled webUI version The bundled webUI version was incorrectly compared with the minimum server version. This worked until the latest release, because the bundled webUI version had a lower revision number than the server revision, however, with the latest release, it is now higher, resulting in no compatible webUI version to be found * Consider bundled webUI version only for default flavor * Add "isDefault" util function to WebUIFlavor
This commit is contained in:
@@ -136,6 +136,8 @@ enum class WebUIFlavor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun WebUIFlavor.isDefault(): Boolean = this == WebUIFlavor.default
|
||||||
|
|
||||||
object WebInterfaceManager {
|
object WebInterfaceManager {
|
||||||
private val logger = KotlinLogging.logger {}
|
private val logger = KotlinLogging.logger {}
|
||||||
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
||||||
@@ -314,10 +316,7 @@ object WebInterfaceManager {
|
|||||||
// check if the bundled webUI version is a newer version than the current used version
|
// check if the bundled webUI version is a newer version than the current used version
|
||||||
// this could be the case in case no compatible webUI version is available and a newer server version was installed
|
// this could be the case in case no compatible webUI version is available and a newer server version was installed
|
||||||
val shouldUpdateToBundledVersion =
|
val shouldUpdateToBundledVersion =
|
||||||
flavor.uiName == WebUIFlavor.default.uiName && extractVersion(getLocalVersion()) <
|
flavor.isDefault() && extractVersion(getLocalVersion()) < extractVersion(BuildConfig.WEBUI_TAG)
|
||||||
extractVersion(
|
|
||||||
BuildConfig.WEBUI_TAG,
|
|
||||||
)
|
|
||||||
if (shouldUpdateToBundledVersion) {
|
if (shouldUpdateToBundledVersion) {
|
||||||
log.debug { "update to bundled version \"${BuildConfig.WEBUI_TAG}\"" }
|
log.debug { "update to bundled version \"${BuildConfig.WEBUI_TAG}\"" }
|
||||||
|
|
||||||
@@ -375,7 +374,7 @@ object WebInterfaceManager {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flavor.uiName != WebUIFlavor.default.uiName) {
|
if (!flavor.isDefault()) {
|
||||||
log.warn { "fallback to default webUI \"${WebUIFlavor.default.uiName}\"" }
|
log.warn { "fallback to default webUI \"${WebUIFlavor.default.uiName}\"" }
|
||||||
|
|
||||||
serverConfig.webUIFlavor.value = WebUIFlavor.default.uiName
|
serverConfig.webUIFlavor.value = WebUIFlavor.default.uiName
|
||||||
@@ -613,11 +612,9 @@ object WebInterfaceManager {
|
|||||||
webUIVersion = fetchPreviewVersion(flavor)
|
webUIVersion = fetchPreviewVersion(flavor)
|
||||||
}
|
}
|
||||||
|
|
||||||
val isCompatibleVersion =
|
val isNewerThanBundled =
|
||||||
minServerVersionNumber <= currentServerVersionNumber && minServerVersionNumber >=
|
!flavor.isDefault() || extractVersion(webUIVersion) >= extractVersion(BuildConfig.WEBUI_TAG)
|
||||||
extractVersion(
|
val isCompatibleVersion = minServerVersionNumber <= currentServerVersionNumber && isNewerThanBundled
|
||||||
BuildConfig.WEBUI_TAG,
|
|
||||||
)
|
|
||||||
if (isCompatibleVersion) {
|
if (isCompatibleVersion) {
|
||||||
return webUIVersion
|
return webUIVersion
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user