Compare commits

..

No commits in common. "1c13258ac005b62dc171df26b6bc62c375ef2ee2" and "302a4f92f0cfaf339ea40e1f6a17c2921b7228de" have entirely different histories.

4 changed files with 3 additions and 54 deletions

View file

@ -5,7 +5,7 @@ import generate
def sanitize_html(html):
# Allow only a limited set of tags and attributes
allowed_tags = []
allowed_tags = ['a', 'b', 'i', 'em', 'strong']
allowed_attributes = {'a': ['href']}
return bleach.clean(html, tags=allowed_tags, attributes=allowed_attributes)
@ -42,17 +42,5 @@ def port():
port = generate.generate_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__':
app.run(debug=True)
app.run(debug=True)

View file

@ -19,12 +19,4 @@ def generate_ip(subnet, prefix):
def generate_port():
port = randint(1025, 65535)
return str(port)
def lowercase(input):
output = input.lower()
return output
def uppercase(input):
output = input.upper()
return output
return str(port)

View file

@ -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>

View file

@ -6,7 +6,6 @@
</head>
<body>
<h1>Utilites</h1>
<h3>Networking stuff</h3>
<ul>
<li>
<a href="ip6-gen">IPv6 generator</a>
@ -15,12 +14,6 @@
<a href="port">Random port generator</a>
</li>
</ul>
<h3>Text casing</h3>
<ul>
<li>
<a href="case">Text casing</a>
</li>
</ul>
<footer>
<hr />
<a href="https://git.everypizza.im/n/utils">source code</a> | version 0.0.1