mirror of
https://github.com/wolfswolke/DeathGarden_API_Rebirth.git
synced 2026-07-06 19:55:26 -05:00
changed to check_for_game_client for "security"
This commit is contained in:
parent
a2ff38dc34
commit
46be993ff1
|
|
@ -4,6 +4,7 @@ from logic.time_handler import get_time
|
|||
|
||||
@app.route("/debug/", methods=["Get"])
|
||||
def debug_root():
|
||||
check_for_game_client("soft")
|
||||
endpoint_descriptions = {
|
||||
'/debug/user': 'Endpoint to debug user information',
|
||||
'/debug/time': 'Endpoint to debug Epoch Time'}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ from logic.mongodb_handler import mongo
|
|||
|
||||
@app.route("/gamenews/messages", methods=["GET"])
|
||||
def gamenews():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
# /gamenews/messages?sortDesc=true&gameVersion=0&platform=PC&language=EN&messageType=InGameNews&faction=Runner&playerLevel=1
|
||||
try:
|
||||
sort_desc = request.args.get('sortDesc')
|
||||
|
|
@ -26,7 +28,9 @@ def gamenews():
|
|||
|
||||
@app.route("/api/v1/config/VER_LATEST_CLIENT_DATA", methods=["GET"])
|
||||
def config_ver_latest_client_data():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
return jsonify({"LatestSupportedVersion": "te-18f25613-36778-ue4-374f864b"})
|
||||
except TimeoutError:
|
||||
|
|
@ -37,99 +41,12 @@ def config_ver_latest_client_data():
|
|||
|
||||
@app.route("/api/v1/utils/contentVersion/latest/<version>", methods=["GET"])
|
||||
def content_version_latest(version):
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
print("Responded to content version api call GET")
|
||||
return jsonify({"availableVersions": {"5.5.0_529855dev": "5.5.0_529855dev-1644265094",
|
||||
"6.6.0_1091934dev": "6.6.0_1091934dev-1680028709",
|
||||
"6.7.0_1244914dev": "6.7.0_1244914dev-1686157047",
|
||||
"7.0.0_1269265dev": "7.0.0_1269265dev-1688489919",
|
||||
"7.1.0_1273986dev": "7.1.0_1273986dev-1688568602",
|
||||
"7.1.0_1274117dev": "7.1.0_1274117dev-1688574101",
|
||||
"7.1.0_1274124dev": "7.1.0_1274124dev-1688574720",
|
||||
"7.1.0_1274234dev": "7.1.0_1274234dev-1688579224",
|
||||
"7.1.0_1274943dev": "7.1.0_1274943dev-1688657816",
|
||||
"7.1.0_1275139dev": "7.1.0_1275139dev-1688665451",
|
||||
"7.1.0_1275191dev": "7.1.0_1275191dev-1688667321",
|
||||
"7.1.0_1275245dev": "7.1.0_1275245dev-1688668372",
|
||||
"7.1.0_1275256dev": "7.1.0_1275256dev-1688669209",
|
||||
"7.2.0_1269696dev": "7.2.0_1269696dev-1688511907",
|
||||
"7.2.0_1274208dev": "7.2.0_1274208dev-1688578186",
|
||||
"7.2.0_1274225dev": "7.2.0_1274225dev-1688578617",
|
||||
"7.2.0_1274762dev": "7.2.0_1274762dev-1688651417",
|
||||
"7.2.0_1274768dev": "7.2.0_1274768dev-1688651827",
|
||||
"7.2.0_1274865dev": "7.2.0_1274865dev-1688655571",
|
||||
"7.2.0_1274930dev": "7.2.0_1274930dev-1688656773",
|
||||
"7.2.0_1275015dev": "7.2.0_1275015dev-1688660110",
|
||||
"7.2.0_1275045dev": "7.2.0_1275045dev-1688661324",
|
||||
"7.2.0_1275275dev": "7.2.0_1275275dev-1688669004",
|
||||
"7.2.0_1275518dev": "7.2.0_1275518dev-1688678079",
|
||||
"7.2.0_1275550dev": "7.2.0_1275550dev-1688678716",
|
||||
"7.3.0_1274067dev": "7.3.0_1274067dev-1688571863",
|
||||
"7.3.0_1274074dev": "7.3.0_1274074dev-1688572269",
|
||||
"7.3.0_1275510dev": "7.3.0_1275510dev-1688678288",
|
||||
"7.4.0_1248745dev": "7.4.0_1248745dev-1686588297",
|
||||
"7.5.0_1249994dev": "7.5.0_1249994dev-1686681980",
|
||||
"9999.0.0_609872dev": "9999.0.0_609872dev-1660659418",
|
||||
"9999.10.0_1265497dev": "9999.10.0_1265497dev-1687899211",
|
||||
"9999.11.0_657407dev": "9999.11.0_657407dev-1669385085",
|
||||
"9999.12.0_694236dev": "9999.12.0_694236dev-1676299372",
|
||||
"9999.13.0_1091319dev": "9999.13.0_1091319dev-1680005487",
|
||||
"9999.14.0_762536dev": "9999.14.0_762536dev-1677681328",
|
||||
"9999.15.0_763076dev": "9999.15.0_763076dev-1677688243",
|
||||
"9999.16.0_877270dev": "9999.16.0_877270dev-1677704562",
|
||||
"9999.17.0_1274055dev": "9999.17.0_1274055dev-1688571229",
|
||||
"9999.17.0_1274062dev": "9999.17.0_1274062dev-1688571650",
|
||||
"9999.17.0_1274136dev": "9999.17.0_1274136dev-1688575745",
|
||||
"9999.17.0_1274145dev": "9999.17.0_1274145dev-1688576013",
|
||||
"9999.17.0_1274226dev": "9999.17.0_1274226dev-1688579020",
|
||||
"9999.17.0_1274249dev": "9999.17.0_1274249dev-1688579726",
|
||||
"9999.17.0_1275007dev": "9999.17.0_1275007dev-1688660890",
|
||||
"9999.17.0_1275145dev": "9999.17.0_1275145dev-1688666088",
|
||||
"9999.17.0_1275180dev": "9999.17.0_1275180dev-1688666695",
|
||||
"9999.17.0_1275234dev": "9999.17.0_1275234dev-1688668154",
|
||||
"9999.17.0_1275240dev": "9999.17.0_1275240dev-1688668787",
|
||||
"9999.17.0_1275286dev": "9999.17.0_1275286dev-1688669831",
|
||||
"9999.17.0_1275312dev": "9999.17.0_1275312dev-1688670220",
|
||||
"9999.17.0_1275323dev": "9999.17.0_1275323dev-1688670523",
|
||||
"9999.17.0_1275398dev": "9999.17.0_1275398dev-1688673817",
|
||||
"9999.18.0_1269657dev": "9999.18.0_1269657dev-1688509288",
|
||||
"9999.18.0_1273987dev": "9999.18.0_1273987dev-1688568396",
|
||||
"9999.18.0_1273989dev": "9999.18.0_1273989dev-1688568812",
|
||||
"9999.18.0_1274127dev": "9999.18.0_1274127dev-1688574928",
|
||||
"9999.18.0_1274134dev": "9999.18.0_1274134dev-1688575537",
|
||||
"9999.18.0_1274392dev": "9999.18.0_1274392dev-1688588936",
|
||||
"9999.18.0_1274959dev": "9999.18.0_1274959dev-1688657611",
|
||||
"9999.18.0_1274961dev": "9999.18.0_1274961dev-1688658223",
|
||||
"9999.18.0_1275143dev": "9999.18.0_1275143dev-1688665667",
|
||||
"9999.18.0_1275165dev": "9999.18.0_1275165dev-1688666491",
|
||||
"9999.18.0_1275199dev": "9999.18.0_1275199dev-1688667115",
|
||||
"9999.18.0_1275200dev": "9999.18.0_1275200dev-1688667940",
|
||||
"9999.18.0_1275247dev": "9999.18.0_1275247dev-1688668583",
|
||||
"9999.18.0_1275271dev": "9999.18.0_1275271dev-1688669627",
|
||||
"9999.19.0_1091258dev": "9999.19.0_1091258dev-1679951263",
|
||||
"9999.2.0_481897dev": "9999.2.0_481897dev-1632318120",
|
||||
"9999.20.0_1092886dev": "9999.20.0_1092886dev-1680114849",
|
||||
"9999.21.0_1274992dev": "9999.21.0_1274992dev-1688658975",
|
||||
"9999.21.0_1275004dev": "9999.21.0_1275004dev-1688660446",
|
||||
"9999.3.0_478415dev": "9999.3.0_478415dev-1631543750",
|
||||
"9999.4.0_569535dev": "9999.4.0_569535dev-1652383024",
|
||||
"9999.5.0_1245806dev": "9999.5.0_1245806dev-1686163729",
|
||||
"9999.6.0_644076dev": "9999.6.0_644076dev-1666886965",
|
||||
"9999.7.0_638225dev": "9999.7.0_638225dev-1666023431",
|
||||
"9999.8.0_584495dev": "9999.8.0_584495dev-1657129066",
|
||||
"cauclair_7.3.0_0dev": "cauclair_7.3.0_0dev-1688497884",
|
||||
"fprevost_7.1.0_0dev": "fprevost_7.1.0_0dev-1688407952",
|
||||
"jescalante_7.3.0_0dev": "jescalante_7.3.0_0dev-1688673951",
|
||||
"jkfisera_7.1.0_0dev": "jkfisera_7.1.0_0dev-1688587429",
|
||||
"jkfisera_9999.17.0_0dev": "jkfisera_9999.17.0_0dev-1688578389",
|
||||
"m_4.4.0_402831dev": "m_4.4.0_402831dev-1614200535",
|
||||
"m_5.1.0_486821dev": "m_5.1.0_486821dev-1633535415",
|
||||
"m_5.2.0_501889dev": "m_5.2.0_501889dev-1637331411",
|
||||
"m_5.4.0_633895dev": "m_5.4.0_633895dev-1665499070",
|
||||
"m_5.4.1_689083dev": "m_5.4.1_689083dev-1675261407",
|
||||
"mcharron_7.0.0_0dev": "mcharron_7.0.0_0dev-1688493123"}})
|
||||
# return jsonify({"LatestSupportedVersion": "te-18f25613-36778-ue4-374f864b"})
|
||||
return jsonify({"LatestSupportedVersion": "te-18f25613-36778-ue4-374f864b"})
|
||||
except TimeoutError:
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
|
|
@ -138,7 +55,9 @@ def content_version_latest(version):
|
|||
|
||||
@app.route("/gameservers.dev", methods=["POST", "GET"])
|
||||
def gameservers_dev():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
# logger.graylog_logger(level="info", handler="logging_gameservers-dev", message=request.get_json())
|
||||
return jsonify({"status": "success"})
|
||||
|
|
@ -150,7 +69,9 @@ def gameservers_dev():
|
|||
|
||||
@app.route("/gameservers.uat", methods=["POST"])
|
||||
def gameservers_uat():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
# graylog_logger(request.get_json(), "warning")
|
||||
return jsonify({"status": "success"})
|
||||
|
|
@ -163,7 +84,9 @@ def gameservers_uat():
|
|||
|
||||
@app.route("/gameservers.live", methods=["POST", "GET"])
|
||||
def gameservers_live():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
# graylog_logger(request.get_json(), "warning")
|
||||
return jsonify({"status": "success"})
|
||||
|
|
@ -175,7 +98,9 @@ def gameservers_live():
|
|||
|
||||
@app.route("/api/v1/config/UseMirrorsMM_Steam", methods=["GET"]) # What is this even???
|
||||
def config_use_mirrors_mm_steam():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
return jsonify({"status": "success", "value": "true"})
|
||||
except TimeoutError:
|
||||
|
|
@ -186,7 +111,7 @@ def config_use_mirrors_mm_steam():
|
|||
|
||||
@app.route("/crashreport/unreal/CrashReporter/Ping", methods=["GET"])
|
||||
def crashreporter_ping():
|
||||
get_remote_ip()
|
||||
check_for_game_client("soft")
|
||||
try:
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
|
|
@ -197,7 +122,7 @@ def crashreporter_ping():
|
|||
|
||||
@app.route("/tex", methods=["GET"])
|
||||
def tex_get():
|
||||
get_remote_ip()
|
||||
check_for_game_client("soft")
|
||||
try:
|
||||
return jsonify({"current-event": {}, "status": {}, "id": "live", "message": "Warning msg 1"})
|
||||
except TimeoutError:
|
||||
|
|
@ -208,7 +133,7 @@ def tex_get():
|
|||
|
||||
@app.route('/favicon.ico')
|
||||
def favicon():
|
||||
get_remote_ip()
|
||||
check_for_game_client("soft")
|
||||
try:
|
||||
return send_from_directory(os.path.join(app.root_path, 'image'), 'favicon.ico',
|
||||
mimetype='image/vnd.microsoft.icon')
|
||||
|
|
@ -220,7 +145,7 @@ def favicon():
|
|||
|
||||
@app.route("/api/v1/healthcheck", methods=["GET"])
|
||||
def healthcheck():
|
||||
get_remote_ip()
|
||||
check_for_game_client("soft")
|
||||
try:
|
||||
# return jsonify({"status": "success", "online": "true"})
|
||||
return jsonify({"Health": "Alive"})
|
||||
|
|
@ -233,7 +158,6 @@ def healthcheck():
|
|||
|
||||
@app.route("/api/v1/services/tex")
|
||||
def services_tex():
|
||||
get_remote_ip()
|
||||
try:
|
||||
return {"current-event": {"status": {"id": "live"}, "message": ""}} # Alpha 2 WARNING Msg text?!?!
|
||||
# return jsonify({"status": "success", "online": "true", "Version": "te-18f25613-36778-ue4-374f864b",
|
||||
|
|
@ -247,7 +171,9 @@ def services_tex():
|
|||
|
||||
@app.route("/api/v1/consent/eula2", methods=["PUT", "GET"])
|
||||
def consent_eula():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
if request.method == "PUT":
|
||||
userid = request.cookies.get('bhvrSession')
|
||||
|
|
@ -276,7 +202,9 @@ def consent_eula():
|
|||
|
||||
@app.route("/api/v1/consent/eula", methods=["GET"])
|
||||
def consent_eula0():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
output = json.load(open(os.path.join(app.root_path, "json", "eula.json"), "r"))
|
||||
return jsonify(output)
|
||||
|
|
@ -288,7 +216,9 @@ def consent_eula0():
|
|||
|
||||
@app.route("/api/v1/consent/privacyPolicy", methods=["GET"])
|
||||
def privacy_policy():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
output = json.load(open(os.path.join(app.root_path, "json", "eula.json"), "r"))
|
||||
return jsonify(output)
|
||||
|
|
@ -298,31 +228,11 @@ def privacy_policy():
|
|||
logger.graylog_logger(level="error", handler="general-privacy-policy", message=e)
|
||||
|
||||
|
||||
@app.route("/file/<game_version>/<seed>/<map_name>", methods=["POST", "GET"])
|
||||
def file_gold_rush(seed, map_name, game_version):
|
||||
get_remote_ip()
|
||||
|
||||
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)
|
||||
os.makedirs(folder_path, exist_ok=True)
|
||||
|
||||
if request.method == "GET":
|
||||
if os.path.isfile(file_path):
|
||||
with open(file_path, "rb") as files:
|
||||
data = files.read()
|
||||
return data
|
||||
|
||||
if request.method == "POST":
|
||||
data = request.get_data()
|
||||
with open(file_path, "wb") as files:
|
||||
files.write(data)
|
||||
return {"status": "success"}
|
||||
|
||||
|
||||
@app.route("/api/v1/extensions/leaderboard/getScores", methods=["GET", "POST"])
|
||||
def leaderboard_get_scores():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
if request.method == "POST":
|
||||
logger.graylog_logger(level="info", handler="general-leaderboard-get-scores",
|
||||
message=f"Leaderboard getScores: {request.get_json()}")
|
||||
|
|
@ -339,13 +249,17 @@ def leaderboard_get_scores():
|
|||
|
||||
@app.route("/submit/", methods=["POST"])
|
||||
def submit():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("soft")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
return "Discarded=1"
|
||||
|
||||
|
||||
@app.route("/api/v1/extensions/quitters/getQuitterState", methods=["POST"])
|
||||
def get_quitter_state():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
logger.graylog_logger(level="info", handler="logging_getQuitterState", message=request.get_json())
|
||||
return jsonify({"status": "success"})
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from flask_definitions import *
|
|||
|
||||
@app.route("/metrics/client/event", methods=["POST"])
|
||||
def receive_event():
|
||||
get_remote_ip()
|
||||
check_for_game_client()
|
||||
try:
|
||||
data = request.get_json()
|
||||
logger.graylog_logger(level="info", handler="logging_client_Event", message=data)
|
||||
|
|
@ -16,7 +16,7 @@ def receive_event():
|
|||
|
||||
@app.route("/metrics/httplog/event", methods=["POST"])
|
||||
def metrics_httplog_event():
|
||||
get_remote_ip()
|
||||
check_for_game_client()
|
||||
try:
|
||||
data = request.get_json()
|
||||
logger.graylog_logger(level="info", handler="logging_httplog_Event", message=data)
|
||||
|
|
@ -29,7 +29,7 @@ def metrics_httplog_event():
|
|||
|
||||
@app.route("/api/v1/gameDataAnalytics", methods=["POST"])
|
||||
def analytics_post():
|
||||
get_remote_ip()
|
||||
check_for_game_client()
|
||||
try:
|
||||
data = request.get_json()
|
||||
logger.graylog_logger(level="info", handler="logging_gameDataAnalytics", message=data)
|
||||
|
|
@ -42,7 +42,7 @@ def analytics_post():
|
|||
|
||||
@app.route("/api/v1/gameDataAnalytics/batch", methods=["POST"])
|
||||
def analytics_batch_post():
|
||||
get_remote_ip()
|
||||
check_for_game_client()
|
||||
try:
|
||||
data = request.get_json()
|
||||
logger.graylog_logger(level="info", handler="logging_gameDataAnalyticsBatch", message=data)
|
||||
|
|
@ -55,7 +55,7 @@ def analytics_batch_post():
|
|||
|
||||
@app.route("/api/v1/me/richPresence", methods=["POST"])
|
||||
def me_rich_presence():
|
||||
get_remote_ip()
|
||||
check_for_game_client()
|
||||
try:
|
||||
logger.graylog_logger(level="info", handler="logging_meRichPresence", message=request.get_json())
|
||||
return jsonify({"status": "success"})
|
||||
|
|
@ -67,7 +67,7 @@ def me_rich_presence():
|
|||
|
||||
@app.route("/metrics/server/event", methods=["POST"])
|
||||
def metrics_server_event():
|
||||
get_remote_ip()
|
||||
check_for_game_client()
|
||||
try:
|
||||
logger.graylog_logger(level="info", handler="logging_server_Event", message=request.get_json())
|
||||
return jsonify({"status": "success"})
|
||||
|
|
@ -79,7 +79,7 @@ def metrics_server_event():
|
|||
|
||||
@app.route("/crashreport/unreal/CrashReporter/CheckReport", methods=["POST"])
|
||||
def crashreporter_check_report():
|
||||
get_remote_ip()
|
||||
check_for_game_client()
|
||||
try:
|
||||
# TODO: Add Crashreporter
|
||||
return jsonify({"status": "success"})
|
||||
|
|
@ -87,15 +87,3 @@ def crashreporter_check_report():
|
|||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="logging_crashreporter_CheckReport", message=e)
|
||||
|
||||
|
||||
@app.route("/metrics/matchmaking/event", methods=["POST"])
|
||||
def metrics_matchmaking_event():
|
||||
get_remote_ip()
|
||||
try:
|
||||
logger.graylog_logger(level="info", handler="logging_matchmaking_Event", message=request.get_json())
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="logging_matchmaking_Event", message=e)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ import uuid
|
|||
|
||||
@app.route("/api/v1/config/MATCH_MAKING_REGIONS/raw", methods=["GET"])
|
||||
def match_making_regions_raw():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
return jsonify(["EU", "US", "AP"])
|
||||
except TimeoutError:
|
||||
|
|
@ -21,7 +23,9 @@ def match_making_regions_raw():
|
|||
@app.route("/api/v1/queue/info", methods=["GET"])
|
||||
def queue_info():
|
||||
# ?category=Steam-te-23ebf96c-27498-ue4-7172a3f5&gameMode=Default®ion=US&countA=1&countB=5
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
category = request.args.get("category")
|
||||
game_mode = request.args.get("gameMode")
|
||||
region = request.args.get("region")
|
||||
|
|
@ -34,7 +38,9 @@ def queue_info():
|
|||
def queue():
|
||||
# {"category":"Steam-te-18f25613-36778-ue4-374f864b","rank":1,"side":"B","latencies":[],"additionalUserIds":[],
|
||||
# "checkOnly":false,"gameMode":"08d2279d2ed3fba559918aaa08a73fa8-Default","region":"US","countA":1,"countB":5}
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
|
||||
category = request.json.get("category")
|
||||
rank = request.json.get("rank")
|
||||
|
|
@ -122,6 +128,9 @@ def queue():
|
|||
|
||||
@app.route("/api/v1/match/<matchid>", methods=["GET"])
|
||||
def match(matchid):
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
if matchid == "0051681e-72ce-46f0-bda2-752e471d0d08":
|
||||
return jsonify({"matchId": matchid, "schema": 3,
|
||||
"category": "Steam-te-18f25613-36778-ue4-374f864b",
|
||||
|
|
@ -153,13 +162,19 @@ def match(matchid):
|
|||
|
||||
@app.route("/api/v1/match/<matchid>/Kill", methods=["PUT"])
|
||||
def match_kill(matchid):
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
logger.graylog_logger(level="info", handler="match_kill", message=f"Match {matchid} has been killed")
|
||||
return jsonify({"status": "OK"})
|
||||
|
||||
|
||||
@app.route("/api/v1/match/<match_id>/register", methods=["POST"])
|
||||
def match_register(match_id):
|
||||
try:
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
custom_data = request.get_json("customData")
|
||||
if custom_data["sessionSettings"]:
|
||||
session_settings = custom_data["sessionSettings"]
|
||||
|
|
@ -175,7 +190,9 @@ def match_register(match_id):
|
|||
@app.route("/api/v1/match/<match_id>/Quit", methods=["PUT"])
|
||||
def match_quit(match_id):
|
||||
try:
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
user_id = request.cookies.get("bhvrSession")
|
||||
logger.graylog_logger(level="info", handler="logging_queue",
|
||||
message=f"User {user_id} is quieting match {match_id}")
|
||||
|
|
@ -192,7 +209,9 @@ def match_create():
|
|||
# '0385496c-f0ae-44d3-a777-26092750f39c'],
|
||||
# 'props': {'MatchConfiguration': '/Game/Configuration/MatchConfig/MatchConfig_Demo.MatchConfig_Demo'},
|
||||
# 'latencies': []}
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
|
||||
userid = request.cookies.get("bhvrSession")
|
||||
category = request.json.get("category")
|
||||
|
|
@ -215,7 +234,9 @@ def match_create():
|
|||
|
||||
@app.route("/api/v1/extensions/progression/playerEndOfMatch", methods=["POST"])
|
||||
def progression_player_end_of_match():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
logger.graylog_logger(level="info", handler="matchmaking_playerEndOfMatch", message=request.get_json())
|
||||
return jsonify("", 204)
|
||||
|
|
@ -223,3 +244,42 @@ def progression_player_end_of_match():
|
|||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="matchmaking_playerEndOfMatch", message=e)
|
||||
|
||||
|
||||
@app.route("/file/<game_version>/<seed>/<map_name>", methods=["POST", "GET"])
|
||||
def file_gold_rush(seed, map_name, game_version):
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
|
||||
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)
|
||||
os.makedirs(folder_path, exist_ok=True)
|
||||
|
||||
if request.method == "GET":
|
||||
if os.path.isfile(file_path):
|
||||
with open(file_path, "rb") as files:
|
||||
data = files.read()
|
||||
return data
|
||||
|
||||
if request.method == "POST":
|
||||
data = request.get_data()
|
||||
with open(file_path, "wb") as files:
|
||||
files.write(data)
|
||||
return {"status": "success"}
|
||||
|
||||
|
||||
@app.route("/metrics/matchmaking/event", methods=["POST"])
|
||||
def metrics_matchmaking_event():
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
logger.graylog_logger(level="info", handler="logging_matchmaking_Event", message=request.get_json())
|
||||
return jsonify({"status": "success"})
|
||||
except TimeoutError:
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="logging_matchmaking_Event", message=e)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ 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):
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
output = json.load(open(os.path.join(app.root_path, "json", "catalog", game_version, "catalog.json"), "r"))
|
||||
return jsonify(output)
|
||||
|
|
@ -17,6 +19,7 @@ def catalog_get(game_version):
|
|||
|
||||
@app.errorhandler(404)
|
||||
def debug_404(e):
|
||||
check_for_game_client("soft")
|
||||
logger.graylog_logger(level="error", handler="404-handler", message=f"Path: {request.path} Endpoint: {request.endpoint}")
|
||||
print(e)
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@ def steam_login_function():
|
|||
@app.route("/api/v1/auth/provider/steam/login", methods=["POST"])
|
||||
def steam_login():
|
||||
# Read Doc\SteamAuth.md for more information
|
||||
ip = get_remote_ip()
|
||||
ip = check = check_for_game_client("strict") # ToDo: Change when cookie validation is added.
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
user_agent = request.headers.get('User-Agent')
|
||||
if user_agent.startswith("TheExit/++UE4+Release-4.2"):
|
||||
if request.args.get(
|
||||
|
|
@ -84,7 +86,9 @@ def steam_login():
|
|||
# Dont know if this works
|
||||
@app.route("/api/v1/modifierCenter/modifiers/me", methods=["GET"])
|
||||
def modifiers():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
userid = request.cookies.get("bhvrSession")
|
||||
steamid, token = mongo.get_data_with_list(login=userid, login_steam=False,
|
||||
items={"token", "steamid"}, server=mongo_host, db=mongo_db,
|
||||
|
|
@ -101,7 +105,9 @@ def modifiers():
|
|||
# This works
|
||||
@app.route("/moderation/check/username", methods=["POST"])
|
||||
def moderation_check_username():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
request_var = request.get_json()
|
||||
userid = request_var["userId"]
|
||||
|
|
@ -132,9 +138,11 @@ def moderation_check_username():
|
|||
# Doesn't work
|
||||
@app.route("/api/v1/progression/experience", methods=["POST"])
|
||||
def progression_experience():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
# graylog_logger(request.get_json(), "info")
|
||||
logger.graylog_logger(level="info", handler="user_handling_progression_experience", message=request.get_json())
|
||||
return jsonify({"List": [
|
||||
{"ObjectId": "PlayerProgression", "SchemaVersion": 11122233344, "Version": 11122233345,
|
||||
"Data": {"ObjectId": "PlayerProgression", "Experience": 100, "Version": 1}},
|
||||
|
|
@ -165,11 +173,12 @@ def progression_experience():
|
|||
logger.graylog_logger(level="error", handler="progression_experience", message=e)
|
||||
|
||||
|
||||
# idk dont think it works
|
||||
@app.route("/api/v1/extensions/challenges/getChallenges", methods=["POST"])
|
||||
def challenges_get_challenges():
|
||||
# client: {"data":{"userId":"619d6f42-db87-4f3e-8dc9-3c9995613614","challengeType":"Daily"}}
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
response = request.get_json()
|
||||
challenge_type = response["data"]["challengeType"]
|
||||
|
|
@ -198,7 +207,9 @@ def challenges_get_challenges():
|
|||
|
||||
@app.route("/api/v1/extensions/challenges/executeChallengeProgressionOperationBatch", methods=["POST"])
|
||||
def challenges_execute_challenge_progression_operation_batch():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
logger.graylog_logger(level="info", handler="logging_executeChallengeProgressionOperationBatch",
|
||||
message=request.get_json())
|
||||
|
|
@ -217,7 +228,9 @@ def challenges_execute_challenge_progression_operation_batch():
|
|||
# idk dont think it works
|
||||
@app.route("/api/v1/inventories", methods=["GET"])
|
||||
def inventories():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
page = request.args.get('page', default=0, type=int)
|
||||
limit = request.args.get('limit', default=500, type=int)
|
||||
|
|
@ -266,7 +279,9 @@ def inventories():
|
|||
# idk if this works
|
||||
@app.route("/api/v1/players/me/splinteredstates/ProgressionGroups", methods=["GET"])
|
||||
def progression_groups():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
userid = request.headers.get("bhvrSession")
|
||||
# This is the real code but need to build this first
|
||||
|
|
@ -292,7 +307,9 @@ def progression_groups():
|
|||
# This works
|
||||
@app.route("/api/v1/players/ban/status", methods=["GET"])
|
||||
def ban_status():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
login_cookie = request.cookies.get("bhvrSession")
|
||||
try:
|
||||
time.sleep(0.5)
|
||||
|
|
@ -324,7 +341,9 @@ def ban_status():
|
|||
# broken. no need to fix... OG DG endpoint. Not needed.
|
||||
@app.route("/api/v1/players/ban/getbaninfo", methods=["GET"])
|
||||
def get_ban_info():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
return jsonify({"BanPeriod": None, "BanReason": None, "BanStart": None, "BanEnd": None,
|
||||
"Confirmed": False})
|
||||
|
|
@ -337,7 +356,9 @@ def get_ban_info():
|
|||
# This works
|
||||
@app.route("/api/v1/wallet/currencies", methods=["GET"])
|
||||
def wallet_currencies():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
currencies = mongo.get_data_with_list(login=request.cookies.get("bhvrSession"), login_steam=False,
|
||||
items={"currency_blood_cells", "currency_iron", "currency_ink_cells"},
|
||||
|
|
@ -361,7 +382,9 @@ def wallet_currencies():
|
|||
# Does not work. Old DG endpoint. Not needed.
|
||||
@app.route("/api/v1/wallet/currencies/PROGRESSION_CURRENCY", methods=["GET"])
|
||||
def wallet_currencies_progression():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
return jsonify([{"Currency": 1, "Amount": 10}, {"Currency": 2, "Amount": 10}, {"Currency": 3, "Amount": 10}])
|
||||
except TimeoutError:
|
||||
|
|
@ -373,7 +396,9 @@ def wallet_currencies_progression():
|
|||
# Dont know if this works. Dont think it does.
|
||||
@app.route("/api/v1/players/me/splinteredstates/TheExit_Achievements", methods=["GET"])
|
||||
def achievements_get():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
userid = request.cookies.get("bhvrSession")
|
||||
return jsonify({"UserId": userid, "StateName": "", "Segment": "", "List": [
|
||||
|
|
@ -395,7 +420,9 @@ def achievements_get():
|
|||
# Does not work
|
||||
@app.route("/api/v1/messages/count", methods=["GET"])
|
||||
def messages_count():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
return jsonify({"Count": 1})
|
||||
except TimeoutError:
|
||||
|
|
@ -406,7 +433,9 @@ def messages_count():
|
|||
|
||||
@app.route("/api/v1/messages/list", methods=["GET"])
|
||||
def messages_list():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
limit = request.args.get("limit")
|
||||
output = json.load(open(os.path.join(app.root_path, "json", "placeholders", "messages.json"), "r"))
|
||||
|
|
@ -421,7 +450,9 @@ def messages_list():
|
|||
# Temp response.
|
||||
@app.route("/moderation/check/chat", methods=["POST"])
|
||||
def moderation_check_chat():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
data = request.get_json()
|
||||
userid = data["userId"]
|
||||
|
|
@ -438,7 +469,9 @@ def moderation_check_chat():
|
|||
# This is intently broken. If this works the game crashes in matchmaking.
|
||||
@app.route("/api/v1/extensions/progression/initOrGetGroups", methods=["POST"])
|
||||
def extension_progression_init_or_get_groups():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
logger.graylog_logger(level="info", handler="logging_initOrGetGroups", message=request.get_json())
|
||||
# Client sends: {"data":{"skipProgressionGroups":false,"skipMetadataGroups":false,"playerName":"Steam-Name-Here"}}
|
||||
|
|
@ -502,7 +535,9 @@ def extension_progression_init_or_get_groups():
|
|||
# dont know if this works. Hope it does.
|
||||
@app.route("/api/v1/extensions/inventory/unlockSpecialItems", methods=["POST"])
|
||||
def inventory_unlock_special_items():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
logger.graylog_logger(level="info", handler="unknown_unlockSpecialItems", message=request.get_json())
|
||||
return jsonify({"UnlockedItems": ["9F54DE7A-4E15935B-503850A1-27B0A2A4"]})
|
||||
|
|
@ -514,11 +549,14 @@ def inventory_unlock_special_items():
|
|||
|
||||
@app.route("/api/v1/extensions/challenges/getChallengeProgressionBatch", methods=["POST"])
|
||||
def challenges_get_challenge_progression_batch():
|
||||
get_remote_ip()
|
||||
check = check_for_game_client("strict")
|
||||
if not check:
|
||||
return jsonify({"message": "Endpoint not found"}), 404
|
||||
try:
|
||||
logger.graylog_logger(level="info", handler="logging_getChallengeProgressionBatch",
|
||||
message=request.get_json())
|
||||
return jsonify({"status": "success"})
|
||||
# MirrorsExtModelGetChallengeProgressionBatchResponse -> TArray MirrorsExtModelChallengeProgressionOperation
|
||||
return jsonify({"ProgressionBatch": [{"ChallengeId": "", "OperationName": "", "OperationData": []}]})
|
||||
except TimeoutError:
|
||||
return jsonify({"status": "error"})
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from logic.mongodb_handler import mongo
|
|||
|
||||
@app.route('/', methods=["GET"])
|
||||
def index():
|
||||
get_remote_ip()
|
||||
check_for_game_client()
|
||||
return render_template("index.html")
|
||||
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ def debug_user(steamid):
|
|||
|
||||
@app.route("/debug/mirrors", methods=["POST", "GET"])
|
||||
def debug_mirrors_write():
|
||||
get_remote_ip()
|
||||
check_for_game_client("soft")
|
||||
try:
|
||||
if request.method == "POST":
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from flask import Flask, jsonify, request, send_from_directory, abort, render_template, url_for
|
||||
from logic.global_handlers import get_remote_ip, load_config
|
||||
from logic.global_handlers import check_for_game_client, load_config
|
||||
from logic.logging_handler import logger
|
||||
import json
|
||||
import os
|
||||
|
|
|
|||
|
|
@ -2,13 +2,15 @@ from flask_definitions import *
|
|||
import yaml
|
||||
|
||||
|
||||
def get_remote_ip():
|
||||
def _get_remote_ip():
|
||||
if request.environ.get('HTTP_X_FORWARDED_FOR') is None:
|
||||
ip_addr = request.environ['REMOTE_ADDR']
|
||||
print("New Connection from: " + ip_addr)
|
||||
return ip_addr
|
||||
else:
|
||||
ip_addr = request.environ['HTTP_X_FORWARDED_FOR']
|
||||
if ip_addr == "127.0.0.1":
|
||||
return
|
||||
return None
|
||||
else:
|
||||
print("New Connection from: " + ip_addr)
|
||||
return ip_addr
|
||||
|
|
@ -18,3 +20,26 @@ def load_config():
|
|||
with open('config//api_config.yaml', 'r') as f:
|
||||
config_file = yaml.safe_load(f)
|
||||
return config_file
|
||||
|
||||
|
||||
def check_for_game_client(check_type="strict"):
|
||||
if check_type == "strict":
|
||||
user_agent = request.headers.get('User-Agent')
|
||||
if user_agent.startswith("TheExit/++UE4+Release-4.2"):
|
||||
_get_remote_ip()
|
||||
# logger.graylog_logger(level="info", handler="UserAgents", message=f"User-Agent: {user_agent}")
|
||||
return True
|
||||
elif user_agent.startswith("game=TheExit, engine=UE4, version="):
|
||||
_get_remote_ip()
|
||||
# logger.graylog_logger(level="info", handler="UserAgents", message=f"User-Agent: {user_agent}")
|
||||
return True
|
||||
|
||||
else:
|
||||
_get_remote_ip()
|
||||
# logger.graylog_logger(level="error", handler="UserAgents", message=f"INVALID User-Agent: {user_agent}, "
|
||||
# f"with IP: {_get_remote_ip()}")
|
||||
return False
|
||||
else:
|
||||
_get_remote_ip()
|
||||
return True
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user