mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 03:14:40 -05:00
Update served webUI after update (#764)
The served file gets cached and thus, it won't reflect the latest version of the file. This was a problem after the webUI got updated, since now the served "index.html" was outdated and pointed to files that didn't exist anymore.
This commit is contained in:
@@ -72,13 +72,19 @@ object JavalinSetup {
|
|||||||
val app =
|
val app =
|
||||||
Javalin.create { config ->
|
Javalin.create { config ->
|
||||||
if (serverConfig.webUIEnabled.value) {
|
if (serverConfig.webUIEnabled.value) {
|
||||||
|
val serveWebUI = {
|
||||||
|
config.addSinglePageRoot("/", applicationDirs.webUIRoot + "/index.html", Location.EXTERNAL)
|
||||||
|
}
|
||||||
|
WebInterfaceManager.setServeWebUI(serveWebUI)
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
WebInterfaceManager.setupWebUI()
|
WebInterfaceManager.setupWebUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info { "Serving web static files for ${serverConfig.webUIFlavor.value}" }
|
logger.info { "Serving web static files for ${serverConfig.webUIFlavor.value}" }
|
||||||
config.addStaticFiles(applicationDirs.webUIRoot, Location.EXTERNAL)
|
config.addStaticFiles(applicationDirs.webUIRoot, Location.EXTERNAL)
|
||||||
config.addSinglePageRoot("/", applicationDirs.webUIRoot + "/index.html", Location.EXTERNAL)
|
serveWebUI()
|
||||||
|
|
||||||
config.registerPlugin(OpenApiPlugin(getOpenApiOptions()))
|
config.registerPlugin(OpenApiPlugin(getOpenApiOptions()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,6 +167,12 @@ object WebInterfaceManager {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var serveWebUI: () -> Unit = {}
|
||||||
|
|
||||||
|
fun setServeWebUI(serveWebUI: () -> Unit) {
|
||||||
|
this.serveWebUI = serveWebUI
|
||||||
|
}
|
||||||
|
|
||||||
private fun isAutoUpdateEnabled(): Boolean {
|
private fun isAutoUpdateEnabled(): Boolean {
|
||||||
return serverConfig.webUIUpdateCheckInterval.value.toInt() != 0
|
return serverConfig.webUIUpdateCheckInterval.value.toInt() != 0
|
||||||
}
|
}
|
||||||
@@ -566,6 +572,8 @@ object WebInterfaceManager {
|
|||||||
log.info { "Extracting WebUI zip Done." }
|
log.info { "Extracting WebUI zip Done." }
|
||||||
|
|
||||||
emitStatus(version, FINISHED, 100)
|
emitStatus(version, FINISHED, 100)
|
||||||
|
|
||||||
|
serveWebUI()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
emitStatus(version, ERROR, 0)
|
emitStatus(version, ERROR, 0)
|
||||||
throw e
|
throw e
|
||||||
|
|||||||
Reference in New Issue
Block a user