52e7e478e4
Synology kit-connect (SPK): - wizard.sh — one-button Keylink IT fleet setup (auto-runs on install) - www/index.html — dark-themed local dashboard (same design as busrouter) - bin/serve-dashboard.sh — busybox httpd on port 8089 with CGI endpoints - start-stop-status updated to manage dashboard alongside daemon - INFO updated: RT2600ac + RT6600ax compatibility noted - postinst now runs wizard --auto for first-time setup GL kit-connect (OpenWrt ipk): - Makefile — DEPENDS: +curl +openssh-client +tailscale - procd init — USE_PROCD=1, respawn with 5s delay - connect-daemon.sh — Tailscale + reverse SSH (same as Synology version) - connect-wizard.sh — one-button setup, idempotent, UCI config - connect-register.sh — standalone hub registration - www/kitconnect/index.html — dark-themed dashboard with wizard button - www/kitconnect/wizard.cgi — web-triggered wizard endpoint - UCI config at /etc/config/kitconnect Both platforms share: same hub protocol, same Tailscale key, same port pool. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
186 lines
7.8 KiB
HTML
186 lines
7.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Kit Connect — Fleet Status</title>
|
|
<style>
|
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
background: #0d1117; color: #e6edf3; min-height: 100vh; }
|
|
.header { background: linear-gradient(135deg, #2563EB, #1d4ed8);
|
|
padding: 16px 24px; display: flex; align-items: center; gap: 14px;
|
|
border-bottom: 2px solid #60a5fa; }
|
|
.logo { font-size: 22px; font-weight: 700; letter-spacing: 1px; color: #fff; }
|
|
.logo span { color: #93c5fd; }
|
|
.sub { font-size: 12px; color: #bfdbfe; letter-spacing: 2px; text-transform: uppercase; }
|
|
.refresh { margin-left: auto; font-size: 11px; color: #93c5fd; }
|
|
.container { max-width: 800px; margin: 0 auto; padding: 20px 16px; }
|
|
.card { background: #161b22; border: 1px solid #30363d; border-radius: 8px;
|
|
padding: 20px; margin-bottom: 16px; }
|
|
.card-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
|
|
color: #8b949e; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
|
|
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px;
|
|
font-size: 11px; font-weight: 700; }
|
|
.badge-ok { background: #1a4a2e; color: #3fb950; border: 1px solid #3fb950; }
|
|
.badge-warn { background: #3d2b00; color: #d29922; border: 1px solid #d29922; }
|
|
.badge-err { background: #4a1a1a; color: #f85149; border: 1px solid #f85149; }
|
|
.badge-info { background: #1a2a4a; color: #58a6ff; border: 1px solid #58a6ff; }
|
|
.row { display: flex; justify-content: space-between; align-items: center;
|
|
padding: 8px 0; border-bottom: 1px solid #21262d; }
|
|
.row:last-child { border: none; }
|
|
.label { color: #8b949e; font-size: 14px; }
|
|
.value { font-weight: 600; font-size: 14px; font-family: "SF Mono", "Consolas", monospace; }
|
|
.btn { display: inline-flex; align-items: center; gap: 8px;
|
|
padding: 10px 24px; border-radius: 6px; border: none; cursor: pointer;
|
|
font-size: 14px; font-weight: 600; transition: all 0.2s; }
|
|
.btn-wizard { background: linear-gradient(135deg, #2563EB, #1d4ed8); color: #fff; width: 100%;
|
|
justify-content: center; font-size: 15px; padding: 14px; }
|
|
.btn-wizard:hover { background: linear-gradient(135deg, #3b82f6, #2563EB); transform: translateY(-1px); }
|
|
.btn-wizard:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
|
|
.btn-sm { padding: 4px 12px; font-size: 12px; }
|
|
.btn-danger { background: #8b1a1a; color: #fff; border: 1px solid #f85149; }
|
|
.output { margin-top: 12px; padding: 12px; background: #0d1117; border-radius: 5px;
|
|
font-family: "SF Mono", "Consolas", monospace; font-size: 12px;
|
|
white-space: pre-wrap; color: #3fb950; display: none; max-height: 300px; overflow-y: auto; }
|
|
.ring { position: relative; width: 48px; height: 48px; float: right; margin-top: -4px; }
|
|
.ring canvas { position: absolute; top: 0; left: 0; }
|
|
.ring-num { position: absolute; top: 0; left: 0; width: 48px; text-align: center;
|
|
line-height: 48px; font-size: 13px; font-weight: 700; }
|
|
.footer { text-align: center; padding: 12px; font-size: 11px; color: #484f58;
|
|
border-top: 1px solid #21262d; margin-top: 20px; }
|
|
#wiz-out { margin-top: 12px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<div>
|
|
<div class="logo">KIT <span>CONNECT</span></div>
|
|
<div class="sub">Keylink IT Fleet Connectivity</div>
|
|
</div>
|
|
<div class="refresh" id="ts">Loading…</div>
|
|
</div>
|
|
<div class="container">
|
|
|
|
<!-- Setup Wizard card -->
|
|
<div class="card">
|
|
<div class="card-title">⚡ One-Click Setup</div>
|
|
<p style="font-size:13px;color:#8b949e;margin-bottom:12px">
|
|
Configures all Keylink IT defaults — device ID, fleet hub, Tailscale, reverse SSH tunnel.
|
|
Safe to run multiple times.
|
|
</p>
|
|
<button class="btn btn-wizard" id="wiz-btn" onclick="runWizard()">
|
|
🔧 Run Setup Wizard
|
|
</button>
|
|
<div class="output" id="wiz-out"></div>
|
|
</div>
|
|
|
|
<!-- Status card -->
|
|
<div class="card">
|
|
<div class="card-title">📡 Connectivity Status</div>
|
|
<div id="status-body">
|
|
<div class="row"><span class="label">Loading…</span></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="footer">
|
|
kit-connect v0.1.0 · device: <span id="dev-id">-</span> ·
|
|
<span id="footer-ts"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
var ESC = function(s) { return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); };
|
|
|
|
function ring(id, pct, color) {
|
|
var c = document.getElementById(id);
|
|
if (!c) return;
|
|
var ctx = c.getContext('2d'), cx = 24, cy = 24, r = 20;
|
|
ctx.clearRect(0, 0, 48, 48);
|
|
ctx.lineWidth = 5; ctx.strokeStyle = '#21262d';
|
|
ctx.beginPath(); ctx.arc(cx, cy, r, 0, Math.PI * 2); ctx.stroke();
|
|
ctx.strokeStyle = color || '#3fb950';
|
|
ctx.beginPath(); ctx.arc(cx, cy, r, -Math.PI / 2, -Math.PI / 2 + (pct / 100) * Math.PI * 2); ctx.stroke();
|
|
}
|
|
|
|
function badge(label, type) {
|
|
return '<span class="badge badge-' + (type || 'info') + '">' + ESC(label) + '</span>';
|
|
}
|
|
|
|
function row(label, value, extra) {
|
|
return '<div class="row"><span class="label">' + ESC(label) + '</span>' +
|
|
'<span class="value">' + ESC(value) + (extra ? ' ' + extra : '') + '</span></div>';
|
|
}
|
|
|
|
function poll() {
|
|
fetch('/cgi-bin/busrouter-status')
|
|
.then(function(r) { return r.ok ? r.json() : Promise.reject(r.status); })
|
|
.then(function(d) {
|
|
document.getElementById('ts').textContent = 'Updated ' + new Date().toLocaleTimeString();
|
|
document.getElementById('dev-id').textContent = d.device_id || '-';
|
|
document.getElementById('footer-ts').textContent = new Date().toLocaleTimeString();
|
|
|
|
// Connectivity status (best-effort from existing CGIs)
|
|
var html = '';
|
|
html += row('Device', d.device_id || '-');
|
|
html += row('Uptime', fmtUptime(d.uptime || 0));
|
|
html += row('Version', d.version || 'dev');
|
|
|
|
// Tunnel/connectivity info from kit-connect state
|
|
html += '<div style="margin-top:12px;padding-top:8px;border-top:1px solid #30363d"></div>';
|
|
fetch('/kitconnect/wizard.cgi?action=status')
|
|
.then(function(r) { return r.text(); })
|
|
.then(function(t) {
|
|
var extra = document.createElement('div');
|
|
extra.innerHTML = t;
|
|
document.getElementById('status-body').innerHTML +=
|
|
'<div style="margin-top:8px;font-size:13px;color:#8b949e;white-space:pre-wrap">' +
|
|
ESC(t.substring(0, 500)) + '</div>';
|
|
})
|
|
.catch(function(){});
|
|
|
|
document.getElementById('status-body').innerHTML = html;
|
|
})
|
|
.catch(function(e) {
|
|
document.getElementById('status-body').innerHTML =
|
|
'<div class="row"><span class="label" style="color:#f85149">Status unavailable (' + ESC(String(e)) + ')</span></div>';
|
|
});
|
|
}
|
|
|
|
function fmtUptime(s) {
|
|
var d = Math.floor(s / 86400), h = Math.floor((s % 86400) / 3600), m = Math.floor((s % 3600) / 60);
|
|
if (d) return d + 'd ' + h + 'h'; if (h) return h + 'h ' + m + 'm'; return m + 'm';
|
|
}
|
|
|
|
function runWizard() {
|
|
var btn = document.getElementById('wiz-btn');
|
|
var out = document.getElementById('wiz-out');
|
|
btn.disabled = true;
|
|
btn.textContent = '⏳ Running Setup Wizard…';
|
|
out.style.display = 'block';
|
|
out.textContent = 'Connecting to hub...\n';
|
|
|
|
fetch('/kitconnect/wizard.cgi', { method: 'POST' })
|
|
.then(function(r) { return r.text(); })
|
|
.then(function(t) {
|
|
out.textContent = t;
|
|
out.style.color = t.includes('COMPLETE') || t.includes('already registered') ? '#3fb950' : '#d29922';
|
|
})
|
|
.catch(function(e) {
|
|
out.textContent = 'ERROR: ' + e;
|
|
out.style.color = '#f85149';
|
|
})
|
|
.finally(function() {
|
|
btn.disabled = false;
|
|
btn.textContent = '🔧 Run Setup Wizard';
|
|
// Refresh status
|
|
setTimeout(poll, 2000);
|
|
});
|
|
}
|
|
|
|
poll();
|
|
setInterval(poll, 30000);
|
|
</script>
|
|
</body>
|
|
</html>
|