82 lines
2.9 KiB
HTML
82 lines
2.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Recent Connections</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<style>
|
|
body { margin: 20px; }
|
|
canvas { max-width: 100%; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1 class="mb-4">kürzlich verbunden... (in der letzten Minute)</h1>
|
|
<div class="mb-3">
|
|
<a href="{{ url_for('index') }}" class="btn btn-primary">Home</a>
|
|
<a href="{{ url_for('dashboard') }}" class="btn btn-primary">Dashboard</a>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-hover">
|
|
<thead class="table-info">
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Timestamp</th>
|
|
<th>Full Path</th>
|
|
<th>IP Address</th>
|
|
<th>User Agent</th>
|
|
<th>Referrer</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="connectionsTableBody">
|
|
<!-- Rows will be dynamically inserted here -->
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Socket.IO client library -->
|
|
<script src="https://cdn.socket.io/4.0.0/socket.io.min.js"></script>
|
|
<!-- Using vanilla JavaScript for dynamic DOM updates -->
|
|
<script>
|
|
const socket = io();
|
|
socket.on('recent_connections', function(data) {
|
|
const tbody = document.getElementById('connectionsTableBody');
|
|
tbody.innerHTML = ''; // Clear previous content
|
|
|
|
data.forEach(record => {
|
|
const row = document.createElement('tr');
|
|
|
|
// Create cells for each column
|
|
const idCell = document.createElement('td');
|
|
idCell.textContent = record.id;
|
|
const timestampCell = document.createElement('td');
|
|
timestampCell.textContent = record.timestamp;
|
|
const fullPathCell = document.createElement('td');
|
|
fullPathCell.textContent = record.full_path;
|
|
const ipCell = document.createElement('td');
|
|
ipCell.textContent = record.ip_address;
|
|
const userAgentCell = document.createElement('td');
|
|
userAgentCell.textContent = record.user_agent;
|
|
const referrerCell = document.createElement('td');
|
|
referrerCell.textContent = record.referrer;
|
|
|
|
// Append cells to the row
|
|
row.appendChild(idCell);
|
|
row.appendChild(timestampCell);
|
|
row.appendChild(fullPathCell);
|
|
row.appendChild(ipCell);
|
|
row.appendChild(userAgentCell);
|
|
row.appendChild(referrerCell);
|
|
|
|
// Append the row to the table body
|
|
tbody.appendChild(row);
|
|
});
|
|
});
|
|
</script>
|
|
<!-- Bootstrap 5 JS Bundle -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html>
|