This commit is contained in:
2026-01-18 18:08:39 +01:00
parent 344e328c25
commit 69ee9dfb2f
4 changed files with 19 additions and 11 deletions
+10 -6
View File
@@ -12,7 +12,7 @@ import kotlin.random.Random
//átlagos JAVA alapú fejlesztő
val httpPort: Int = System.getenv("HTTP_PORT")?.toInt() ?: 80
val httpPort: Int = System.getenv("HTTP_PORT")?.toInt() ?: 8080
val resourcesPath: String = System.getenv("RESOURCES") ?: "src/main/resources/"
@@ -35,13 +35,13 @@ object ConversationHandler {
{
val stringBuilder = StringBuilder()
for (conversation in conversations)
{
stringBuilder.append(conversation.list())
}
println(stringBuilder.toString())
return stringBuilder.toString()
}
@@ -70,7 +70,7 @@ class Conversation(val ID: Int)
<p style="flex-grow: 1;">$ID</p>
<p style="flex-grow: 9;">${messages.last().text}</p>
<button style="flex-grow: 1;" onclick="open_message($ID)">reply</button>
<div>
</div>
""".trimIndent()
}
@@ -194,8 +194,12 @@ fun runEmbeddedServer()
}
get("/api/reinit/{id}") {
ConversationHandler.newConv(call.parameters["id"]?.toInt() ?: -1)
println(ConversationHandler.conversations.last().ID)
if (ConversationHandler.conversations.filter { it.ID == call.parameters["id"]?.toInt()}.size != 1)
{
ConversationHandler.newConv(call.parameters["id"]?.toInt() ?: -1)
println(ConversationHandler.conversations.last().ID)
}
call.respond(HttpStatusCode.OK)
}