mirror of
https://github.com/lucaspalomodevelop/Party.git
synced 2026-03-15 00:44:34 +00:00
Merge branch 'main' into develop
This commit is contained in:
commit
05d1da343f
40
main.py
40
main.py
@ -100,6 +100,7 @@ def get_chat():
|
||||
log_server("neue Nachricht")
|
||||
try:
|
||||
dbcon(l)
|
||||
log_server("message entered successfully")
|
||||
|
||||
except:
|
||||
error_log("unable to get new Messages")
|
||||
@ -111,6 +112,7 @@ def get_chat():
|
||||
|
||||
@app.route("/get_game_file", methods=['POST'])
|
||||
def get_game_file():
|
||||
log_server("called /get_game_file")
|
||||
pick()
|
||||
|
||||
@app.route("/get_new_message")
|
||||
@ -135,14 +137,15 @@ def message():
|
||||
@app.route("/planer")
|
||||
def planer():
|
||||
if session:
|
||||
con = sqlite3.connect("party.db")
|
||||
cur = con.cursor()
|
||||
l = f"SELECT * FROM planer;"
|
||||
asd = cur.execute(l)
|
||||
con.commit()
|
||||
# asd = cur.execute('SELECT * FROM planer').fetchall()
|
||||
# cur.commit()
|
||||
# cur.close()
|
||||
try:
|
||||
con = sqlite3.connect("party.db")
|
||||
cur = con.cursor()
|
||||
l = f"SELECT * FROM planer;"
|
||||
asd = cur.execute(l)
|
||||
con.commit()
|
||||
log_server("sql run successfully /planer")
|
||||
except:
|
||||
error_log("unabel to execute sql in /planer")
|
||||
log_server("called /planer")
|
||||
return render_template("planer.html", asd=asd)
|
||||
else:
|
||||
@ -167,6 +170,7 @@ def get_planer():
|
||||
cur.execute(l)
|
||||
con.commit()
|
||||
con.close()
|
||||
log_server("event entered successfully /get_planer")
|
||||
except:
|
||||
error_log("unable to insert event")
|
||||
return "{ \"message\": \"planer\"'}"
|
||||
@ -183,6 +187,15 @@ def session(id):
|
||||
warning_log(" called /session without being logged in")
|
||||
return render_template('passwd.html')
|
||||
|
||||
@app.route("/mate", methods=['POST'])
|
||||
def mate():
|
||||
if session:
|
||||
log_server("called /mate")
|
||||
return render_template("404.html")
|
||||
else:
|
||||
warning_log(" called /mate without being logged in")
|
||||
return render_template('/passwd')
|
||||
|
||||
@app.route("/logout")
|
||||
def logout():
|
||||
log_server("called /logout")
|
||||
@ -237,6 +250,7 @@ def get_creat_session():
|
||||
starttime = int(zeit)
|
||||
create_qr(sessionID)
|
||||
return redirect(f'/session/{sessionID}')
|
||||
log_server("session successfully started")
|
||||
except:
|
||||
error_log("unable to create Session")
|
||||
return "{ \"message\": \"Login failed\"'}"
|
||||
@ -257,7 +271,9 @@ def stopuhr():
|
||||
sessionId = request.form['sessionid']
|
||||
l = f"INSERT INTO game VALUES( \'{sessionID}\', \'{userId}\',\'{spielName}\', \'{zeit}\');"
|
||||
try:
|
||||
warning_log("verbindung mit Datenbank wurde aufgenommen")
|
||||
dbcon(l)
|
||||
log_server("time entered successfully /stopuhr")
|
||||
except:
|
||||
error_log("unable to run sql /stopuhr")
|
||||
return render_template()
|
||||
@ -280,6 +296,7 @@ def get_event():
|
||||
cur.execute(l)
|
||||
con.commit()
|
||||
con.close()
|
||||
log_server("event entered successfully /get_event")
|
||||
except:
|
||||
error_log("unable to run sql /get_event")
|
||||
return render_template("login.html")
|
||||
@ -303,12 +320,15 @@ def game():
|
||||
return render_template("game.html")
|
||||
else:
|
||||
warning_log(" called /game without being logged in")
|
||||
|
||||
return render_template('passwd.html')
|
||||
|
||||
|
||||
@app.route("/seession")
|
||||
def seession():
|
||||
if session:
|
||||
con = sqlite3.connect("party.db")
|
||||
warning_log("Verbindung mit Datenbank wurde aufgenommen /seession")
|
||||
cur = con.cursor()
|
||||
creator = cur.execute("SELECT username FROM user WHERE info = 'creator'").fetchall()
|
||||
cur.close()
|
||||
@ -339,9 +359,11 @@ def get_login():
|
||||
session['loggedin'] = True
|
||||
user_count = +1
|
||||
# session['username'] = account['username']
|
||||
log_server("loggedin successfully")
|
||||
return redirect(f'/session/{sessionId}')
|
||||
else:
|
||||
return "{ \"message\": \"Login failed\"'}"
|
||||
warning_log("unable to create new user /get_login")
|
||||
con.close()
|
||||
|
||||
@app.route("/new", methods=['POST'])
|
||||
@ -358,9 +380,11 @@ def new():
|
||||
session['loggedin'] = True
|
||||
user_count = +1
|
||||
# session['username'] = account['username']
|
||||
log_server("created new user successfully")
|
||||
return redirect(f'/session/{sessionId}')
|
||||
else:
|
||||
return "{ \"message\": \"Login failed\"'}"
|
||||
warning_log("unable to create new user /new")
|
||||
con.close()
|
||||
|
||||
@app.errorhandler(404)
|
||||
|
||||
@ -4,4 +4,5 @@ CREATE TABLE seession (sessionID INTEGER UNIQUE PRIMARY KEY, sessionname TEXT, u
|
||||
CREATE TABLE chat (sessionID INTEGER, userID INTEGER, chatmessage TEXT, ZEIT TEXT);
|
||||
CREATE TABLE game (sessionID INTEGER, userID INTEGER, Spielname TEXT, Spielaktivität TEXT, ZEIT TEXT);
|
||||
CREATE TABLE uploadgame (sessionID INTEGER, userID INTEGER, Spielname TEXT, Spielstand TEXT);
|
||||
CREATE TABLE planer (eventname TEXT, eventzeit TEXT, sessionID INTEGER);
|
||||
CREATE TABLE planer (eventname TEXT, eventzeit TEXT, sessionID INTEGER);
|
||||
CREATE TABLE mate (matename TEXT, mateanzahl INTEGER, sessionID INTEGER);
|
||||
@ -107,7 +107,7 @@
|
||||
</div>
|
||||
<div hidden class="tmplt_tab" id="_seession">
|
||||
<h1> Session Information</h1>
|
||||
<label>User Anzahl, Uptime, Creator:</label>
|
||||
<label>User Anzahl, Uptime, Creator & Anzahl Mateflaschen:</label>
|
||||
<img src="/static/img/user.png" width="60" height="60">
|
||||
|
||||
<p>{{das}}</p>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user