Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import secrets
import hashlib
import hmac
import logging

from fastapi import (
FastAPI,
Expand All @@ -31,6 +32,8 @@

app.add_middleware(SessionMiddleware, secret_key=os.environ.get("SESSION_SECRET", "nodeprobe-secret"))

logger = logging.getLogger("uvicorn.error")

templates = Jinja2Templates(directory=str(Path(__file__).resolve().parent / "templates"))


Expand Down Expand Up @@ -74,7 +77,7 @@ def create_default_user():
)
db.add(user)
db.commit()
print(
logger.info(
f"Initial admin credentials - username: NodeProbe password: {password}"
)
finally:
Expand Down
48 changes: 35 additions & 13 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,41 @@ function App() {
<div className="space-y-2">
<h2 className="text-xl mb-2 text-center">Recent Tests</h2>
{records.length > 0 ? (
<ul className="text-sm space-y-1">
{records
.slice(-5)
.reverse()
.map((r) => (
<li key={r.id}>
{maskIp(r.client_ip)}
{r.location && r.location !== 'Unknown' && ` - ${r.location}`} -{' '}
{typeof r.ping_ms === 'number' && `${r.ping_ms.toFixed(2)} ms - `}
{new Date(r.timestamp).toLocaleString()}
</li>
))}
</ul>
<div className="overflow-x-auto">
<table className="min-w-full text-sm">
<thead>
<tr>
<th className="px-2 py-1 text-left">IP</th>
<th className="px-2 py-1 text-left">Location</th>
<th className="px-2 py-1 text-left">ASN</th>
<th className="px-2 py-1 text-left">ISP</th>
<th className="px-2 py-1 text-left">Ping</th>
<th className="px-2 py-1 text-left">Recorded</th>
</tr>
</thead>
<tbody>
{records
.slice(-5)
.reverse()
.map((r) => (
<tr key={r.id}>
<td className="px-2 py-1">{maskIp(r.client_ip)}</td>
<td className="px-2 py-1">
{r.location && r.location !== 'Unknown' ? r.location : ''}
</td>
<td className="px-2 py-1">{r.asn || ''}</td>
<td className="px-2 py-1">{r.isp || ''}</td>
<td className="px-2 py-1">
{typeof r.ping_ms === 'number' ? `${r.ping_ms.toFixed(2)} ms` : ''}
</td>
<td className="px-2 py-1">
{new Date(r.timestamp).toLocaleString()}
</td>
</tr>
))}
</tbody>
</table>
</div>
) : (
<div className="text-sm text-center text-gray-400">
{recordsMessage || 'No test records found. Run a test to get started.'}
Expand Down