Compare commits
No commits in common. "1c13258ac005b62dc171df26b6bc62c375ef2ee2" and "302a4f92f0cfaf339ea40e1f6a17c2921b7228de" have entirely different histories.
1c13258ac0
...
302a4f92f0
4 changed files with 3 additions and 54 deletions
16
utils/app.py
16
utils/app.py
|
@ -5,7 +5,7 @@ import generate
|
||||||
|
|
||||||
def sanitize_html(html):
|
def sanitize_html(html):
|
||||||
# Allow only a limited set of tags and attributes
|
# Allow only a limited set of tags and attributes
|
||||||
allowed_tags = []
|
allowed_tags = ['a', 'b', 'i', 'em', 'strong']
|
||||||
allowed_attributes = {'a': ['href']}
|
allowed_attributes = {'a': ['href']}
|
||||||
return bleach.clean(html, tags=allowed_tags, attributes=allowed_attributes)
|
return bleach.clean(html, tags=allowed_tags, attributes=allowed_attributes)
|
||||||
|
|
||||||
|
@ -42,17 +42,5 @@ def port():
|
||||||
port = generate.generate_port()
|
port = generate.generate_port()
|
||||||
return render_template('port-gen.j2', result=port)
|
return render_template('port-gen.j2', result=port)
|
||||||
|
|
||||||
@app.route('/case', methods=['GET', 'POST'])
|
|
||||||
def case():
|
|
||||||
if request.method == 'POST':
|
|
||||||
text = request.form['text']
|
|
||||||
case = request.form['casing']
|
|
||||||
if case == 'caps':
|
|
||||||
result = generate.uppercase(text)
|
|
||||||
if case == 'lowercase':
|
|
||||||
result = generate.lowercase(text)
|
|
||||||
return redirect(url_for('result', result=result, type='casing'))
|
|
||||||
return render_template('casing.j2')
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
|
@ -19,12 +19,4 @@ def generate_ip(subnet, prefix):
|
||||||
|
|
||||||
def generate_port():
|
def generate_port():
|
||||||
port = randint(1025, 65535)
|
port = randint(1025, 65535)
|
||||||
return str(port)
|
return str(port)
|
||||||
|
|
||||||
def lowercase(input):
|
|
||||||
output = input.lower()
|
|
||||||
return output
|
|
||||||
|
|
||||||
def uppercase(input):
|
|
||||||
output = input.upper()
|
|
||||||
return output
|
|
|
@ -1,24 +0,0 @@
|
||||||
<!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>Text casing</h1>
|
|
||||||
<form method="POST">
|
|
||||||
<textarea name="text" placeholder="fhwrjdehsbrjkgu"></textarea>
|
|
||||||
<br>
|
|
||||||
<input type="radio" name="casing" id="caps" value="caps">caps</input>
|
|
||||||
<input type="radio" name="casing" id="lowercase" value="lowercase">lowercase</input>
|
|
||||||
<br>
|
|
||||||
<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>
|
|
|
@ -6,7 +6,6 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Utilites</h1>
|
<h1>Utilites</h1>
|
||||||
<h3>Networking stuff</h3>
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="ip6-gen">IPv6 generator</a>
|
<a href="ip6-gen">IPv6 generator</a>
|
||||||
|
@ -15,12 +14,6 @@
|
||||||
<a href="port">Random port generator</a>
|
<a href="port">Random port generator</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h3>Text casing</h3>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="case">Text casing</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<footer>
|
<footer>
|
||||||
<hr />
|
<hr />
|
||||||
<a href="https://git.everypizza.im/n/utils">source code</a> | version 0.0.1
|
<a href="https://git.everypizza.im/n/utils">source code</a> | version 0.0.1
|
||||||
|
|
Loading…
Add table
Reference in a new issue