things
This commit is contained in:
@@ -12,7 +12,7 @@ import kotlin.random.Random
|
|||||||
|
|
||||||
//átlagos JAVA alapú fejlesztő
|
//á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/"
|
val resourcesPath: String = System.getenv("RESOURCES") ?: "src/main/resources/"
|
||||||
|
|
||||||
|
|
||||||
@@ -35,13 +35,13 @@ object ConversationHandler {
|
|||||||
{
|
{
|
||||||
val stringBuilder = StringBuilder()
|
val stringBuilder = StringBuilder()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (conversation in conversations)
|
for (conversation in conversations)
|
||||||
{
|
{
|
||||||
stringBuilder.append(conversation.list())
|
stringBuilder.append(conversation.list())
|
||||||
}
|
}
|
||||||
|
|
||||||
println(stringBuilder.toString())
|
|
||||||
|
|
||||||
return 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: 1;">$ID</p>
|
||||||
<p style="flex-grow: 9;">${messages.last().text}</p>
|
<p style="flex-grow: 9;">${messages.last().text}</p>
|
||||||
<button style="flex-grow: 1;" onclick="open_message($ID)">reply</button>
|
<button style="flex-grow: 1;" onclick="open_message($ID)">reply</button>
|
||||||
<div>
|
</div>
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,8 +194,12 @@ fun runEmbeddedServer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
get("/api/reinit/{id}") {
|
get("/api/reinit/{id}") {
|
||||||
|
if (ConversationHandler.conversations.filter { it.ID == call.parameters["id"]?.toInt()}.size != 1)
|
||||||
|
{
|
||||||
ConversationHandler.newConv(call.parameters["id"]?.toInt() ?: -1)
|
ConversationHandler.newConv(call.parameters["id"]?.toInt() ?: -1)
|
||||||
println(ConversationHandler.conversations.last().ID)
|
println(ConversationHandler.conversations.last().ID)
|
||||||
|
}
|
||||||
|
|
||||||
call.respond(HttpStatusCode.OK)
|
call.respond(HttpStatusCode.OK)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body onload="javascript:fetch_data()">
|
<body onload="javascript:fetch_data()">
|
||||||
<h2>Conversations:</h2>
|
<h2>Conversations:</h2>
|
||||||
<div id="messages">
|
<div id="messages" style="display: flex; flex-direction: column;">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
<div id="messages" class="messages">
|
<div id="messages" class="messages">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
@@ -147,7 +146,7 @@
|
|||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
});
|
});
|
||||||
|
|
||||||
await sleep(6000);
|
await sleep(3000);
|
||||||
|
|
||||||
if (recursive) fetch_data("messages");
|
if (recursive) fetch_data("messages");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ body {
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
box-sizing: border-box;*/
|
box-sizing: border-box;*/
|
||||||
|
margin-top: 5%;
|
||||||
|
margin-bottom: 0;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 80vh;
|
height: 80vh;
|
||||||
@@ -40,7 +42,9 @@ body {
|
|||||||
|
|
||||||
.message {
|
.message {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
margin-top: 10px;
|
position: relative;
|
||||||
|
bottom: 0px;
|
||||||
|
margin-bottom: 10px;
|
||||||
padding: 0px 25px;
|
padding: 0px 25px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
width: 60%;
|
width: 60%;
|
||||||
@@ -57,8 +61,9 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.messages {
|
.messages {
|
||||||
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 10px auto 0px auto;
|
margin: 0px auto 0px auto;
|
||||||
padding: 10px 0px;
|
padding: 10px 0px;
|
||||||
flex-direction: column-reverse;
|
flex-direction: column-reverse;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
|||||||
Reference in New Issue
Block a user