diff --git a/app.py b/app.py old mode 100644 new mode 100755 index cde80ca..042397f --- a/app.py +++ b/app.py @@ -1,14 +1,28 @@ #!/usr/bin/env python -from flask import Flask, render_template +from flask import Flask, render_template, redirect, url_for, abort, request import openvpnstatus app = Flask(__name__) -@app.route('/') +@app.route('/status', methods=['GET', 'POST']) def status(): o = openvpnstatus.openvpnstatus() return render_template('status.html', connections = o.connections, routes = o.routes) +@app.route('/redirect') +def redir(): + return redirect('https://www.socialnerds.org') + +@app.route('/form', methods=['GET', 'POST']) +def formular(): + something = "iatren" + if request.method == 'POST': + value = request.form['textfield'] + return render_template("footer.html", test=value, test2=value) + else: + return render_template("form.html") + + if __name__ == '__main__': - app.run(host='0.0.0.0') + app.run(debug=True) diff --git a/openvpn-status.log b/openvpn-status.log new file mode 100644 index 0000000..16d3280 --- /dev/null +++ b/openvpn-status.log @@ -0,0 +1,17 @@ +OpenVPN CLIENT LIST +Updated,Sat Aug 24 20:03:17 2013 +Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since +charon,81.10.251.191:2051,1440046004,13937806723,Mon Aug 19 16:28:10 2013 +basti,90.146.227.139:39863,56493297,243721445,Mon Aug 19 16:28:19 2013 +arsbox1,81.10.213.34:57529,39563115,143056221,Thu Aug 22 09:17:36 2013 +ROUTING TABLE +Virtual Address,Common Name,Real Address,Last Ref +10.30.0.10,arsbox1,81.10.213.34:57529,Fri Aug 23 20:17:32 2013 +10.30.0.6,charon,81.10.251.191:2051,Sat Aug 24 20:03:16 2013 +10.1.6.0/26,arsbox1,81.10.213.34:57529,Thu Aug 22 09:17:37 2013 +10.1.2.0/26,charon,81.10.251.191:2051,Mon Aug 19 16:28:11 2013 +10.1.3.0/26,basti,90.146.227.139:39863,Mon Aug 19 16:28:19 2013 +10.30.0.26,basti,90.146.227.139:39863,Mon Aug 19 16:28:19 2013 +GLOBAL STATS +Max bcast/mcast queue length,0 +END diff --git a/templates/footer.html b/templates/footer.html new file mode 100644 index 0000000..5e0dc4d --- /dev/null +++ b/templates/footer.html @@ -0,0 +1,10 @@ +{% extends "form.html" %} +{% block body %} +{% if test2 %} +
+Hello, my dear {{ test2 }}! +
+