Added more favicons for Apple, android etc

This commit is contained in:
ZKWolf 2024-03-28 19:23:19 +01:00
parent 86b3b25067
commit 5f69d77bbe
11 changed files with 320 additions and 2 deletions

View File

@ -40,6 +40,148 @@ def favicon():
logger.graylog_logger(level="error", handler="general-favicon", message=e)
@app.route('/apple-touch-icon.png')
def apple_touch_icon():
check_for_game_client("soft")
try:
return send_from_directory(os.path.join(app.root_path, 'image'), 'apple-touch-icon.png',
mimetype='image/vnd.microsoft.icon')
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="general-apple_touch_icon", message=e)
@app.route('/android-chrome-192x192.png')
def android_chrome_192x192():
check_for_game_client("soft")
try:
return send_from_directory(os.path.join(app.root_path, 'image'), 'android-chrome-192x192.png',
mimetype='image/vnd.microsoft.icon')
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="general-android-chrome-192x192", message=e)
@app.route('/android-chrome-256x256.png')
def android_chrome_256x256():
check_for_game_client("soft")
try:
return send_from_directory(os.path.join(app.root_path, 'image'), 'android-chrome-256x256.png',
mimetype='image/vnd.microsoft.icon')
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="general-android-chrome-256x256", message=e)
@app.route('/browserconfig.xml')
def browserconfig():
check_for_game_client("soft")
try:
return send_from_directory(os.path.join(app.root_path, 'image'), 'browserconfig.xml')
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="general-browserconfig", message=e)
@app.route('/favicon-16x16.png')
def favicon_16x16():
check_for_game_client("soft")
try:
return send_from_directory(os.path.join(app.root_path, 'image'), 'favicon-16x16.png',
mimetype='image/vnd.microsoft.icon')
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="general-favicon-16x16", message=e)
@app.route('/favicon-32x32.png')
def favicon_32x32():
check_for_game_client("soft")
try:
return send_from_directory(os.path.join(app.root_path, 'image'), 'favicon-32x32.png',
mimetype='image/vnd.microsoft.icon')
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="general-favicon-32x32", message=e)
@app.route('/favicon.png')
def favicon_png():
check_for_game_client("soft")
try:
return send_from_directory(os.path.join(app.root_path, 'image'), 'favicon.png',
mimetype='image/vnd.microsoft.icon')
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="general-favicon", message=e)
@app.route('/mstile-150x150.png')
def mstile_150x150():
check_for_game_client("soft")
try:
return send_from_directory(os.path.join(app.root_path, 'image'), 'mstile-150x150.png',
mimetype='image/vnd.microsoft.icon')
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="general-mstile-150x150", message=e)
@app.route('/safari-pinned-tab.svg')
def safari_pinned_tab():
check_for_game_client("soft")
try:
return send_from_directory(os.path.join(app.root_path, 'image'), 'safari-pinned-tab.svg',
mimetype='image/svg+xml')
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="general-safari-pinned-tab", message=e)
@app.route('/site.webmanifest')
def site_webmanifest():
check_for_game_client("soft")
try:
return send_from_directory(os.path.join(app.root_path, 'image'), 'site.webmanifest')
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="general-site.webmanifest", message=e)
@app.route('/apple-touch-icon-precomposed.png')
def apple_touch_icon_precomposed():
check_for_game_client("soft")
try:
return send_from_directory(os.path.join(app.root_path, 'image'), 'favicon.png',
mimetype='image/vnd.microsoft.icon')
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="general-apple-touch-icon-precomposed", message=e)
@app.route('/apple-touch-icon-120x120.png')
def apple_touch_icon_120x120():
check_for_game_client("soft")
try:
return send_from_directory(os.path.join(app.root_path, 'image'), 'favicon.png',
mimetype='image/vnd.microsoft.icon')
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="general-apple-touch-icon-120x120", message=e)
@app.route('/images/icons/fugue/tick-circle.png')
def tick_circle():
try:
@ -311,10 +453,80 @@ def api_debug_matchmaking():
@app.route("/api/sha", methods=["GET"])
def api_sha():
try:
# todo generate this on BOOT
# generate SHA256 of PAK and SIG on boot then save it to a file and return here
hashes = hash_handler.get_hash()
return jsonify({"pak": hashes[0], "sig": hashes[1]})
except Exception as e:
logger.graylog_logger(level="error", handler="web-api-sha", message=e)
return jsonify({"status": "error"}), 500
@app.route("/api/v1/upload", methods=["POST", "GET"])
def upload():
check_for_game_client("soft")
try:
return jsonify({"status": "error", "message": "ENDPOINT WIP"}), 404
if request.method == "POST":
try:
api_token = sanitize_input(request.headers.get("api_token"))
if api_token is None:
return jsonify({"status": "error", "message": "No api token found"}), 401
if api_token not in allowed_tokens:
return jsonify({"status": "error", "message": "Invalid api token"}), 401
file = request.files['file']
user_id = sanitize_input("test")
if not user_id:
return jsonify({"status": "error", "message": "No User ID found."}), 400
if not file:
return jsonify({"status": "error", "message": "No file found."}), 400
file_id = file_handler.create_file(file, user_id)
return jsonify({"status": "success", "file_id": file_id}), 200
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="web-upload", message=e)
if request.method == "GET":
return render_template("debug/upload.html")
except Exception as e:
logger.graylog_logger(level="error", handler="web-upload", message=e)
@app.route("/api/v1/download/<file_id>", methods=["GET"])
def download(file_id):
check_for_game_client("soft")
try:
file = file_handler.get_file(file_id)
if file is None:
return jsonify({"status": "error", "message": "File not found."}), 404
return file
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="web-download", message=e)
@app.route("/api/v1/metadata/<file_id>", methods=["GET"])
def metadata(file_id):
check_for_game_client("soft")
try:
metadata = file_handler.get_metadata(file_id)
if metadata is None:
return jsonify({"status": "error", "message": "File not found."}), 404
return jsonify(metadata)
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="web-metadata", message=e)
@app.route("/api/v1/sha256/<file_id>", methods=["GET"])
def sha256(file_id):
check_for_game_client("soft")
try:
sha256 = file_handler.get_file_sha256(file_id)
if sha256 is None:
return jsonify({"status": "error", "message": "File not found."}), 404
return jsonify({"sha256": sha256})
except TimeoutError:
return jsonify({"status": "error"})
except Exception as e:
logger.graylog_logger(level="error", handler="web-sha256", message=e)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png"/>
<TileColor>#000000</TileColor>
</tile>
</msapplication>
</browserconfig>

