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

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}") {
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)
}

View File

@@ -9,7 +9,7 @@
</head>
<body onload="javascript:fetch_data()">
<h2>Conversations:</h2>
<div id="messages">
<div id="messages" style="display: flex; flex-direction: column;">
</div>
</body>

View File

@@ -28,7 +28,6 @@
<div id="messages" class="messages">
</div>
</div>
<footer>
@@ -147,7 +146,7 @@
console.error('Error:', error);
});
await sleep(6000);
await sleep(3000);
if (recursive) fetch_data("messages");
}

View File

@@ -22,6 +22,8 @@ body {
margin: auto;
text-align: center;
box-sizing: border-box;*/
margin-top: 5%;
margin-bottom: 0;
justify-content: center;
flex-direction: column;
height: 80vh;
@@ -40,7 +42,9 @@ body {
.message {
margin: auto;
margin-top: 10px;
position: relative;
bottom: 0px;
margin-bottom: 10px;
padding: 0px 25px;
text-align: left;
width: 60%;
@@ -57,8 +61,9 @@ body {
}
.messages {
height: 100%;
display: flex;
margin: 10px auto 0px auto;
margin: 0px auto 0px auto;
padding: 10px 0px;
flex-direction: column-reverse;
width: 80%;