From 7f7853a412588fedda87e4009679f4bc879d1ff3 Mon Sep 17 00:00:00 2001 From: pika Date: Sun, 30 Mar 2025 23:50:33 +0200 Subject: [PATCH] addet static content.. WIP --- app/routes/__pycache__/api.cpython-313.pyc | Bin 16378 -> 16405 bytes app/routes/api.py | 85 +- .../libs/tabler-icons/fonts/tabler-icons.ttf | 1814 +++++++++++++++++ .../libs/tabler-icons/fonts/tabler-icons.woff | 1814 +++++++++++++++++ .../tabler-icons/fonts/tabler-icons.woff2 | 1814 +++++++++++++++++ 5 files changed, 5479 insertions(+), 48 deletions(-) create mode 100644 app/static/libs/tabler-icons/fonts/tabler-icons.ttf create mode 100644 app/static/libs/tabler-icons/fonts/tabler-icons.woff create mode 100644 app/static/libs/tabler-icons/fonts/tabler-icons.woff2 diff --git a/app/routes/__pycache__/api.cpython-313.pyc b/app/routes/__pycache__/api.cpython-313.pyc index 271063a3eca5ccdcf07a876f3baaf150b81eeb71..44c42525a99f5a61cfa5247f2fb5ee5b57633acb 100644 GIT binary patch delta 4804 zcmai1eQaA-6~E8+v!CraU;d~+;>3;JG)^6-ZI*QX+LCo$yLNPKT#pr(d2algxpkay zpFKvU;SIsaV9n zSc|tN-GS0Y zW4ar4eM9d&QHe{aCPc#<7}`?t3-Icy$yf33!F6m>?@ZL<)Llnz+Xni>tMvEOSr_5@ z-_<+M*Yro~$n|cZzqg`47OkzK(G8^gG->v*!Lz?_1DPEajey9`n$9XB+sBOIe)f68 zcRIp?DxS@zlt*CD`e-VfNvHC1a&m&^lQ2rn2gJV%dwdWv)tH)`lyhn7fe-4%88MTW z#}#UTao9-xd`f{iMKvmgGdVd=ee94)7PkVYb^e;ES1)+jpDf*bswybgEEN#c)3f=^xXhj8 z7HA)Gw)k zwihK#J34|OAo6Eiei|$0ygv86f-x%0ivy0_O6=Ve+su^oaO=il*G#Cy7 z`!M_~&#)U#-+X7&--O~e_zsKfH_ufg0(?thE4AXd9m$4()z;jGavU5zU(cbSm@tYS zNEHq1nA`+#Xknp;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aYa9IaUQ1A!GS1!5%12UZh&d0Ze;{tx<8>!^BilR_uDkU7+2kSl+B?w3>0S z3)Pt~8io8A#PPZJyC#J#ZvdO7P(j1w0`-%?;*jhLK5`( z4dGlZvg?sJk-P;&HEYw!B^+V0KB)JNH4)0-waY8Zw6;at8U*MOYYCWsbRzYr^ZB%|iX!tCV?-N=pAz z&`-B`Y(Im+OX%uxcqG=&`M3Uy_g;sw^sag!5%?c63`Ve{Z-6#!@5#LZLO5dd=lfTh z@+u$;rK8(ZG=&{YrS&ec0PE h7vA|l-qXwP<{t^1p&ZHfWh3^NU!hyS_Gcri_&=5gkxBpn diff --git a/app/routes/api.py b/app/routes/api.py index ff5bd31..da88c8b 100644 --- a/app/routes/api.py +++ b/app/routes/api.py @@ -8,6 +8,8 @@ import ipaddress from flask_wtf import CSRFProtect import markdown from datetime import datetime +from flask import flash +from app.utils.app_utils import validate_port_data bp = Blueprint("api", __name__, url_prefix="/api") csrf = CSRFProtect() @@ -284,61 +286,48 @@ def suggest_port(server_id): def add_app_port(app_id): """Add a port to an application""" app = App.query.get_or_404(app_id) - - # Accept both JSON and form data - if request.is_json: - data = request.json - else: - data = request.form - - port_number = data.get("port") - protocol = data.get("protocol", "TCP") - description = data.get("description", "") - - if not port_number: - return jsonify({"success": False, "error": "Port number is required"}), 400 - + try: - port_number = int(port_number) - - # Check if port already exists for this app - existing_port = Port.query.filter_by(app_id=app_id, number=port_number).first() + port_number = request.form.get("port_number") + protocol = request.form.get("protocol", "TCP") + description = request.form.get("description", "") + + # Validate port data + valid, clean_port, error = validate_port_data(port_number, protocol, description) + + if not valid: + return jsonify({"success": False, "error": error}), 400 + + # Check if port already exists + existing_port = Port.query.filter_by(app_id=app_id, port_number=clean_port).first() if existing_port: - return ( - jsonify( - { - "success": False, - "error": "Port already exists for this application", - } - ), - 400, - ) - + return jsonify({ + "success": False, + "error": f"Port {clean_port} already exists for this application" + }), 400 + # Create new port - port = Port( - number=port_number, - protocol=protocol, - description=description, + new_port = Port( app_id=app_id, + port_number=clean_port, + protocol=protocol, + description=description ) - - db.session.add(port) + db.session.add(new_port) db.session.commit() - - return jsonify( - { - "success": True, - "message": f"Port {port_number} added to {app.name}", - "port": { - "id": port.id, - "number": port.number, - "protocol": port.protocol, - "description": port.description, - }, + + flash(f"Port {clean_port}/{protocol} added successfully", "success") + return jsonify({ + "success": True, + "message": f"Port {clean_port}/{protocol} added successfully", + "port": { + "id": new_port.id, + "number": new_port.port_number, + "protocol": new_port.protocol, + "description": new_port.description } - ) - except ValueError: - return jsonify({"success": False, "error": "Invalid port number"}), 400 + }) + except Exception as e: db.session.rollback() return jsonify({"success": False, "error": str(e)}), 500 diff --git a/app/static/libs/tabler-icons/fonts/tabler-icons.ttf b/app/static/libs/tabler-icons/fonts/tabler-icons.ttf new file mode 100644 index 0000000..f42247e --- /dev/null +++ b/app/static/libs/tabler-icons/fonts/tabler-icons.ttf @@ -0,0 +1,1814 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Page not found · GitHub · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ Skip to content + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + +
+ + + + + + + + + +
+
+ + + +
+
+ +
+
+ 404 “This is not the web page you are looking for” + + + + + + + + + + + + +
+
+ +
+
+ +
+ + +
+
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + diff --git a/app/static/libs/tabler-icons/fonts/tabler-icons.woff b/app/static/libs/tabler-icons/fonts/tabler-icons.woff new file mode 100644 index 0000000..b0ba617 --- /dev/null +++ b/app/static/libs/tabler-icons/fonts/tabler-icons.woff @@ -0,0 +1,1814 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Page not found · GitHub · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ Skip to content + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + +
+ + + + + + + + + +
+
+ + + +
+
+ +
+
+ 404 “This is not the web page you are looking for” + + + + + + + + + + + + +
+
+ +
+
+ +
+ + +
+
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + diff --git a/app/static/libs/tabler-icons/fonts/tabler-icons.woff2 b/app/static/libs/tabler-icons/fonts/tabler-icons.woff2 new file mode 100644 index 0000000..c760395 --- /dev/null +++ b/app/static/libs/tabler-icons/fonts/tabler-icons.woff2 @@ -0,0 +1,1814 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Page not found · GitHub · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ Skip to content + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + +
+ + + + + + + + + +
+
+ + + +
+
+ +
+
+ 404 “This is not the web page you are looking for” + + + + + + + + + + + + +
+
+ +
+
+ +
+ + +
+
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + +