Fix updating webui version update timestamp on manual update trigger (#1837)

This commit is contained in:
schroda
2026-01-03 18:53:26 +01:00
committed by GitHub
parent 0cac39c19f
commit c624c6d860

View File

@@ -243,8 +243,9 @@ object WebInterfaceManager {
return File(tempWebUIRoot).canonicalPath return File(tempWebUIRoot).canonicalPath
} }
private fun setServedWebUIFlavor(flavor: WebUIFlavor) { private fun updateServedWebUIInfo(flavor: WebUIFlavor) {
preferences.edit().putString(SERVED_WEBUI_FLAVOR_KEY, flavor.uiName).apply() preferences.edit().putString(SERVED_WEBUI_FLAVOR_KEY, flavor.uiName).apply()
preferences.edit().putLong(VERSION_UPDATE_TIMESTAMP_KEY, System.currentTimeMillis()).apply()
} }
private fun getServedWebUIFlavor(): WebUIFlavor = private fun getServedWebUIFlavor(): WebUIFlavor =
@@ -436,7 +437,7 @@ object WebInterfaceManager {
private suspend fun setupBundledWebUI() { private suspend fun setupBundledWebUI() {
try { try {
extractBundledWebUI() extractBundledWebUI()
setServedWebUIFlavor(WebUIFlavor.default) updateServedWebUIInfo(WebUIFlavor.default)
return return
} catch (e: BundledWebUIMissing) { } catch (e: BundledWebUIMissing) {
logger.warn(e) { "setupBundledWebUI: fallback to downloading the version of the bundled webUI" } logger.warn(e) { "setupBundledWebUI: fallback to downloading the version of the bundled webUI" }
@@ -479,7 +480,6 @@ object WebInterfaceManager {
log.info { "An update is available, starting download..." } log.info { "An update is available, starting download..." }
try { try {
downloadVersion(flavor, getLatestCompatibleVersion(flavor)) downloadVersion(flavor, getLatestCompatibleVersion(flavor))
preferences.edit().putLong(VERSION_UPDATE_TIMESTAMP_KEY, System.currentTimeMillis()).apply()
serveWebUI() serveWebUI()
} catch (e: Exception) { } catch (e: Exception) {
log.warn(e) { "failed due to" } log.warn(e) { "failed due to" }
@@ -750,7 +750,7 @@ object WebInterfaceManager {
extractDownload(webUIZipPath, applicationDirs.webUIRoot) extractDownload(webUIZipPath, applicationDirs.webUIRoot)
log.info { "Extracting WebUI zip Done." } log.info { "Extracting WebUI zip Done." }
setServedWebUIFlavor(flavor) updateServedWebUIInfo(flavor)
emitStatus(version, FINISHED, 100, immediate = true) emitStatus(version, FINISHED, 100, immediate = true)
} catch (e: Exception) { } catch (e: Exception) {