changes, incl. chat update start

This commit is contained in:
hyperbel 2023-05-20 22:23:50 +02:00
parent df58a46fb5
commit ae48b28c2b
10 changed files with 37 additions and 29 deletions

View File

@ -1 +1 @@
Config Dateien Config & Log Dateien

View File

@ -110,4 +110,4 @@ username TEXT,
message TEXT, message TEXT,
timestamp TEXT, timestamp TEXT,
PRIMARY KEY(messageID, sessionID) PRIMARY KEY(messageID, sessionID)
); );

View File

@ -1,4 +1,4 @@
""" database stuff """ """ interactions with the database """
import sqlite3 import sqlite3
import json import json
from log import insert_log from log import insert_log
@ -22,8 +22,10 @@ def return_dbcon(sql):
con.commit() con.commit()
return ergebnis return ergebnis
except Exception as e: except Exception as e:
print(f"Error: {e}")
insert_log(file="server", data=f"Error: {e}", log_type="ERROR") insert_log(file="server", data=f"Error: {e}", log_type="ERROR")
insert_log(file="server", data=f"Error: {e}", log_type="ERROR") raise e
def mate_erstellen(): def mate_erstellen():

View File

@ -5,7 +5,7 @@ from server import server
from database import mate_erstellen from database import mate_erstellen
def main(): def main():
""" entrypoint to program """ """ wird halt aufgerufen ne was soll ich da sagen """
# check if run with run.sh # check if run with run.sh
if os.getenv('RUN_WITH_SH') != '1': if os.getenv('RUN_WITH_SH') != '1':
@ -36,6 +36,5 @@ def main():
else: else:
parser.print_help() parser.print_help()
if __name__ == "__main__": if __name__ == "__main__":
exit(main()) exit(main())

View File

@ -1,3 +1,4 @@
matplotlib matplotlib
numpy numpy
qrcode qrcode
flask-socketio

View File

@ -7,6 +7,7 @@ from picker import picker as pick
from database import dbcon, return_dbcon from database import dbcon, return_dbcon
from mate import mate_logik, mws from mate import mate_logik, mws
from log import insert_log from log import insert_log
#from picker import createChart #from picker import createChart
# Funktion um den Server zu machen # Funktion um den Server zu machen

View File

@ -2,7 +2,8 @@ a {
text-decoration: none; text-decoration: none;
} }
body {font-family: Arial, Helvetica, sans-serif; body {
font-family: Arial, Helvetica, sans-serif;
background-image: linear-gradient(to right, rgb(38, 134, 62), rgb(89, 89, 175)) background-image: linear-gradient(to right, rgb(38, 134, 62), rgb(89, 89, 175))
} }
/* Set a style for all buttons */ /* Set a style for all buttons */
@ -348,4 +349,4 @@ input:checked + .slider:before {
.slider.round:before { .slider.round:before {
border-radius: 50%; border-radius: 50%;
} }

View File

@ -52,13 +52,19 @@ inputField.addEventListener("input", function() {
} }
}); });
const socket = new WebSocket("ws://" + location.host + "/ws");
socket.addEventListener("message", function(event) {
document.getElementById("messages").innerHTML = event.data;
});
function getMessages() { function getMessages() {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open("GET", "/get"); xhr.open("GET", "/get");
xhr.onload = function() { xhr.onload = function() {
document.getElementById("messages").innerHTML = xhr.responseText; document.getElementById("messages").innerHTML = xhr.responseText;
}; };
xhr.send(); xhr.send();
} }
function sendMessage() { function sendMessage() {

View File

@ -6,29 +6,27 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="{{ url_for('static', filename='../static/css/style.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='../static/css/style.css') }}">
<style> <style>
body {font-family: Arial, Helvetica, sans-serif; body {
background-image: linear-gradient(to right, rgb(38, 134, 62), rgb(89, 89, 175)) font-family: Arial, Helvetica, sans-serif;
background-image: linear-gradient(to right, rgb(38, 134, 62), rgb(89, 89, 175))
} }
button { button {
background-color: #4CAF50; background-color: #4CAF50;
width: 100%; width: 100%;
color: orange; color: orange;
padding: 15px; padding: 15px;
margin: 10px 0px; margin: 10px 0px;
border: none; border: none;
cursor: pointer; cursor: pointer;
border-radius: 12px; border-radius: 12px;
} }
footer { footer {
text-align: center; text-align: center;
padding: 3px; padding: 3px;
background-image: linear-gradient(to right, rgb(38, 134, 62), rgb(89, 89, 175)); background-image: linear-gradient(to right, rgb(38, 134, 62), rgb(89, 89, 175));
color: black; color: black;
} }
</style> </style>

View File

@ -11,7 +11,7 @@
</head> </head>
<body onload="getMessages(); setInterval(getMessages, 1000);"> <body>
<div class="info_button"></div> <div class="info_button"></div>
<a id="myButton" class="menu-link" ><img src="/static/img/user.png" width="50" height="50"></a> <a id="myButton" class="menu-link" ><img src="/static/img/user.png" width="50" height="50"></a>