Files
Ske_Signage/app/routes/dashboard.py
2025-07-16 08:03:57 +03:00

36 lines
901 B
Python

"""
Dashboard routes
"""
from flask import Blueprint, render_template
from flask_login import login_required
from app.models.player import Player
from app.models.group import Group
from app.utils.logger import get_recent_logs
import os
bp = Blueprint('dashboard', __name__)
@bp.route('/')
@login_required
def index():
"""Main dashboard"""
players = Player.query.order_by(Player.username).all()
groups = Group.query.order_by(Group.name).all()
# Check if logo exists
from flask import current_app
logo_path = os.path.join(current_app.static_folder, 'assets', 'logo.png')
logo_exists = os.path.exists(logo_path)
# Get recent server logs
server_logs = get_recent_logs(20)
return render_template(
'dashboard/index.html',
players=players,
groups=groups,
logo_exists=logo_exists,
server_logs=server_logs
)