diff --git a/server/src/main/kotlin/suwayomi/tachidesk/server/JavalinSetup.kt b/server/src/main/kotlin/suwayomi/tachidesk/server/JavalinSetup.kt index 0d0b8c0a4..d05513a82 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/server/JavalinSetup.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/server/JavalinSetup.kt @@ -72,13 +72,19 @@ object JavalinSetup { val app = Javalin.create { config -> if (serverConfig.webUIEnabled.value) { + val serveWebUI = { + config.addSinglePageRoot("/", applicationDirs.webUIRoot + "/index.html", Location.EXTERNAL) + } + WebInterfaceManager.setServeWebUI(serveWebUI) + runBlocking { WebInterfaceManager.setupWebUI() } logger.info { "Serving web static files for ${serverConfig.webUIFlavor.value}" } config.addStaticFiles(applicationDirs.webUIRoot, Location.EXTERNAL) - config.addSinglePageRoot("/", applicationDirs.webUIRoot + "/index.html", Location.EXTERNAL) + serveWebUI() + config.registerPlugin(OpenApiPlugin(getOpenApiOptions())) } diff --git a/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt b/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt index 8db04bdc4..6d13b2fb8 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/server/util/WebInterfaceManager.kt @@ -167,6 +167,12 @@ object WebInterfaceManager { ) } + private var serveWebUI: () -> Unit = {} + + fun setServeWebUI(serveWebUI: () -> Unit) { + this.serveWebUI = serveWebUI + } + private fun isAutoUpdateEnabled(): Boolean { return serverConfig.webUIUpdateCheckInterval.value.toInt() != 0 } @@ -566,6 +572,8 @@ object WebInterfaceManager { log.info { "Extracting WebUI zip Done." } emitStatus(version, FINISHED, 100) + + serveWebUI() } catch (e: Exception) { emitStatus(version, ERROR, 0) throw e