mirror of
https://github.com/wolfswolke/DeathGarden_API_Rebirth.git
synced 2026-09-08 09:06:32 -05:00
Removed print Statements and started moving to mongo list handler for db.
This commit is contained in:
@@ -16,11 +16,9 @@ def gamenews():
|
||||
messageType = request.args.get('messageType')
|
||||
faction = request.args.get('faction')
|
||||
playerLevel = request.args.get('playerLevel')
|
||||
print("Responded to game news api call GET")
|
||||
output = json.load(open(os.path.join(app.root_path, "json", "placeholders", "gamenews.json"), "r"))
|
||||
return jsonify(output)
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-Game-News", message=e)
|
||||
@@ -30,10 +28,8 @@ def gamenews():
|
||||
def config_ver_latest_client_data():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to config ver latest client data api call GET")
|
||||
return jsonify({"LatestSupportedVersion": "te-18f25613-36778-ue4-374f864b"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-ver-latest-data", message=e)
|
||||
@@ -41,13 +37,11 @@ def config_ver_latest_client_data():
|
||||
|
||||
@app.route("/api/v1/utils/contentVersion/latest/<version>", methods=["GET"])
|
||||
def content_version_latest(version):
|
||||
print("Versions = " + version)
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to content version api call GET")
|
||||
return jsonify({"LatestSupportedVersion": "te-18f25613-36778-ue4-374f864b"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-content-version", message=e)
|
||||
@@ -57,11 +51,9 @@ def content_version_latest(version):
|
||||
def gameservers_dev():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to Gameserver event api call POST")
|
||||
# logger.graylog_logger(level="info", handler="logging_gameservers-dev", message=request.get_json())
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-gameserver-dev", message=e)
|
||||
@@ -71,15 +63,12 @@ def gameservers_dev():
|
||||
def gameservers_uat():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to Gameserver event api call POST")
|
||||
# graylog_logger(request.get_json(), "warning")
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
# logger.graylog_logger(level="error", handler="general-gameserver-dev", message=f"Error in gameservers_dev: {e}")
|
||||
print(e)
|
||||
logger.graylog_logger(level="error", handler="general-gameserver-dev", message=e)
|
||||
return jsonify({"status": "error"})
|
||||
|
||||
|
||||
@@ -87,24 +76,20 @@ def gameservers_uat():
|
||||
def gameservers_live():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to Gameserver event api call X")
|
||||
# graylog_logger(request.get_json(), "warning")
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-gameserver-dev", message=e)
|
||||
|
||||
|
||||
@app.route("/api/v1/config/UseMirrorsMM_Steam", methods=["GET"]) # What is this even???
|
||||
@app.route("/api/v1/config/UseMirrorsMM_Steam", methods=["GET"]) # What is this even???
|
||||
def config_use_mirrors_mm_steam():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to config use mirrors mm steam api call GET")
|
||||
return jsonify({"status": "success", "value": "true"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-use-mirrors-mm-steam", message=e)
|
||||
@@ -114,10 +99,8 @@ def config_use_mirrors_mm_steam():
|
||||
def crashreporter_ping():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to crashreporter ping api call GET")
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-crashreporter-ping", message=e)
|
||||
@@ -129,7 +112,6 @@ def tex_get():
|
||||
try:
|
||||
return jsonify({"current-event": {}, "status": {}, "id": "live", "message": "Warning msg 1"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-tex", message=e)
|
||||
@@ -142,7 +124,6 @@ def favicon():
|
||||
return send_from_directory(os.path.join(app.root_path, 'image'), 'favicon.ico',
|
||||
mimetype='image/vnd.microsoft.icon')
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-favicon", message=e)
|
||||
@@ -156,7 +137,6 @@ def healthcheck():
|
||||
return jsonify({"Health": "Alive"})
|
||||
# {"Health": "Alive"}
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-healthcheck", message=e)
|
||||
@@ -166,13 +146,11 @@ def healthcheck():
|
||||
def services_tex():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to tex api call GET")
|
||||
return {"current-event": {"status": {"id": "live"}, "message": ""}} # Alpha 2 WARNING Msg text?!?!
|
||||
#return jsonify({"status": "success", "online": "true", "Version": "te-18f25613-36778-ue4-374f864b",
|
||||
return {"current-event": {"status": {"id": "live"}, "message": ""}} # Alpha 2 WARNING Msg text?!?!
|
||||
# return jsonify({"status": "success", "online": "true", "Version": "te-18f25613-36778-ue4-374f864b",
|
||||
# "ProjectID": "F72FA5E64FA43E878DC72896AD677FB5",
|
||||
# "DefaultFactoryName": "HttpNetworkReplayStreaming", "ServeMatchDelayInMin": "30.0f"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-services-tex", message=e)
|
||||
@@ -186,18 +164,19 @@ def consent_eula():
|
||||
userid = request.cookies.get('bhvrSession')
|
||||
try:
|
||||
mongo.eula(userId=userid, get_eula=False, server=mongo_host, db=mongo_db, collection=mongo_collection)
|
||||
print("Responded to consent eula api call PUT")
|
||||
return jsonify({"isGiven": True})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-consent-eula", message=f"Error in consent_eula: {e}")
|
||||
logger.graylog_logger(level="error", handler="general-consent-eula",
|
||||
message=f"Error in consent_eula: {e}")
|
||||
elif request.method == "GET":
|
||||
if request.cookies.get('bhvrSession') is None:
|
||||
return jsonify({"isGiven": True})
|
||||
userid = request.cookies.get('bhvrSession')
|
||||
is_given = mongo.eula(userId=userid, get_eula=True, server=mongo_host, db=mongo_db, collection=mongo_collection)
|
||||
login_cookie = request.cookies.get('bhvrSession')
|
||||
is_given = mongo.get_data_with_list(login=login_cookie, login_steam=False,
|
||||
items={"eula"},
|
||||
server=mongo_host, db=mongo_db, collection=mongo_collection)
|
||||
if is_given:
|
||||
return jsonify({"isGiven": True})
|
||||
else:
|
||||
@@ -210,11 +189,9 @@ def consent_eula():
|
||||
def consent_eula0():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to consent eula api call GET")
|
||||
output = json.load(open(os.path.join(app.root_path, "json", "eula.json"), "r"))
|
||||
return jsonify(output)
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-consent-eula0", message=e)
|
||||
@@ -224,11 +201,9 @@ def consent_eula0():
|
||||
def privacy_policy():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to consent privacyPolicy api call GET")
|
||||
output = json.load(open(os.path.join(app.root_path, "json", "eula.json"), "r"))
|
||||
return jsonify(output)
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-privacy-policy", message=e)
|
||||
@@ -238,10 +213,6 @@ def privacy_policy():
|
||||
def file_gold_rush(seed, map_name, game_version):
|
||||
get_remote_ip()
|
||||
|
||||
print(game_version)
|
||||
print(seed)
|
||||
print(map_name)
|
||||
|
||||
file_name = f"{game_version}_{seed}_{map_name}.raw"
|
||||
folder_path = os.path.join(app.root_path, "map_seeds")
|
||||
file_path = os.path.join(folder_path, file_name)
|
||||
@@ -264,16 +235,14 @@ def file_gold_rush(seed, map_name, game_version):
|
||||
def leaderboard_get_scores():
|
||||
get_remote_ip()
|
||||
if request.method == "POST":
|
||||
print("Responded to leaderboard getScores api call POST")
|
||||
logger.graylog_logger(level="info", handler="general-leaderboard-get-scores", message=f"Leaderboard getScores: {request.get_json()}")
|
||||
logger.graylog_logger(level="info", handler="general-leaderboard-get-scores",
|
||||
message=f"Leaderboard getScores: {request.get_json()}")
|
||||
data = json.load(open(os.path.join(app.root_path, "json", "placeholders", "leaderboard.json"), "r"))
|
||||
return jsonify(data)
|
||||
else:
|
||||
try:
|
||||
print("Responded to leaderboard getScores api call GET")
|
||||
return jsonify({"data": []})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="general-leaderboard-get-scores", message=e)
|
||||
@@ -289,12 +258,9 @@ def submit():
|
||||
def get_quitter_state():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to get quitter state api call POST")
|
||||
logger.graylog_logger(level="info", handler="logging_getQuitterState", message=request.get_json())
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="logging_getQuitterState", message=e)
|
||||
|
||||
|
||||
@@ -5,12 +5,10 @@ from flask_definitions import *
|
||||
def receive_event():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to Metrics api call POST")
|
||||
data = request.get_json()
|
||||
logger.graylog_logger(level="info", handler="logging_client_Event", message=data)
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="logging_client_Event", message=e)
|
||||
@@ -24,7 +22,6 @@ def metrics_httplog_event():
|
||||
logger.graylog_logger(level="info", handler="logging_httplog_Event", message=data)
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="logging_httplog_Event", message=e)
|
||||
@@ -34,12 +31,10 @@ def metrics_httplog_event():
|
||||
def analytics_post():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to analytics api call POST")
|
||||
data = request.get_json()
|
||||
logger.graylog_logger(level="info", handler="logging_gameDataAnalytics", message=data)
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="logging_gameDataAnalytics", message=e)
|
||||
@@ -49,12 +44,10 @@ def analytics_post():
|
||||
def analytics_batch_post():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to analytics batch api call POST")
|
||||
data = request.get_json()
|
||||
logger.graylog_logger(level="info", handler="logging_gameDataAnalyticsBatch", message=data)
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="logging_gameDataAnalyticsBatch", message=e)
|
||||
@@ -64,11 +57,9 @@ def analytics_batch_post():
|
||||
def me_rich_presence():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to me rich presence api call POST")
|
||||
logger.graylog_logger(level="info", handler="logging_meRichPresence", message=request.get_json())
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="logging_meRichPresence", message=e)
|
||||
@@ -78,11 +69,9 @@ def me_rich_presence():
|
||||
def metrics_server_event():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to metrics server event api call POST")
|
||||
logger.graylog_logger(level="info", handler="logging_server_Event", message=request.get_json())
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="logging_server_Event", message=e)
|
||||
@@ -92,11 +81,9 @@ def metrics_server_event():
|
||||
def crashreporter_check_report():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to crashreporter check report api call POST")
|
||||
# TODO: Add Crashreporter
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="logging_crashreporter_CheckReport", message=e)
|
||||
@@ -106,11 +93,9 @@ def crashreporter_check_report():
|
||||
def metrics_matchmaking_event():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to metrics matchmaking event api call POST")
|
||||
logger.graylog_logger(level="info", handler="logging_matchmaking_Event", message=request.get_json())
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="logging_matchmaking_Event", message=e)
|
||||
|
||||
@@ -10,10 +10,8 @@ import uuid
|
||||
def match_making_regions_raw():
|
||||
get_remote_ip()
|
||||
try:
|
||||
# print(request.json)
|
||||
return jsonify(["EU", "US", "AP"])
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="matchmaking_RegionsRAW", message=e)
|
||||
@@ -50,12 +48,6 @@ def queue():
|
||||
user_id = request.cookies.get("bhvrSession")
|
||||
spoofed_match_id = "0051681e-72ce-46f0-bda2-752e471d0d08"
|
||||
epoch = datetime.now().timestamp()
|
||||
print("###################################")
|
||||
print("DEBUG")
|
||||
print(request.get_json())
|
||||
print(user_id)
|
||||
print("###################################")
|
||||
|
||||
logger.graylog_logger(level="info", handler="logging_queue", message=f"User {user_id} is queueing for {category} in {region} with {count_a} hunters and {count_b} runners")
|
||||
|
||||
# return {"status":"QUEUED","queueData":{"ETA":-10000,"position":0,"stable":False}}
|
||||
@@ -67,10 +59,6 @@ def queue():
|
||||
# if data is None:
|
||||
# print("No match found")
|
||||
# # PlaceHolder for If User not in private match
|
||||
print("DEBUG")
|
||||
print(game_mode)
|
||||
print("###################################")
|
||||
|
||||
if user_id == "619d6f42-db87-4f3e-8dc9-3c9995613614":
|
||||
return jsonify({"status": "MATCHED", "QueueData":{"Position":0, "ETA":0, "Stable": False, "SizeA":1, "SizeB":4},
|
||||
"MatchData": {"MatchId": spoofed_match_id, "Category": category, "Rank": rank,
|
||||
@@ -142,7 +130,6 @@ def match(matchid):
|
||||
|
||||
@app.route("/api/v1/match/<matchid>/Kill", methods=["PUT"])
|
||||
def match_kill(matchid):
|
||||
print(matchid)
|
||||
return jsonify({"status": "OK"})
|
||||
|
||||
@app.route("/api/v1/match/<match_id>/register", methods=["POST"])
|
||||
@@ -203,11 +190,9 @@ def match_create():
|
||||
def progression_player_end_of_match():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to progression player end of match api call POST")
|
||||
logger.graylog_logger(level="info", handler="matchmaking_playerEndOfMatch", message=request.get_json())
|
||||
return jsonify("", 204)
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="matchmaking_playerEndOfMatch", message=e)
|
||||
|
||||
@@ -4,14 +4,12 @@ from flask_definitions import *
|
||||
# Do NOT change Result to ANYTHING or Add anything before it. Game will crash. Doesnt mean it 100% works tho XD
|
||||
@app.route("/<game_version>/catalog", methods=["GET"])
|
||||
def catalog_get(game_version):
|
||||
print("Game Version of Catalog: " + game_version)
|
||||
get_remote_ip()
|
||||
try:
|
||||
output = json.load(open(os.path.join(app.root_path, "json", "catalog", game_version, "catalog.json"), "r"))
|
||||
return jsonify(output)
|
||||
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="catalog", message=e)
|
||||
|
||||
@@ -38,7 +38,6 @@ def steam_login_function():
|
||||
"expire": expire_time,
|
||||
"userId": userid, "token": token})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="steam_login", message=e)
|
||||
@@ -50,10 +49,6 @@ def steam_login():
|
||||
# Read Doc\SteamAuth.md for more information
|
||||
ip = get_remote_ip()
|
||||
user_agent = request.headers.get('User-Agent')
|
||||
print("####################################################")
|
||||
print("USER AGENT: " + user_agent)
|
||||
print("####################################################")
|
||||
|
||||
if user_agent.startswith("TheExit/++UE4+Release-4.2"):
|
||||
if request.args.get(
|
||||
'token') == "140000007B7B7B7B02000000E3FA3952010010017B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B7B":
|
||||
@@ -91,7 +86,9 @@ def steam_login():
|
||||
def modifiers():
|
||||
get_remote_ip()
|
||||
userid = request.cookies.get("bhvrSession")
|
||||
steamid, token = mongo.get_user_info(userId=userid, server=mongo_host, db=mongo_db, collection=mongo_collection)
|
||||
steamid, token = mongo.get_data_with_list(login=userid, login_steam=False,
|
||||
items={"token", "steamid"}, server=mongo_host, db=mongo_db,
|
||||
collection=mongo_collection)
|
||||
try:
|
||||
return jsonify({"TokenId": token, "UserId": userid, "RoleIds": ["759E44DD-469C2841-75C2D6A1-AB0B0FA7",
|
||||
"606129DC-45AB9D16-B69E2FA5-C99A9835"]})
|
||||
@@ -107,16 +104,16 @@ def moderation_check_username():
|
||||
get_remote_ip()
|
||||
try:
|
||||
request_var = request.get_json()
|
||||
print(str(request_var))
|
||||
userid = request_var["userId"]
|
||||
username = request_var["username"]
|
||||
logger.graylog_logger(level="info", handler="moderation_check_username", message=request.get_json())
|
||||
steamid, token = mongo.get_user_info(userId=userid, server=mongo_host, db=mongo_db, collection=mongo_collection)
|
||||
steamid, token = mongo.get_data_with_list(login=userid, login_steam=False,
|
||||
items={"token", "steamid"}, server=mongo_host, db=mongo_db,
|
||||
collection=mongo_collection)
|
||||
return jsonify({"Id": userid, "Token": token,
|
||||
"Provider": {"ProviderName": username,
|
||||
"ProviderId": steamid}}) # CLIENT:{"userId": "ID-ID-ID-ID-SEE-AUTH", "username": "Name-Name-Name"}
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="moderation_check_username", message=e)
|
||||
@@ -125,8 +122,6 @@ def moderation_check_username():
|
||||
# Doesn't work
|
||||
@app.route("/api/v1/progression/experience", methods=["POST"])
|
||||
def progression_experience():
|
||||
if request.json:
|
||||
print(request.get_json())
|
||||
get_remote_ip()
|
||||
try:
|
||||
# graylog_logger(request.get_json(), "info")
|
||||
@@ -155,7 +150,6 @@ def progression_experience():
|
||||
"Data": {"ObjectId": "Hunter.Mass", "Experience": 100, "Version": 1}}
|
||||
]})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="progression_experience", message=e)
|
||||
@@ -187,7 +181,6 @@ def challenges_get_challenges():
|
||||
return jsonify({"status": "error"})
|
||||
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="getChallanges", message=e)
|
||||
@@ -197,7 +190,6 @@ def challenges_get_challenges():
|
||||
def challenges_execute_challenge_progression_operation_batch():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to challenges execute challenge progression operation batch api call POST")
|
||||
logger.graylog_logger(level="info", handler="logging_executeChallengeProgressionOperationBatch",
|
||||
message=request.get_json())
|
||||
return jsonify({"Id": "AssaultRifleWins_HunterWeekly", "Type": 2, "Title": "Hunter_DroneCharger_Name",
|
||||
@@ -206,7 +198,6 @@ def challenges_execute_challenge_progression_operation_batch():
|
||||
[{"Type": "Weekly", "Id": "C90F72FC4D61B1F2FBC73F8A4685EA41", "Amount": 1.0,
|
||||
"Claimed": False}]})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="logging_executeChallengeProgressionOperationBatch",
|
||||
@@ -220,8 +211,6 @@ def inventories():
|
||||
try:
|
||||
page = request.args.get('page', default=0, type=int)
|
||||
limit = request.args.get('limit', default=500, type=int)
|
||||
print("Responded to inventories api call GET")
|
||||
print(request.cookies.get('bhvrSession'))
|
||||
userid = request.cookies.get('bhvrSession')
|
||||
if page == 0:
|
||||
return jsonify({"Code": 200, "Message": "OK", "Data": {"PlayerId": userid, "Inventory": [
|
||||
@@ -259,7 +248,6 @@ def inventories():
|
||||
{"ObjectId": "C1672541-4A4B16B9-AD557C9E-E865D113", "Quantity": 1, "LastUpdateAt": 1687377305}
|
||||
], "NextPage": 0}})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="inventories", message=e)
|
||||
@@ -271,7 +259,6 @@ def progression_groups():
|
||||
get_remote_ip()
|
||||
try:
|
||||
userid = request.headers.get("bhvrSession")
|
||||
print("Responded to progression groups api call GET")
|
||||
# This is the real code but need to build this first
|
||||
# return jsonify({"UserId": userid, "StateName": "Fstring", "Segment": "Fstring", "ObjectId": "Fstring",
|
||||
# "Version": 1111, "schemaVersion": 1111, "Data": {}})
|
||||
@@ -288,7 +275,6 @@ def progression_groups():
|
||||
[{"Level": 5, "Ratio": 0.111}]}
|
||||
]})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="ProgressionGroups", message=e)
|
||||
@@ -305,7 +291,6 @@ def ban_status():
|
||||
items={"is_banned", "ban_reason", "ban_start", "ban_expire"},
|
||||
server=mongo_host, db=mongo_db, collection=mongo_collection)
|
||||
if ban_data == None:
|
||||
print("Error in ban_data_database")
|
||||
return jsonify({"status": "error"})
|
||||
elif ban_data["is_banned"] == True:
|
||||
return jsonify({"IsBanned": ban_data["is_banned"], "BanInfo": {"BanPeriod": 10,
|
||||
@@ -320,10 +305,8 @@ def ban_status():
|
||||
"BanEnd": 0,
|
||||
"Confirmed": False, "Pending": False}})
|
||||
else:
|
||||
print("Error in ban_data_database")
|
||||
return jsonify({"status": "error"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="ban_status", message=e)
|
||||
@@ -334,11 +317,9 @@ def ban_status():
|
||||
def get_ban_info():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to ban status api call GET")
|
||||
return jsonify({"BanPeriod": None, "BanReason": None, "BanStart": None, "BanEnd": None,
|
||||
"Confirmed": False})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="ban_status", message=e)
|
||||
@@ -349,7 +330,6 @@ def get_ban_info():
|
||||
def wallet_currencies():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to wallet currencies api call GET")
|
||||
currencies = mongo.get_data_with_list(login=request.cookies.get("bhvrSession"), login_steam=False,
|
||||
items={"currency_blood_cells", "currency_iron", "currency_ink_cells"},
|
||||
server=mongo_host, db=mongo_db, collection=mongo_collection)
|
||||
@@ -364,7 +344,6 @@ def wallet_currencies():
|
||||
{"Currency": "PROGRESSION_CURRENCY", "Balance": 10000,
|
||||
"CurrencyGroup": "HardCurrencyGroup", "LastRefillTimeStamp": "1684862187"}]})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="currencies", message=e)
|
||||
@@ -375,10 +354,8 @@ def wallet_currencies():
|
||||
def wallet_currencies_progression():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to wallet currencies PROGRESSION_CURRENCY api call GET")
|
||||
return jsonify([{"Currency": 1, "Amount": 10}, {"Currency": 2, "Amount": 10}, {"Currency": 3, "Amount": 10}])
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="currencies", message=e)
|
||||
@@ -401,7 +378,6 @@ def achievements_get():
|
||||
{"apiname": "AAD05B9D46471DC811BBE0BA91916AB7", "achieved": 1, "unlocktime": 1586788872},
|
||||
{"apiname": "BA2D4A5445CB70276A8F5D9E1AFCE080", "achieved": 1, "unlocktime": 1586788872}]})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="Achievment_handler", message=e)
|
||||
@@ -414,7 +390,6 @@ def messages_count():
|
||||
try:
|
||||
return jsonify({"Count": 1})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="messages_count", message=e)
|
||||
@@ -429,7 +404,6 @@ def messages_list():
|
||||
return jsonify(output)
|
||||
return jsonify({"messages": []}) # from dbd
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="messages_list", message=e)
|
||||
@@ -447,7 +421,6 @@ def moderation_check_chat():
|
||||
# Why should we care? Can we get in trouble if we don't?
|
||||
return jsonify({"status": "success", "result": "OK"}) # Testing stuff
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="moderation_check_chat", message=e)
|
||||
@@ -458,7 +431,6 @@ def moderation_check_chat():
|
||||
def extension_progression_init_or_get_groups():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to extension progression init or get groups api call POST")
|
||||
logger.graylog_logger(level="info", handler="logging_initOrGetGroups", message=request.get_json())
|
||||
# Client sends: {"data":{"skipProgressionGroups":false,"skipMetadataGroups":false,"playerName":"Steam-Name-Here"}}
|
||||
# The client cant understand CharacterId for some reason??? But if this is removed the game doesn't load the
|
||||
@@ -514,7 +486,6 @@ def extension_progression_init_or_get_groups():
|
||||
]
|
||||
})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="logging_initOrGetGroups", message=e)
|
||||
@@ -525,11 +496,9 @@ def extension_progression_init_or_get_groups():
|
||||
def inventory_unlock_special_items():
|
||||
get_remote_ip()
|
||||
try:
|
||||
print("Responded to Inventory Unlock Special Items event api call POST")
|
||||
logger.graylog_logger(level="info", handler="unknown_unlockSpecialItems", message=request.get_json())
|
||||
return jsonify({"UnlockedItems": ["9F54DE7A-4E15935B-503850A1-27B0A2A4"]})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="unknown_unlockSpecialItems", message=e)
|
||||
@@ -543,7 +512,6 @@ def challenges_get_challenge_progression_batch():
|
||||
message=request.get_json())
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
|
||||
except Exception as e:
|
||||
|
||||
@@ -5,7 +5,6 @@ from logic.mongodb_handler import mongo
|
||||
@app.route('/', methods=["GET"])
|
||||
def index():
|
||||
get_remote_ip()
|
||||
print("Index Page")
|
||||
return render_template("index.html")
|
||||
|
||||
|
||||
@@ -76,10 +75,8 @@ def debug_mirrors_write():
|
||||
return jsonify({"status": "error", "message": "Invalid api token"}, 401)
|
||||
|
||||
except TimeoutError:
|
||||
print("Timeout error")
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
print(e)
|
||||
logger.graylog_logger(level="error", handler="logging_debug_mirror_write", message=e)
|
||||
if request.method == "GET":
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
|
||||
@@ -7,8 +7,11 @@ def get_remote_ip():
|
||||
ip_addr = request.environ['REMOTE_ADDR']
|
||||
else:
|
||||
ip_addr = request.environ['HTTP_X_FORWARDED_FOR']
|
||||
print("New Connection from: " + ip_addr)
|
||||
return ip_addr
|
||||
if ip_addr == "127.0.0.1":
|
||||
return
|
||||
else:
|
||||
print("New Connection from: " + ip_addr)
|
||||
return ip_addr
|
||||
|
||||
|
||||
def load_config():
|
||||
|
||||
@@ -58,27 +58,6 @@ class Mongo:
|
||||
logger.graylog_logger(level="error", handler="mongodb_user_db_handler", message=e)
|
||||
return None, None
|
||||
|
||||
def get_user_info(self, userId, server, db, collection):
|
||||
try:
|
||||
self.dyn_server = server
|
||||
self.dyn_db = db
|
||||
self.dyn_collection = collection
|
||||
client = pymongo.MongoClient(self.dyn_server)
|
||||
self.dyn_db = client[self.dyn_db]
|
||||
self.dyn_collection = self.dyn_db[self.dyn_collection]
|
||||
existing_document = self.dyn_collection.find_one({'userId': userId})
|
||||
|
||||
if existing_document:
|
||||
steamid = existing_document['steamid']
|
||||
token = existing_document['token']
|
||||
return steamid, token
|
||||
else:
|
||||
print(f"No user found with userId: {userId}")
|
||||
return "10000000aa000000gg00001", "10000000aa000000gg00001"
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="mongodb_get_user_info", message=e)
|
||||
return None, None
|
||||
|
||||
def eula(self, userId, get_eula, server, db, collection):
|
||||
try:
|
||||
self.dyn_server = server
|
||||
@@ -96,10 +75,9 @@ class Mongo:
|
||||
self.dyn_collection.update_one({'userId': userId}, {'$set': {'eula': True}})
|
||||
return True
|
||||
else:
|
||||
print(f"No user found with userId: {userId}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(e)
|
||||
logger.graylog_logger(level="error", handler="mongodb_eula", message=e)
|
||||
return None, None
|
||||
|
||||
def get_debug(self, steamid, server, db, collection):
|
||||
@@ -116,7 +94,7 @@ class Mongo:
|
||||
else:
|
||||
return None
|
||||
except Exception as e:
|
||||
print(e)
|
||||
logger.graylog_logger(level="error", handler="mongodb_get_debug", message=e)
|
||||
return {"status": "error", "message": "Error in mongodb_handler"}
|
||||
|
||||
def get_data_with_list(self, login, login_steam, items, server, db, collection):
|
||||
|
||||
Reference in New Issue
Block a user