mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-03 02:44:34 -05:00
Fix/webinterfacemanager update to bundled webui (#648)
* Catch error when updating to bundled webUI In case the bundled webUI is missing, the webUI setup threw an error and made the server startup fail. Since a local webUI exists the error should be ignored, since it's only a try to update to a newer webUI version. * Extract logic to setup bundled webUI version * Update to bundled webUI try to download missing bundled webUI
This commit is contained in:
@@ -128,8 +128,13 @@ object WebInterfaceManager {
|
|||||||
BuildConfig.WEBUI_TAG
|
BuildConfig.WEBUI_TAG
|
||||||
)
|
)
|
||||||
if (shouldUpdateToBundledVersion) {
|
if (shouldUpdateToBundledVersion) {
|
||||||
logger.debug { "Update to bundled version \"${BuildConfig.WEBUI_TAG}\"" }
|
logger.debug { "setupWebUI: update to bundled version \"${BuildConfig.WEBUI_TAG}\"" }
|
||||||
extractBundledWebUI()
|
|
||||||
|
try {
|
||||||
|
setupBundledWebUI()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logger.error(e) { "setupWebUI: failed the update to the bundled webUI" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -178,17 +183,22 @@ object WebInterfaceManager {
|
|||||||
|
|
||||||
logger.warn { "doInitialSetup: fallback to bundled default webUI \"$DEFAULT_WEB_UI\"" }
|
logger.warn { "doInitialSetup: fallback to bundled default webUI \"$DEFAULT_WEB_UI\"" }
|
||||||
|
|
||||||
|
try {
|
||||||
|
setupBundledWebUI()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
throw Exception("Unable to setup a webUI")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupBundledWebUI() {
|
||||||
try {
|
try {
|
||||||
extractBundledWebUI()
|
extractBundledWebUI()
|
||||||
return
|
return
|
||||||
} catch (e: BundledWebUIMissing) {
|
} catch (e: BundledWebUIMissing) {
|
||||||
logger.warn(e) { "doInitialSetup: fallback to downloading the version of the bundled webUI" }
|
logger.warn(e) { "setupBundledWebUI: fallback to downloading the version of the bundled webUI" }
|
||||||
}
|
}
|
||||||
|
|
||||||
val downloadFailed = !doDownload() { BuildConfig.WEBUI_TAG }
|
downloadVersion(BuildConfig.WEBUI_TAG)
|
||||||
if (downloadFailed) {
|
|
||||||
throw Exception("Unable to setup a webUI")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun extractBundledWebUI() {
|
private fun extractBundledWebUI() {
|
||||||
|
|||||||
Reference in New Issue
Block a user