VPN-Session-History-FastAPI/templates/view.html
2025-04-10 21:40:30 +02:00

99 lines
No EOL
3.4 KiB
HTML

{% extends "base.html" %}
{% block content %}
<h2>VPN Session Details</h2>
<p><a href="/">&larr; Back to all logs</a></p>
<div class="api-info">
<h3>API Endpoints</h3>
<p>Get log content via API: <a href="/api/log-content/{{ filename }}" target="_blank">/api/log-content/{{ filename }}</a></p>
</div>
<div class="log-info">
<p><strong>Gateway:</strong> {{ gateway }}</p>
<p><strong>Timestamp:</strong> {{ timestamp.strftime('%Y-%m-%d %H:%M:%S UTC') if timestamp else 'Unknown' }}</p>
<p><strong>Filename:</strong> {{ filename }}</p>
</div>
<h3>Log Content</h3>
{% if parsed_rows %}
<div class="table-container">
<table class="log-table">
<thead>
<tr>
{% for col in columns %}
<th>{{ col }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in parsed_rows %}
<tr>
{% if 'Index' in columns %}
<td>{{ row.index }}</td>
{% endif %}
{% if 'User' in columns %}
<td>{{ row.user.strip() if row.user else "" }}</td>
{% endif %}
{% if 'Group' in columns %}
<td>{{ row.group.strip() if row.group else "" }}</td>
{% endif %}
{# VPN Login Users fields #}
{% if 'Auth Type' in columns %}
<td>{{ row.auth_type.strip() if row.auth_type else "" }}</td>
{% endif %}
{% if 'Timeout' in columns %}
<td>{{ row.timeout.strip() if row.timeout else "" }}</td>
{% endif %}
{% if 'Auth-Timeout' in columns %}
<td>{{ row.auth_timeout.strip() if row.auth_timeout else "" }}</td>
{% endif %}
{% if 'From' in columns %}
<td>{{ row.from_ip.strip() if row.from_ip else "" }}</td>
{% endif %}
{% if 'HTTP in/out' in columns %}
<td>{{ row.http.strip() if row.http else "" }}</td>
{% endif %}
{% if 'HTTPS in/out' in columns %}
<td>{{ row.https.strip() if row.https else "" }}</td>
{% endif %}
{% if 'Two-factor Auth' in columns %}
<td>{{ row.two_factor.strip() if row.two_factor else "" }}</td>
{% endif %}
{# VPN Sessions fields #}
{% if 'Source IP' in columns %}
<td>{{ row.source_ip.strip() if row.source_ip else "" }}</td>
{% endif %}
{% if 'Duration' in columns %}
<td>{{ row.duration.strip() if row.duration else "" }}</td>
{% endif %}
{% if 'I/O Bytes' in columns %}
<td>{{ row.io_bytes.strip() if row.io_bytes else "" }}</td>
{% endif %}
{% if 'Tunnel/Dest IP' in columns %}
<td>{{ (row.tunnel_dest_ip.strip() if row.tunnel_dest_ip else "") }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<pre>{{ raw_content }}</pre>
{% endif %}
{% endblock %}