From d7936dc3e0958407cc1d71841ec55aa519b66f74 Mon Sep 17 00:00:00 2001 From: crunk Date: Fri, 7 Jan 2022 18:09:29 +0100 Subject: [PATCH] Main page shows lists of distribusis --- .gitignore | 1 + verse/start.py | 16 +++++++++++++--- verse/static/css/style.css | 20 ++++++++++++++++++++ verse/templates/index.html | 9 +++------ 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index a9f4413..705c21e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ dist/ pip-wheel-metadata/ verse/tmpupload/* +verse/stash/* *.db diff --git a/verse/start.py b/verse/start.py index 366caa5..dc7bfcf 100644 --- a/verse/start.py +++ b/verse/start.py @@ -13,6 +13,7 @@ from flask import ( url_for, session, abort, + send_from_directory, ) from sqlalchemy.exc import ( IntegrityError, @@ -56,7 +57,11 @@ def session_handler(): @APP.route("/") def index(): - return render_template("index.html") + users = User.query.filter(User.distribusiname.isnot(None)).all() + distribusinames = [] + for user in users: + distribusinames.append(user.distribusiname) + return render_template("index.html", distribusinames=distribusinames) @APP.route("/login", methods=["GET", "POST"]) @@ -69,7 +74,7 @@ def login(): login_user(user) flash("Logged in successfully.", "success") next = request.args.get("next") - if next is not None and not is_safe_url(next): + if next is not None and not is_safe_url(next): # noqa: F821 return abort(400) return redirect(next or url_for("index")) else: @@ -144,7 +149,7 @@ def distribusi(): parser = build_argparser() args = parser.parse_args() distribusify(args, newuserfolder) - return render_template("index.html") + return redirect(url_for("index")) template = render_template( "distribusi.html", uploadform=uploadform, @@ -178,6 +183,11 @@ def upload(): return template +@APP.route("/stash/") +def distribusistash(path): + return send_from_directory("stash", path) + + @APP.route("/admin") @login_required def admin(): diff --git a/verse/static/css/style.css b/verse/static/css/style.css index abeb30d..a75292b 100644 --- a/verse/static/css/style.css +++ b/verse/static/css/style.css @@ -78,3 +78,23 @@ fieldset.required { .button input:hover { background: #60337F; } + +/* unvisited link */ +a:link { + color: red; +} + +/* visited link */ +a:visited { + color: #fff600; +} + +/* mouse over link */ +a:hover { + color: #60337F; +} + +/* selected link */ +a:active { + color: white; +} diff --git a/verse/templates/index.html b/verse/templates/index.html index f75ccdb..272f1bd 100644 --- a/verse/templates/index.html +++ b/verse/templates/index.html @@ -34,12 +34,9 @@

List of distribusis

    -
  • CCL
  • -
  • Crunk
  • -
  • CMOS4010
  • -
  • CMOS4046
  • -
  • Other Names
  • -
  • List of stuff
  • + {% for distribusiname in distribusinames %} +
  • {{distribusiname}}
  • + {% endfor%}
{% endblock %}