master
Aevann1 2021-07-23 22:31:44 +02:00
commit eb34291c10
3 changed files with 10 additions and 6 deletions

View File

@ -1,3 +1,5 @@
import jinja2.exceptions
from drama.helpers.wrappers import * from drama.helpers.wrappers import *
from drama.helpers.session import * from drama.helpers.session import *
from drama.classes.custom_errors import * from drama.classes.custom_errors import *
@ -195,10 +197,12 @@ def allow_nsfl_logged_out(bid, v):
return redirect(request.form.get("redir")) return redirect(request.form.get("redir"))
@app.route("/error/<eid>", methods=["GET"]) @app.route("/error/<error>", methods=["GET"])
@auth_desired @auth_desired
def error_all_preview(eid, v): def error_all_preview(error, v):
eid=int(eid) try:
return render_template(f"errors/{eid}.html", v=v) return render_template(f"errors/{error}.html", v=v)
except jinja2.exceptions.TemplateNotFound:
abort(400)

View File

@ -216,7 +216,7 @@ def followers(username, v):
@auth_required @auth_required
def visitors(v): def visitors(v):
if v.admin_level < 1 and not v.patron: return render_template("errors/patron.html", v=v) if v.admin_level < 1 and not v.patron: return render_template("errors/patron.html", v=v)
viewers=sorted(v.viewers, key = lambda x: x.last_view_utc) viewers=sorted(v.viewers, key = lambda x: x.last_view_utc, reverse=True)
return render_template("viewers.html", v=v, viewers=viewers) return render_template("viewers.html", v=v, viewers=viewers)
@app.route("/@<username>", methods=["GET"]) @app.route("/@<username>", methods=["GET"])

View File

@ -305,7 +305,7 @@
</div> </div>
{% if v and v.id == u.id %} {% if v and v.id == u.id %}
<a href="/settings/profile" class="btn btn-secondary btn-sm">Edit profile</a> <a href="/settings/profile" class="btn btn-secondary btn-sm">Edit profile</a>
<a href="/views" class="btn btn-secondary">Profile views</a> <a href="/views" class="btn btn-secondary btn-sm">Profile views</a>
{% endif %} {% endif %}
{% if v and v.id != u.id %} {% if v and v.id != u.id %}
<a id="button-unsub2" class="btn btn-secondary {% if not is_following %}d-none{% endif %}" href="javascript:void(0)" onclick="post('/api/unfollow/{{u.username}}', callback=function(){document.getElementById('button-unsub2').classList.toggle('d-none');document.getElementById('button-sub2').classList.toggle('d-none');})">Unfollow</a> <a id="button-unsub2" class="btn btn-secondary {% if not is_following %}d-none{% endif %}" href="javascript:void(0)" onclick="post('/api/unfollow/{{u.username}}', callback=function(){document.getElementById('button-unsub2').classList.toggle('d-none');document.getElementById('button-sub2').classList.toggle('d-none');})">Unfollow</a>