mirror of
https://github.com/Fluffy-Bean/GameExpo23.git
synced 2025-05-14 14:22:16 +00:00
Bugs bugs bugs bugs bugs bugs
I love bugs
This commit is contained in:
parent
28d5f140c0
commit
377f20ce10
7 changed files with 34 additions and 12 deletions
|
@ -1,4 +1,8 @@
|
|||
{$THE_FRONT_ROOMS_DOMAIN}
|
||||
reverse_proxy tfr:8000
|
||||
encode gzip
|
||||
|
||||
reverse_proxy tfr:8000 {
|
||||
header_up X-Forwarded-For {http.request.remote.addr}
|
||||
header_up X-Real-IP {http.request.remote.addr}
|
||||
}
|
||||
|
||||
encode gzip
|
||||
|
|
|
@ -6,7 +6,7 @@ from werkzeug.security import check_password_hash
|
|||
from werkzeug.utils import secure_filename
|
||||
|
||||
from .models import Scores, Sessions, Users
|
||||
from .extensions import db
|
||||
from .extensions import db, logger
|
||||
from .config import (
|
||||
GAME_VERSION,
|
||||
GAME_VERSIONS,
|
||||
|
@ -55,32 +55,34 @@ def post():
|
|||
difficulty = request.form.get("difficulty", GAME_DIFFICULTY)
|
||||
score = request.form.get("score", 0)
|
||||
|
||||
# logger.debug(f"Score upload attempt: {session_key} {version} {difficulty} {score}")
|
||||
|
||||
if not session_key:
|
||||
return "No session key provided!"
|
||||
if not score:
|
||||
return "Score is not valid!"
|
||||
|
||||
try:
|
||||
float(score)
|
||||
int(difficulty)
|
||||
score = float(score)
|
||||
difficulty = int(difficulty)
|
||||
except TypeError:
|
||||
return "Invalid score and difficulty must be valid numbers!"
|
||||
|
||||
if int(difficulty) not in GAME_DIFFICULTIES:
|
||||
if difficulty not in GAME_DIFFICULTIES:
|
||||
return "Invalid difficulty!"
|
||||
if version not in GAME_VERSIONS:
|
||||
return "Invalid version!"
|
||||
# This is a fix for a bug in the game that we dunno how to actually fix
|
||||
# if score < 10:
|
||||
# return "Score is impossible!"
|
||||
if score < 10:
|
||||
return "Score is impossible!"
|
||||
|
||||
session_data = Sessions.query.filter_by(auth_key=session_key).first()
|
||||
if not session_data:
|
||||
return "Authentication failed!"
|
||||
|
||||
score_upload = Scores(
|
||||
score=float(score),
|
||||
difficulty=int(difficulty),
|
||||
score=score,
|
||||
difficulty=difficulty,
|
||||
version=version,
|
||||
user_id=session_data.user_id,
|
||||
)
|
||||
|
|
|
@ -77,4 +77,4 @@ def login():
|
|||
|
||||
login_user(user, remember=True)
|
||||
flash("Successfully logged in!", "success")
|
||||
return redirect(url_for("account.settings"))
|
||||
return redirect(url_for("account.get_settings"))
|
||||
|
|
|
@ -39,3 +39,5 @@ port = 5432
|
|||
SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{user}:{password}@{host}:{port}/{db}"
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
SQLALCHEMY_POOL_RECYCLE = 621
|
||||
|
||||
LOGS_DIR = "/data/logs"
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
import logging
|
||||
from os import path
|
||||
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask_migrate import Migrate
|
||||
from flask_assets import Environment
|
||||
from flask_caching import Cache
|
||||
from flask_login import LoginManager
|
||||
|
||||
from .config import LOGS_DIR
|
||||
|
||||
logger = logging
|
||||
logger.getLogger(path.join(LOGS_DIR, "server.log"))
|
||||
logger.basicConfig(
|
||||
level=logging.DEBUG,
|
||||
format="%(asctime)s %(levelname)s %(name)s %(threadName)s : %(message)s",
|
||||
)
|
||||
|
||||
db = SQLAlchemy()
|
||||
migrate = Migrate()
|
||||
assets = Environment()
|
||||
|
|
|
@ -54,7 +54,8 @@ function getSearch() {
|
|||
el.innerHTML = user;
|
||||
el.onmousedown = function (event) {
|
||||
event.preventDefault();
|
||||
search = user.toString();
|
||||
search = document.querySelector('#search');
|
||||
search.value = user.toString();
|
||||
search.blur();
|
||||
}
|
||||
hint.appendChild(el);
|
||||
|
|
|
@ -38,6 +38,7 @@ services:
|
|||
volumes:
|
||||
- ./TFR/storage/migrations:/data/migrations
|
||||
- ./TFR/storage/uploads:/data/uploads
|
||||
- ./TFR/storage/logs:/data/logs
|
||||
environment:
|
||||
FLASK_KEY: ${THE_FRONT_ROOMS_SECRETE_KEY}
|
||||
DB_USER: ${POSTGRES_USER}
|
||||
|
|
Loading…
Add table
Reference in a new issue