From c78b47c1625727599ece66cfaf4213c72a60d58f Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Wed, 15 Oct 2025 16:10:00 +0800 Subject: [PATCH] build: prepare to serve next-ui dist --- komga/build.gradle.kts | 13 +++++++++++++ .../komga/infrastructure/web/WebMvcConfiguration.kt | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/komga/build.gradle.kts b/komga/build.gradle.kts index c5e15cdf..bc69bd11 100644 --- a/komga/build.gradle.kts +++ b/komga/build.gradle.kts @@ -143,6 +143,7 @@ kotlin { } val webui = "$rootDir/komga-webui" +val nextui = "$rootDir/next-ui" tasks { withType { sourceCompatibility = "17" @@ -218,6 +219,18 @@ tasks { } } + // modifies index.html to inject ThymeLeaf th: tags + register("prepareThymeLeafNext") { + group = "web" + from("$nextui/dist/index.html") + into("$projectDir/src/main/resources/public/") + filter { line -> + line.replace("((?:src|content|href)=\")([\\w]*/.*?)(\")".toRegex()) { + it.groups[0]?.value + " th:" + it.groups[1]?.value + "@{" + it.groups[2]?.value?.prefixIfNot("/") + "}" + it.groups[3]?.value + } + } + } + withType { filesMatching("application*.yml") { expand(project.properties) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/WebMvcConfiguration.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/WebMvcConfiguration.kt index 5bda6d13..d09aad8c 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/WebMvcConfiguration.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/WebMvcConfiguration.kt @@ -39,7 +39,7 @@ class WebMvcConfiguration : WebMvcConfigurer { ).addResourceLocations("classpath:public/") .setCacheControl(CacheControl.noStore()) - listOf("css", "fonts", "img", "js") + listOf("css", "fonts", "img", "js", "assets") .forEach { registry .addResourceHandler("/$it/**")