BIN
src/image/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

BIN
src/image/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,27 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="256.000000pt" height="256.000000pt" viewBox="0 0 256.000000 256.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.14, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,256.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M0 1280 l0 -1280 1280 0 1280 0 0 1280 0 1280 -1280 0 -1280 0 0
-1280z m1319 -20 c1 -1017 0 -1046 -19 -1070 -19 -25 -19 -25 -34 -5 -14 18
-15 141 -16 1018 0 625 4 1004 10 1015 12 22 40 108 41 130 1 9 5 4 9 -13 4
-16 8 -500 9 -1075z m226 691 c3 -53 7 -109 10 -126 13 -87 16 -216 18 -691
l2 -522 53 -61 53 -60 -37 -16 c-20 -8 -42 -15 -50 -15 -7 0 -36 27 -64 61
l-50 60 0 657 c0 592 6 784 27 877 6 29 7 29 19 -19 7 -27 15 -92 19 -145z
m-495 -143 c17 -89 33 -494 34 -893 l1 -341 -49 -57 c-52 -61 -68 -67 -117
-41 l-30 15 48 57 48 56 8 556 c8 597 9 656 20 666 4 4 7 16 7 26 0 41 19 14
30 -44z m149 -771 l1 -508 -26 -92 c-14 -51 -29 -95 -33 -99 -3 -4 -20 4 -38
17 l-31 25 21 63 c20 58 21 91 27 542 6 414 9 487 23 530 10 27 16 57 15 65
-1 8 4 31 12 50 l15 35 6 -60 c4 -33 7 -289 8 -568z m191 348 c0 -34 13 -89
51 -211 5 -17 9 -167 9 -334 0 -277 2 -310 21 -378 l21 -74 -28 -29 c-15 -16
-31 -26 -36 -21 -4 4 -19 46 -33 92 l-25 85 0 470 c0 307 4 465 10 455 5 -8
10 -33 10 -55z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,19 @@
{
"name": "",
"short_name": "",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-256x256.png",
"sizes": "256x256",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}

View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Matchmaking Debug</title>
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
th {
background-color: #f2f2f2;
}
</style>
<meta http-equiv="refresh" content="4">
</head>
<body>
<h1>Matchmaking Debug Information</h1>
<p><strong>Length of Queue:</strong> {{ len_queue }}</p>
<p><strong>Killed Lobbies:</strong> {{ len_killed_lobbies }}</p>
<p><strong>Queued Runners:</strong> {{ len_queued_runners }}</p>
<p><strong>Queued Hunters:</strong> {{ len_queued_hunters }}</p>
<p><strong>Open Lobbies:</strong> {{ len_open_lobbies }}</p>
<h2>Lobby Data</h2>
<table>
<tr>
<th>Lobby ID</th>
<th>Hunters</th>
<th>Runners</th>
<th>Status</th>
</tr>
{% for lobby in lobby_data %}
<tr>
<td>{{ lobby.id }}</td>
<td>1</td>
<td>
{{ lobby.nonHosts }}
</td>
<td>{{ lobby.status }}</td>
</tr>
{% endfor %}
</table>
</body>
</html>