Refactor package structure and add web components.

Reorganized Kotlin package structure under 'nl.astraeus' and removed 'gradle.properties' file. Updated '.gitignore' to exclude 'gradle.properties'. Added new web functionalities including ID generation, websocket and HTTP request handling to support dynamic web content delivery. Adjusted server configuration and modified build version.
This commit is contained in:
2024-12-01 11:59:26 +01:00
parent bf9d72a20c
commit 88d09ecdbf
13 changed files with 245 additions and 42 deletions

View File

@@ -0,0 +1,41 @@
package nl.astraeus.tmpl.web
import kotlinx.html.body
import kotlinx.html.head
import kotlinx.html.html
import kotlinx.html.meta
import kotlinx.html.script
import kotlinx.html.stream.appendHTML
import kotlinx.html.title
import nl.astraeus.tmpl.REPO_NAME
fun generateIndex(patch: String?): String {
val result = StringBuilder();
if (patch == null) {
result.appendHTML(true).html {
head {
title("${REPO_NAME}")
//link("/css/all.min.css", "stylesheet")
}
body {
script(src = "/${REPO_NAME}.js") {}
}
}
} else {
result.appendHTML(true).html {
head {
title("${REPO_NAME}")
meta {
httpEquiv = "refresh"
content = "0; url=/$itemUrl/$patch"
}
}
body {
+"Redirecting to $itemUrl $patch..."
}
}
}
return result.toString()
}