From b9fe8b8baa4a9e1e97824e23f585d1951aa2dce1 Mon Sep 17 00:00:00 2001 From: Nyx Date: Sat, 22 Mar 2025 12:09:42 -0500 Subject: [PATCH] get ready for another util --- utils/app.py | 17 ++++++++++++----- utils/templates/index.j2 | 29 +++++++++++++++-------------- utils/templates/ip6-gen.j2 | 20 ++++++++++++++++++++ utils/templates/result.j2 | 2 +- 4 files changed, 48 insertions(+), 20 deletions(-) create mode 100644 utils/templates/ip6-gen.j2 diff --git a/utils/app.py b/utils/app.py index 84fd0a2..e99881e 100644 --- a/utils/app.py +++ b/utils/app.py @@ -13,17 +13,24 @@ app = Flask(__name__) @app.route('/', methods=['GET', 'POST']) def index(): + return render_template('index.j2') + +@app.route('/ip6-gen', methods=['GET', 'POST']) +def ip6gen(): if request.method == 'POST': subnet = request.form['subnet'] ip = generate.generate_ip(subnet) - return redirect(url_for('result', ip=ip)) - return render_template('index.j2') + type = "IPv6 generator" + return redirect(url_for('result', result=ip, type=type)) + return render_template('ip6-gen.j2') @app.route('/result') def result(): - ip = request.args.get('ip') - ip = sanitize_html(ip) - return render_template('result.j2', result=ip) + result = request.args.get('result') + type = request.args.get('type') + result = sanitize_html(result) + type = sanitize_html(type) + return render_template('result.j2', result=result, type=type) @app.route('/assets/style.css') def css(): diff --git a/utils/templates/index.j2 b/utils/templates/index.j2 index 738fde4..53675dc 100644 --- a/utils/templates/index.j2 +++ b/utils/templates/index.j2 @@ -1,17 +1,18 @@ Utilities - - - - -

IPv6 generator

-
- - -
- - \ No newline at end of file + + + + +

Utilites

+ + + \ No newline at end of file diff --git a/utils/templates/ip6-gen.j2 b/utils/templates/ip6-gen.j2 new file mode 100644 index 0000000..01b66de --- /dev/null +++ b/utils/templates/ip6-gen.j2 @@ -0,0 +1,20 @@ + + + + Utilities + + + + +

IPv6 generator

+
+ + +
+ + + \ No newline at end of file diff --git a/utils/templates/result.j2 b/utils/templates/result.j2 index 80608c7..2402608 100644 --- a/utils/templates/result.j2 +++ b/utils/templates/result.j2 @@ -5,7 +5,7 @@ -

Result for {{ action }}

+

Result for {{ type }}

{{ result }}