diff --git a/Config/README.md b/Config/README.md index 3c295ca..7ce7878 100644 --- a/Config/README.md +++ b/Config/README.md @@ -1 +1 @@ -Config Dateien \ No newline at end of file +Config & Log Dateien diff --git a/Config/party.sql b/Config/party.sql index 23a564c..1b9462b 100644 --- a/Config/party.sql +++ b/Config/party.sql @@ -110,4 +110,4 @@ username TEXT, message TEXT, timestamp TEXT, PRIMARY KEY(messageID, sessionID) -); \ No newline at end of file +); diff --git a/database.py b/database.py index a7bbd29..7acc967 100644 --- a/database.py +++ b/database.py @@ -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(): diff --git a/main.py b/main.py index 49c8be4..f67a48b 100644 --- a/main.py +++ b/main.py @@ -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()) diff --git a/requirements.txt b/requirements.txt index c0795f4..5f49e2a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ matplotlib numpy qrcode +flask-socketio diff --git a/server.py b/server.py index 4907d05..ad64ade 100644 --- a/server.py +++ b/server.py @@ -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 diff --git a/static/css/style.css b/static/css/style.css index 3453fd8..2b87fe5 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -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 */ @@ -348,4 +349,4 @@ input:checked + .slider:before { .slider.round:before { border-radius: 50%; -} \ No newline at end of file +} diff --git a/static/js/chat.js b/static/js/chat.js index 0d18a20..c85a4f2 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -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() { - document.getElementById("messages").innerHTML = xhr.responseText; -}; -xhr.send(); + var xhr = new XMLHttpRequest(); + xhr.open("GET", "/get"); + xhr.onload = function() { + document.getElementById("messages").innerHTML = xhr.responseText; + }; + xhr.send(); } function sendMessage() { diff --git a/templates/index.html b/templates/index.html index 32b3d17..d555c80 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6,29 +6,27 @@ - diff --git a/templates/session.html b/templates/session.html index ec210cb..dad8e3d 100644 --- a/templates/session.html +++ b/templates/session.html @@ -11,7 +11,7 @@ -
+