implement online history

This commit is contained in:
ghost 2024-01-06 22:07:18 +02:00
parent 2071796a07
commit 272d219066
8 changed files with 495 additions and 10 deletions

View file

@ -27,15 +27,15 @@
{% endfor %}
</table>
{% endif %}
{% if server.online %}
<h3 class="padding-y-8-px text-align-right">{{ 'Online' | trans }}</h3>
{% if server.session %}
<h3 class="padding-y-8-px text-align-right">{{ 'Session' | trans }}</h3>
<table>
<tr>
<th class="text-align-left">{{ 'Name' | trans }}</th>
<th class="text-align-center">{{ 'Frags' | trans }}</th>
<th class="text-align-center">{{ 'Time' | trans }}</th>
</tr>
{% for player in server.online %}
{% for player in server.session %}
<tr>
<td class="text-align-left">{{ player.Name }}</td>
<td class="text-align-center">{{ player.Frags }}</td>
@ -52,6 +52,30 @@
{% endfor %}
</table>
{% endif %}
{% if server.online %}
<h3 class="padding-y-8-px text-align-right">
{{ 'Online' | trans }}
<a href="{{ path('rss_online', { crc32server : server.crc32server }) }}" title="{{ 'RSS' | trans }}"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" viewBox="0 0 16 16">
<path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zm1.5 2.5c5.523 0 10 4.477 10 10a1 1 0 1 1-2 0 8 8 0 0 0-8-8 1 1 0 0 1 0-2m0 4a6 6 0 0 1 6 6 1 1 0 1 1-2 0 4 4 0 0 0-4-4 1 1 0 0 1 0-2m.5 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3"/>
</svg></a>
</h3>
<table>
<tr>
<th class="text-align-left">{{ 'Time' | trans }}</th>
<th class="text-align-center">{{ 'Players' | trans }}</th>
<th class="text-align-center">{{ 'Bots' | trans }}</th>
<th class="text-align-center">{{ 'Total' | trans }}</th>
</tr>
{% for online in server.online %}
<tr>
<td class="text-align-left">{{ online.time | format_datetime }}</td>
<td class="text-align-center">{{ online.players }}</td>
<td class="text-align-center">{{ online.bots }}</td>
<td class="text-align-center">{{ online.total }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
</div>
{% endfor %}
{% endblock %}

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<atom:link href="{{ url('main_index') }}" rel="self" type="application/rss+xml"></atom:link>
<title>{{ server.host }}:{{ server.port }} - {{ app.name }}</title>
<link>{{ url('main_index') }}</link>
{% for value in online %}
<item>
<title>{{ 'Online changed!' | trans }}</title>
<guid>{{ value.id }}</guid>
<description>
{{ 'Players' | trans }}: {{ value.players }}
{{ 'Bots' | trans }}: {{ value.bots }}
{{ 'Total' | trans }}: {{ value.total }}
</description>
</item>
{% endfor %}
</channel>
</rss>