refactor: remove the server-rendered web UI
CI / chart (push) Successful in 3s
CI / chart-push (push) Successful in 3s
CI / test (push) Successful in 1m53s
CI / image (push) Successful in 4m12s

All browsing and mood management now live in the native client. Drop the
embedded HTML page, the WEB_UI setting, the /ui route and the chart env
entry; the server only exposes /api/v1, /health and a small root banner.
This commit is contained in:
TapTap committed 2026-11-14 19:36:43 +00:00
1 parent 54cf807a9b
commit bf6c9e7394
6 files changed
+7 -646

No files matched your search

@@ -16,7 +16,6 @@ import io.ktor.server.plugins.partialcontent.PartialContent
import io.ktor.server.plugins.statuspages.StatusPages
import io.ktor.server.request.path
import io.ktor.server.response.respond
import io.ktor.server.response.respondRedirect
import io.ktor.server.response.respondText
import io.ktor.server.routing.get
import io.ktor.server.routing.routing
@@ -68,12 +67,6 @@ fun main() {
scanner.start(applicationScope)
}
val webUiHtml = if (config.webUiEnabled) {
AppConfig::class.java.getResource("/web/index.html")?.readText()
} else {
null
}
val server = embeddedServer(Netty, port = config.port, host = "0.0.0.0") {
install(ContentNegotiation) {
json(
@@ -131,9 +124,11 @@ fun main() {
routing {
get("/health") { call.respondText("ok") }
if (webUiHtml != null) {
get("/") { call.respondRedirect("/ui") }
get("/ui") { call.respondText(webUiHtml, ContentType.Text.Html) }
get("/") {
call.respondText(
"AudioManager\nAPI: /api/v1\nHealth: /health\n",
ContentType.Text.Plain,
)
}
apiRoutes(
users = users,
@@ -14,7 +14,6 @@ data class AppConfig(
val libraryConfigPath: Path,
val usersFile: Path,
val ffmpegPath: String,
val webUiEnabled: Boolean = true,
) {
val databasePath: Path get() = dataDir.resolve("musicmanager.db")
@@ -28,20 +27,12 @@ data class AppConfig(
?: throw IllegalArgumentException("PORT must be an integer, got: $rawPort")
require(port in 1..65535) { "PORT must be between 1 and 65535, got: $port" }
val webUi = value("WEB_UI", "true").lowercase()
val webUiEnabled = when (webUi) {
"true", "1", "yes", "on" -> true
"false", "0", "no", "off" -> false
else -> throw IllegalArgumentException("WEB_UI must be true or false, got: $webUi")
}
return AppConfig(
port = port,
dataDir = Path.of(value("DATA_DIR", "./data")),
libraryConfigPath = Path.of(value("LIBRARY_CONFIG", "./config/library.yaml")),
usersFile = Path.of(value("USERS_FILE", "./config/users.yaml")),
ffmpegPath = value("FFMPEG_PATH", "ffmpeg"),
webUiEnabled = webUiEnabled,
)
}
}