Fixed 404 on random user button and changed icons

This commit is contained in:
Michael House 2022-06-05 17:02:34 -05:00
parent 2e7f34608c
commit e7c7fba0ad
4 changed files with 12 additions and 12 deletions

View file

@ -78,7 +78,10 @@ a { color: var(--primary); }
background-color: var(--primary-light2) !important; background-color: var(--primary-light2) !important;
border: var(--primary) solid 0.1px; border: var(--primary) solid 0.1px;
} }
.primary_banner {
min-height: 20vh;
object-fit: cover;
}
.border { .border {
border-color: var(--primary) !important; border-color: var(--primary) !important;
} }

View file

@ -473,8 +473,7 @@ def random_post(v):
@app.get("/random_user") @app.get("/random_user")
@auth_required @auth_required
def random_user(v): def random_user(v):
u = g.db.query(User.username).order_by(func.random()).first()
u = g.db.query(User.username).filter(User.song != None).order_by(func.random()).first()
if u: u = u[0] if u: u = u[0]
else: abort(404) else: abort(404)

View file

@ -215,10 +215,10 @@
{% block Banner %} {% block Banner %}
{% if '@' not in request.path %} {% if '@' not in request.path %}
{% if sub %} {% if sub %}
<img alt="/h/{{sub.name}} banner" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{sub.banner_url}}')" loading="lazy" src="{{sub.banner_url}}" width=100% style="object-fit:cover;max-height:25vw"> <img alt="/h/{{sub.name}} banner" class="primary_banner" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{sub.banner_url}}')" loading="lazy" src="{{sub.banner_url}}" width=100% style="object-fit:cover;max-height:25vw">
{% else %} {% else %}
<a href="/"> <a href="/">
<img alt="site banner" src="/assets/images/{{SITE_NAME}}/banner.webp?v=1046" width="100%"> <img alt="site banner" class="primary_banner" src="/assets/images/{{SITE_NAME}}/banner.webp?v=1046" width="100%">
</a> </a>
{% endif %} {% endif %}
{% endif %} {% endif %}

View file

@ -59,16 +59,16 @@
{% endif %} {% endif %}
{% if not err %} {% if not err %}
<a class="mobile-nav-icon d-md-none" href="/random_user"><i class="fas fa-music align-middle text-gray-500 black"></i></a> <a class="mobile-nav-icon d-md-none" href="/random_user" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Random User"><i class="fas fa-user-circle align-middle text-gray-500 black"></i></a>
<a class="mobile-nav-icon d-md-none" href="/random_post"><i class="fas fa-random align-middle text-gray-500 black"></i></a> <a class="mobile-nav-icon d-md-none" href="/random_post" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Random Post"><i class="fas fa-random align-middle text-gray-500 black"></i></a>
{% if v and v.admin_level > 1 %} {% if v and v.admin_level > 1 %}
<a class="mobile-nav-icon d-md-none" href="/admin"><i class="fas fa-crown align-middle text-gray-500 black"></i></a> <a class="mobile-nav-icon d-md-none" href="/admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Admin"><i class="fas fa-crown align-middle text-gray-500 black"></i></a>
{% endif %} {% endif %}
{% if v %} {% if v %}
<a class="mobile-nav-icon d-md-none" href="{% if sub %}/h/{{sub.name}}{% endif %}/submit"><i class="fas fa-feather-alt align-middle text-gray-500 black"></i></a> <a class="mobile-nav-icon d-md-none" href="{% if sub %}/h/{{sub.name}}{% endif %}/submit" data-bs-toggle="tooltip" data-bs-placement="bottom" title="New Post"><i class="fas fa-edit align-middle text-gray-500 black"></i></a>
{% else %} {% else %}
<a class="mobile-nav-icon d-md-none" href="/login"><i class="fas fa-feather-alt align-middle text-gray-500 black"></i></a> <a class="mobile-nav-icon d-md-none" href="/login" data-bs-toggle="tooltip" data-bs-placement="bottom" title="New Post"><i class="fas fa-edit align-middle text-gray-500 black"></i></a>
{% endif %} {% endif %}
<button class="navbar-toggler" role="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" <button class="navbar-toggler" role="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive"
aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation"> aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
@ -196,8 +196,6 @@
<a class="nav-item nav-link" rel="nofollow noopener noreferrer" href="https://github.com/themotte/rDrama"><i class="fab fa-github fa-fw mr-3"></i>Source code</a> <a class="nav-item nav-link" rel="nofollow noopener noreferrer" href="https://github.com/themotte/rDrama"><i class="fab fa-github fa-fw mr-3"></i>Source code</a>
<a class="nav-item nav-link" rel="nofollow noopener noreferrer" href="{{config('GUMROAD_LINK')}}"><i class="fas fa-dollar-sign fa-fw mr-3"></i>Donate</a>
<a class="nav-item nav-link" href="/contact"><i class="fas fa-file-signature fa-fw mr-3"></i>Contact us</a> <a class="nav-item nav-link" href="/contact"><i class="fas fa-file-signature fa-fw mr-3"></i>Contact us</a>
<li class="nav-item border-top border-bottom mt-2 pt-2"> <li class="nav-item border-top border-bottom mt-2 pt-2">