mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-01 01:44:34 -05:00
Correctly check if a new version is available for the preview channel (#604)
The actual version of the preview was never loaded and compared to the local version. Instead, for the preview channel it was incorrectly decided that a new version is available on every update check
This commit is contained in:
@@ -251,7 +251,7 @@ object WebInterfaceManager {
|
|||||||
|
|
||||||
private fun fetchPreviewVersion(): String {
|
private fun fetchPreviewVersion(): String {
|
||||||
val releaseInfoJson = URL(WebUI.WEBUI.latestReleaseInfoUrl).readText()
|
val releaseInfoJson = URL(WebUI.WEBUI.latestReleaseInfoUrl).readText()
|
||||||
return Json.decodeFromString<JsonObject>(releaseInfoJson)["tag_name"]?.jsonPrimitive?.content ?: ""
|
return Json.decodeFromString<JsonObject>(releaseInfoJson)["tag_name"]?.jsonPrimitive?.content ?: throw Exception("Failed to get the preview version tag")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getLatestCompatibleVersion(): String {
|
private fun getLatestCompatibleVersion(): String {
|
||||||
@@ -385,7 +385,13 @@ object WebInterfaceManager {
|
|||||||
|
|
||||||
fun isUpdateAvailable(currentVersion: String): Boolean {
|
fun isUpdateAvailable(currentVersion: String): Boolean {
|
||||||
return try {
|
return try {
|
||||||
val latestCompatibleVersion = getLatestCompatibleVersion()
|
val version = getLatestCompatibleVersion()
|
||||||
|
val latestCompatibleVersion = if (version == webUIPreviewVersion) {
|
||||||
|
fetchPreviewVersion()
|
||||||
|
} else {
|
||||||
|
version
|
||||||
|
}
|
||||||
|
|
||||||
latestCompatibleVersion != currentVersion
|
latestCompatibleVersion != currentVersion
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logger.debug { "isUpdateAvailable: check failed due to $e" }
|
logger.debug { "isUpdateAvailable: check failed due to $e" }
|
||||||
|
|||||||
Reference in New Issue
Block a user