Files
smoa/docs/web-scaffold/index.html
defiQUG 5a8c26cf5d Backend, sync, infra, docs: ETag, API versioning, k8s, web scaffold, Android 16, domain stubs
- Backend: ShallowEtagHeaderFilter for /api/v1/*, API-VERSIONING.md, README (tenant, CORS, Flyway, ETag)
- k8s: backend-deployment.yaml (Deployment, Service, Secret/ConfigMap)
- Web: scaffold with directory pull, 304 handling, touch-friendly UI
- Android 16: ANDROID-16-TARGET.md; BuildConfig STUN/signaling, SMOAApplication configures InfrastructureManager
- Domain: CertificateManager revocation stub, ReportService signReports, ZeroTrust/ThreatDetection minimal docs
- TODO.md and IMPLEMENTATION_STATUS.md updated; communications README for endpoint config

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-10 20:37:01 -08:00

73 lines
3.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<title>SMOA Web</title>
<style>
* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; margin: 1rem; max-width: 900px; }
input, button { padding: 0.5rem 0.75rem; margin: 0.25rem; }
button { cursor: pointer; background: #2563eb; color: #fff; border: none; border-radius: 6px; }
button:disabled { opacity: 0.6; cursor: not-allowed; }
#out { white-space: pre-wrap; background: #f1f5f9; padding: 1rem; margin-top: 1rem; border-radius: 8px; font-size: 0.875rem; }
.section { margin-top: 1.5rem; }
ul { list-style: none; padding: 0; }
li { padding: 0.35rem 0; border-bottom: 1px solid #e2e8f0; }
.error { color: #dc2626; }
@media (pointer: coarse) { button { min-height: 44px; } }
</style>
</head>
<body>
<h1>SMOA Web</h1>
<p>Base URL: <input id="baseUrl" value="http://localhost:8080" size="40" placeholder="http://localhost:8080" /></p>
<p>API key: <input id="apiKey" type="password" size="24" placeholder="optional" /></p>
<p>
<button id="btnInfo">API info</button>
<button id="btnHealth">Health</button>
<button id="btnDirectory">Pull directory</button>
</p>
<div class="section">
<h2>Directory (pull)</h2>
<ul id="directoryList"></ul>
<p id="dirStatus"></p>
</div>
<pre id="out"></pre>
<script>
function base() { return document.getElementById('baseUrl').value.replace(/\/$/, ''); }
function key() { return document.getElementById('apiKey').value.trim() || null; }
function headers() { var h = { 'Content-Type': 'application/json' }; if (key()) h['X-API-Key'] = key(); return h; }
function out(t) { document.getElementById('out').textContent = t; }
function dirList(html) { document.getElementById('directoryList').innerHTML = html; }
function dirStatus(t) { document.getElementById('dirStatus').textContent = t; }
document.getElementById('btnInfo').onclick = function() {
fetch(base() + '/api/v1/info', { headers: headers() }).then(function(r) { return r.json(); }).then(function(j) { out(JSON.stringify(j, null, 2)); }).catch(function(e) { out('Error: ' + e.message); });
};
document.getElementById('btnHealth').onclick = function() {
fetch(base() + '/health').then(function(r) { return r.json(); }).then(function(j) { out(JSON.stringify(j, null, 2)); }).catch(function(e) { out('Error: ' + e.message); });
};
document.getElementById('btnDirectory').onclick = function() {
var btn = document.getElementById('btnDirectory');
btn.disabled = true;
dirStatus('Loading…');
fetch(base() + '/api/v1/directory', { headers: headers() })
.then(function(r) {
if (r.status === 304) { dirStatus('Not modified (304)'); return []; }
return r.json();
})
.then(function(arr) {
if (!Array.isArray(arr)) { dirStatus('Unexpected response'); return; }
if (arr.length === 0) { dirList('<li>No entries</li>'); dirStatus('Empty list'); }
else {
dirList(arr.map(function(e) { return '<li>' + (e.name || e.id) + ' — ' + (e.unit || '') + '</li>'; }).join(''));
dirStatus('Loaded ' + arr.length + ' entries');
}
})
.catch(function(e) { dirStatus('Error: ' + e.message); dirList(''); })
.then(function() { btn.disabled = false; });
};
</script>
</body>
</html>