online player count and mod list on about page

This commit is contained in:
Aaron Kimbre 2022-04-03 13:31:43 -05:00
parent 5492ae6668
commit e73d1ecd53
4 changed files with 43 additions and 51 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@ app/cache/*
property_files/*
*.log
app/settings.py
*.exe

View File

@ -1,7 +1,7 @@
from flask import render_template, Blueprint, send_from_directory
from flask_user import current_user
from flask_user import current_user, login_required
from app.models import Account
from app.models import Account, CharacterInfo, ActivityLog
from app.schemas import AccountSchema, CharacterInfoSchema
main_blueprint = Blueprint('main', __name__)
@ -25,9 +25,24 @@ def index():
@main_blueprint.route('/about')
@login_required
def about():
"""About Page"""
return render_template('main/about.html.j2')
mods = Account.query.filter(Account.gm_level > 0).all()
online = 0
chars = CharacterInfo.query.all()
for char in chars:
last_log = ActivityLog.query.with_entities(
ActivityLog.activity
).filter(
ActivityLog.character_id == char.id
).order_by(ActivityLog.id.desc()).first()
print(last_log)
if last_log:
if last_log[0] == 0:
online += 1
return render_template('main/about.html.j2', mods=mods, online=online)
@main_blueprint.route('/favicon.ico')

View File

@ -46,6 +46,11 @@
<a id='property-index' class='nav-link' href='{{ url_for('properties.index') }}'>Properties</a>
{% endif %}
{% if current_user.is_authenticated and current_user.gm_level == 9 and config.REQUIRE_PLAY_KEY %}
{# Play Keys #}
<a id='play_keys-index' class='nav-link' href='{{ url_for('play_keys.index') }}'>Play Keys</a>
{% endif %}
{% if current_user.is_authenticated and current_user.gm_level >= 2 %}
<a id='report-index' class='nav-link' href='{{ url_for('reports.index') }}'>Reports</a>
<li class="nav-item dropdown">
@ -73,7 +78,8 @@
{% endif %}
</div>
</li>
{% elif current_user.is_authenticated %}
{% endif %}
{% if current_user.is_authenticated %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Bug Reports</a>
<div class="dropdown-menu">
@ -82,15 +88,11 @@
<a class="dropdown-item text-center" href='{{ url_for('bug_reports.index', status='all') }}'>All Reports</a>
</div>
</li>
{% endif %}
{% if current_user.is_authenticated and current_user.gm_level == 9 and config.REQUIRE_PLAY_KEY %}
{# Play Keys #}
<a id='play_keys-index' class='nav-link' href='{{ url_for('play_keys.index') }}'>Play Keys</a>
{% endif %}
{# About always right most #}
{# About always right most #}
<a id='main-about' class='nav-link' href='{{ url_for('main.about') }}'>About</a>
{% endif %}
{# Only show logout if unauthenticated #}
{% if current_user.is_authenticated %}

View File

@ -12,49 +12,23 @@
<h4 class="text-center">Contributors</h4>
<div class="row">
<div class="col text-right">
Developer:
</div>
<div class="col">
Aronwk (Aaron Kimbrell)
<div class="col text-center">
Online Players: {{ online }}
</div>
</div>
<div class="row">
<div class="col text-right">
Developer:
{% for mod in mods %}
<div class="row">
<div class="col text-right">
{{ mod.username }}
</div>
<div class="col">
{% with gm_level=mod.gm_level %}
{% include 'partials/_gm_level.html.j2' %}
{% endwith %}
</div>
</div>
<div class="col">
Wincent
</div>
</div>
<div class="row">
<div class="col text-right">
Logo Designer:
</div>
<div class="col">
BlasterBuilder
</div>
</div>
<div class="row">
<div class="col text-right">
LDD/LXFML Rendering:
</div>
<div class="col">
m2m/sttng
</div>
</div>
<div class="row">
<div class="col text-right">
Developer:
</div>
<div class="col">
Jett.
</div>
</div>
{% endfor %}
<hr>
<div class="row">