get ready for another util
This commit is contained in:
parent
604afbeb9a
commit
b9fe8b8baa
4 changed files with 48 additions and 20 deletions
17
utils/app.py
17
utils/app.py
|
@ -13,17 +13,24 @@ app = Flask(__name__)
|
||||||
|
|
||||||
@app.route('/', methods=['GET', 'POST'])
|
@app.route('/', methods=['GET', 'POST'])
|
||||||
def index():
|
def index():
|
||||||
|
return render_template('index.j2')
|
||||||
|
|
||||||
|
@app.route('/ip6-gen', methods=['GET', 'POST'])
|
||||||
|
def ip6gen():
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
subnet = request.form['subnet']
|
subnet = request.form['subnet']
|
||||||
ip = generate.generate_ip(subnet)
|
ip = generate.generate_ip(subnet)
|
||||||
return redirect(url_for('result', ip=ip))
|
type = "IPv6 generator"
|
||||||
return render_template('index.j2')
|
return redirect(url_for('result', result=ip, type=type))
|
||||||
|
return render_template('ip6-gen.j2')
|
||||||
|
|
||||||
@app.route('/result')
|
@app.route('/result')
|
||||||
def result():
|
def result():
|
||||||
ip = request.args.get('ip')
|
result = request.args.get('result')
|
||||||
ip = sanitize_html(ip)
|
type = request.args.get('type')
|
||||||
return render_template('result.j2', result=ip)
|
result = sanitize_html(result)
|
||||||
|
type = sanitize_html(type)
|
||||||
|
return render_template('result.j2', result=result, type=type)
|
||||||
|
|
||||||
@app.route('/assets/style.css')
|
@app.route('/assets/style.css')
|
||||||
def css():
|
def css():
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<head>
|
<head>
|
||||||
<title>Utilities</title>
|
<title>Utilities</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link href="assets/style.css" rel="stylesheet" type="text/css">
|
<link href="assets/style.css" rel="stylesheet" type="text/css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>IPv6 generator</h1>
|
<h1>Utilites</h1>
|
||||||
<form method="POST">
|
<ul>
|
||||||
<input type="text" name="subnet" size="10" placeholder="IPv6 subnet" />
|
<li>
|
||||||
<button type="submit">generate</button>
|
<a href="ip6-gen">IPv6 generator</a>
|
||||||
</form>
|
</li>
|
||||||
<footer>
|
</ul>
|
||||||
<hr />
|
<footer>
|
||||||
<a href="https://git.everypizza.im/n/utils">source code</a> | version 0.0.1
|
<hr />
|
||||||
</footer>
|
<a href="https://git.everypizza.im/n/utils">source code</a> | version 0.0.1
|
||||||
</body>
|
</footer>
|
||||||
|
</body>
|
20
utils/templates/ip6-gen.j2
Normal file
20
utils/templates/ip6-gen.j2
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Utilities</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link href="assets/style.css" rel="stylesheet" type="text/css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>IPv6 generator</h1>
|
||||||
|
<form method="POST">
|
||||||
|
<input type="text" name="subnet" size="10" placeholder="IPv6 subnet" />
|
||||||
|
<button type="submit">generate</button>
|
||||||
|
</form>
|
||||||
|
<footer>
|
||||||
|
<hr />
|
||||||
|
<a href="/">← back home</a>
|
||||||
|
<a href="https://git.everypizza.im/n/utils">source code</a> | version 0.0.1
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -5,7 +5,7 @@
|
||||||
<link href="assets/style.css" rel="stylesheet" type="text/css">
|
<link href="assets/style.css" rel="stylesheet" type="text/css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Result for {{ action }}</h1>
|
<h1>Result for {{ type }}</h1>
|
||||||
<p>
|
<p>
|
||||||
{{ result }}
|
{{ result }}
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Add table
Reference in a new issue