## Summary * HTML files are now static, streamed directly to the client without modification * For any dynamic values, load via JSON APIs * For files page, we stream the JSON content as we scan the directory to avoid holding onto too much data ## Additional details * We were previously building up a very large string all generated on the X4 directly, we should be leveraging the browser * Fixes https://github.com/daveallie/crosspoint-reader/issues/94
130 lines
3.3 KiB
HTML
130 lines
3.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>CrossPoint Reader</title>
|
|
<style>
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
Oxygen, Ubuntu, sans-serif;
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
background-color: #f5f5f5;
|
|
color: #333;
|
|
}
|
|
h1 {
|
|
color: #2c3e50;
|
|
border-bottom: 2px solid #3498db;
|
|
padding-bottom: 10px;
|
|
}
|
|
h2 {
|
|
color: #34495e;
|
|
margin-top: 0;
|
|
}
|
|
.card {
|
|
background: white;
|
|
border-radius: 8px;
|
|
padding: 20px;
|
|
margin: 15px 0;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
}
|
|
.info-row {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
padding: 8px 0;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
.info-row:last-child {
|
|
border-bottom: none;
|
|
}
|
|
.label {
|
|
font-weight: 600;
|
|
color: #7f8c8d;
|
|
}
|
|
.value {
|
|
color: #2c3e50;
|
|
}
|
|
.status {
|
|
display: inline-block;
|
|
padding: 4px 12px;
|
|
border-radius: 12px;
|
|
background-color: #27ae60;
|
|
color: white;
|
|
font-size: 0.9em;
|
|
}
|
|
.nav-links {
|
|
margin: 20px 0;
|
|
}
|
|
.nav-links a {
|
|
display: inline-block;
|
|
padding: 10px 20px;
|
|
background-color: #3498db;
|
|
color: white;
|
|
text-decoration: none;
|
|
border-radius: 4px;
|
|
margin-right: 10px;
|
|
}
|
|
.nav-links a:hover {
|
|
background-color: #2980b9;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>📚 CrossPoint Reader</h1>
|
|
|
|
<div class="nav-links">
|
|
<a href="/">Home</a>
|
|
<a href="/files">File Manager</a>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h2>Device Status</h2>
|
|
<div class="info-row">
|
|
<span class="label">Version</span>
|
|
<span class="value" id="version"></span>
|
|
</div>
|
|
<div class="info-row">
|
|
<span class="label">WiFi Status</span>
|
|
<span class="status">Connected</span>
|
|
</div>
|
|
<div class="info-row">
|
|
<span class="label">IP Address</span>
|
|
<span class="value" id="ip-address"></span>
|
|
</div>
|
|
<div class="info-row">
|
|
<span class="label">Free Memory</span>
|
|
<span class="value" id="free-heap"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<p style="text-align: center; color: #95a5a6; margin: 0">
|
|
CrossPoint E-Reader • Open Source
|
|
</p>
|
|
</div>
|
|
<script>
|
|
async function fetchStatus() {
|
|
try {
|
|
const response = await fetch('/api/status');
|
|
if (!response.ok) {
|
|
throw new Error('Failed to fetch status: ' + response.status + ' ' + response.statusText);
|
|
}
|
|
const data = await response.json();
|
|
document.getElementById('version').textContent = data.version || 'N/A';
|
|
document.getElementById('ip-address').textContent = data.ip || 'N/A';
|
|
document.getElementById('free-heap').textContent = data.freeHeap
|
|
? data.freeHeap.toLocaleString() + ' bytes'
|
|
: 'N/A';
|
|
} catch (error) {
|
|
console.error('Error fetching status:', error);
|
|
}
|
|
}
|
|
|
|
// Fetch status on page load
|
|
window.onload = fetchStatus;
|
|
</script>
|
|
</body>
|
|
</html>
|