diff --git a/server/djrandom/frontend/templates/_std_base.html b/server/djrandom/frontend/templates/_std_base.html new file mode 100644 index 0000000000000000000000000000000000000000..eef79cf7d907e9963a66c3b4f25464903642e1a8 --- /dev/null +++ b/server/djrandom/frontend/templates/_std_base.html @@ -0,0 +1,17 @@ +<!doctype html> +<html> + <head> + <title>DJ RANDOM :: {% block title %}{% endblock %}</title> + <link href="/static/favicon.ico" type="image/x-icon" rel="shortcut icon"> + <link rel="stylesheet" type="text/css" href="/static/css/login.css"> + </head> + <body> + + <div id="main"> + <div id="form"> + {% block main %} + {% endblock %} + </div> + </div> + </body> +</html> diff --git a/server/djrandom/frontend/templates/about.html b/server/djrandom/frontend/templates/about.html index 5c737152e9022947036f2c600a6e57e729f73682..aedc42e9eca58f0f9c1b254169ec5298eedadc17 100644 --- a/server/djrandom/frontend/templates/about.html +++ b/server/djrandom/frontend/templates/about.html @@ -1,14 +1,7 @@ -<!doctype html> -<html> - <head> - <title>DJ RANDOM :: About</title> - <link href="/static/favicon.ico" type="image/x-icon" rel="shortcut icon"> - <link rel="stylesheet" type="text/css" href="/static/css/login.css"> - </head> - <body> +{% extends "_std_base.html" %} +{% block title %}About{% endblock %} +{% block main %} - <div id="main"> - <div id="form"> <h3>DJ:Random</h3> <p> @@ -19,9 +12,4 @@ (<b>{{ used_gb }}</b> Gb). </p> - </div> - - </div> - - </body> -</html> +{% endblock %} diff --git a/server/djrandom/frontend/templates/redirect.html b/server/djrandom/frontend/templates/redirect.html new file mode 100644 index 0000000000000000000000000000000000000000..a99041f8d0dbd8c4c6da4f7b034d247a94388af9 --- /dev/null +++ b/server/djrandom/frontend/templates/redirect.html @@ -0,0 +1,13 @@ +{% extends "_std_base.html" %} +{% block title %}About{% endblock %} +{% block main %} + +<p> + Redirecting to <a href="{{ url | e }}">{{ url | e }}</a> ... +</p> + +<script type="text/javascript"> + window.location = '{{ url | e }}'; +</script> + +{% endblock %} diff --git a/server/djrandom/frontend/templates/user_details.html b/server/djrandom/frontend/templates/user_details.html index 5afee9535746294fe59a30edbbc477f02703055a..6b0d9432d5a4541ee4d31b314003a8a6a0085040 100644 --- a/server/djrandom/frontend/templates/user_details.html +++ b/server/djrandom/frontend/templates/user_details.html @@ -1,13 +1,7 @@ -<!doctype html> -<html> - <head> - <title>DJ RANDOM</title> - <link href="/static/favicon.ico" type="image/x-icon" rel="shortcut icon"> - <link rel="stylesheet" type="text/css" href="/static/css/login.css"> - </head> - <body> - - <div id="main"> +{% extends "_std_base.html" %} +{% block title %}User Details{% endblock %} +{% block main %} + <div id="form"> {%- for msg in get_flashed_messages() -%} @@ -55,5 +49,4 @@ </div> - </body> -</html> +{% endblock %} diff --git a/server/djrandom/frontend/templates/user_invite.html b/server/djrandom/frontend/templates/user_invite.html index 2cc3afa87234d1a98592291b67108262b56a2a47..ee7625b4e39ef270fb1db98e02efb9abb7da611b 100644 --- a/server/djrandom/frontend/templates/user_invite.html +++ b/server/djrandom/frontend/templates/user_invite.html @@ -1,14 +1,7 @@ -<!doctype html> -<html> - <head> - <title>DJ RANDOM</title> - <link href="/static/favicon.ico" type="image/x-icon" rel="shortcut icon"> - <link rel="stylesheet" type="text/css" href="/static/css/login.css"> - </head> - <body> +{% extends "_std_base.html" %} +{% block title %}Invites{% endblock %} +{% block main %} - <div id="main"> - <div id="form"> <form action="/user/invite" method="post"> {{ form.hidden_tag() | safe }} @@ -27,9 +20,5 @@ <input type="submit" class="f_submit" value=" Invite "> </p> </form> - </div> - </div> - - </body> -</html> +{% endblock %} diff --git a/server/djrandom/frontend/views.py b/server/djrandom/frontend/views.py index 662b70170e82ddf89c282faf4c014075a084dbcc..ec792dd7e8b7defdc867fa880aefc95ea0d5c09c 100644 --- a/server/djrandom/frontend/views.py +++ b/server/djrandom/frontend/views.py @@ -52,6 +52,15 @@ def homepage(): return render_template('index.html', user=user) +@app.route('/ext') +@require_auth +def redirect_to_external_url(): + url = request.args.get('url') + if not url: + abort(400) + return render_template('redirect.html', url=url) + + def fileiter(path, pos, end): with open(path, 'r') as fd: fd.seek(pos)