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

@ -1,4 +1,4 @@
""" database stuff """
""" interactions with the database """
import sqlite3
import json
from log import insert_log
@ -22,8 +22,10 @@ def return_dbcon(sql):
con.commit()
return ergebnis
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")
raise e
def mate_erstellen():

View File

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

View File

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

View File

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

View File

@ -2,7 +2,8 @@ a {
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))
}
/* Set a style for all buttons */

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() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/get");
xhr.onload = function() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/get");
xhr.onload = function() {
document.getElementById("messages").innerHTML = xhr.responseText;
};
xhr.send();
};
xhr.send();
}
function sendMessage() {

View File

@ -6,12 +6,10 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="{{ url_for('static', filename='../static/css/style.css') }}">
<style>
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))
}
button {
background-color: #4CAF50;

View File

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