Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2875313ba0 |
@@ -221,6 +221,11 @@ func NewHandler(opts HandlerOptions) http.Handler {
|
||||
// ── Infrastructure ──────────────────────────────────────────────────────
|
||||
mux.HandleFunc("GET /healthz", h.handleHealthz)
|
||||
mux.HandleFunc("GET /api/ready", h.handleReady)
|
||||
mux.HandleFunc("GET /loading", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Cache-Control", "no-store")
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
_, _ = w.Write([]byte(loadingPageHTML))
|
||||
})
|
||||
|
||||
// ── Existing read-only endpoints (preserved for compatibility) ──────────
|
||||
mux.HandleFunc("GET /audit.json", h.handleAuditJSON)
|
||||
@@ -1207,37 +1212,106 @@ const loadingPageHTML = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>EASY-BEE</title>
|
||||
<title>EASY-BEE — Starting</title>
|
||||
<style>
|
||||
*{margin:0;padding:0;box-sizing:border-box}
|
||||
html,body{height:100%;background:#0f1117;display:flex;align-items:center;justify-content:center;font-family:'Courier New',monospace;color:#e2e8f0}
|
||||
.logo{font-size:13px;line-height:1.4;color:#f6c90e;margin-bottom:48px;white-space:pre}
|
||||
.spinner{width:48px;height:48px;border:4px solid #2d3748;border-top-color:#f6c90e;border-radius:50%;animation:spin .8s linear infinite;margin:0 auto 24px}
|
||||
.wrap{text-align:center;width:420px}
|
||||
.logo{font-size:11px;line-height:1.4;color:#f6c90e;margin-bottom:6px;white-space:pre;text-align:left}
|
||||
.subtitle{font-size:12px;color:#a0aec0;text-align:left;margin-bottom:24px;padding-left:2px}
|
||||
.spinner{width:36px;height:36px;border:3px solid #2d3748;border-top-color:#f6c90e;border-radius:50%;animation:spin .8s linear infinite;margin:0 auto 14px}
|
||||
.spinner.hidden{display:none}
|
||||
@keyframes spin{to{transform:rotate(360deg)}}
|
||||
.status{font-size:14px;color:#a0aec0;letter-spacing:.05em}
|
||||
.status{font-size:13px;color:#a0aec0;margin-bottom:20px;min-height:18px}
|
||||
table{width:100%;border-collapse:collapse;font-size:12px;margin-bottom:20px;display:none}
|
||||
td{padding:3px 6px;text-align:left}
|
||||
td:first-child{color:#718096;width:55%}
|
||||
.ok{color:#68d391}
|
||||
.run{color:#f6c90e}
|
||||
.fail{color:#fc8181}
|
||||
.dim{color:#4a5568}
|
||||
.btn{background:#1a202c;color:#a0aec0;border:1px solid #2d3748;padding:7px 18px;font-size:12px;cursor:pointer;font-family:inherit;display:none}
|
||||
.btn:hover{border-color:#718096;color:#e2e8f0}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="text-align:center">
|
||||
<div class="wrap">
|
||||
<div class="logo"> ███████╗ █████╗ ███████╗██╗ ██╗ ██████╗ ███████╗███████╗
|
||||
██╔════╝██╔══██╗██╔════╝╚██╗ ██╔╝ ██╔══██╗██╔════╝██╔════╝
|
||||
█████╗ ███████║███████╗ ╚████╔╝ █████╗██████╔╝█████╗ █████╗
|
||||
██╔══╝ ██╔══██║╚════██║ ╚██╔╝ ╚════╝██╔══██╗██╔══╝ ██╔══╝
|
||||
███████╗██║ ██║███████║ ██║ ██████╔╝███████╗███████╗
|
||||
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝</div>
|
||||
<div class="spinner"></div>
|
||||
<div class="status" id="s">Starting up...</div>
|
||||
<div class="subtitle">Hardware Audit LiveCD</div>
|
||||
<div class="spinner" id="spin"></div>
|
||||
<div class="status" id="st">Connecting to bee-web...</div>
|
||||
<table id="tbl"></table>
|
||||
<button class="btn" id="btn" onclick="go()">Open app now</button>
|
||||
</div>
|
||||
<script>
|
||||
function probe(){
|
||||
fetch('/api/ready',{cache:'no-store'})
|
||||
.then(function(r){
|
||||
if(r.ok){window.location.replace('/');}
|
||||
else{setTimeout(probe,1000);}
|
||||
(function(){
|
||||
var gone = false;
|
||||
function go(){ if(!gone){gone=true;window.location.replace('/');} }
|
||||
|
||||
function icon(s){
|
||||
if(s==='active') return '<span class="ok">● active</span>';
|
||||
if(s==='failed') return '<span class="fail">✕ failed</span>';
|
||||
if(s==='activating'||s==='reloading') return '<span class="run">○ starting</span>';
|
||||
if(s==='inactive') return '<span class="dim">○ inactive</span>';
|
||||
return '<span class="dim">'+s+'</span>';
|
||||
}
|
||||
|
||||
function allSettled(svcs){
|
||||
for(var i=0;i<svcs.length;i++){
|
||||
var s=svcs[i].state;
|
||||
if(s!=='active'&&s!=='failed'&&s!=='inactive') return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
var pollTimer=null;
|
||||
|
||||
function pollServices(){
|
||||
fetch('/api/services',{cache:'no-store'})
|
||||
.then(function(r){return r.json();})
|
||||
.then(function(svcs){
|
||||
if(!svcs||!svcs.length) return;
|
||||
var tbl=document.getElementById('tbl');
|
||||
tbl.style.display='';
|
||||
var html='';
|
||||
for(var i=0;i<svcs.length;i++)
|
||||
html+='<tr><td>'+svcs[i].name+'</td><td>'+icon(svcs[i].state)+'</td></tr>';
|
||||
tbl.innerHTML=html;
|
||||
if(allSettled(svcs)){
|
||||
clearInterval(pollTimer);
|
||||
document.getElementById('spin').className='spinner hidden';
|
||||
document.getElementById('st').textContent='Ready \u2014 opening...';
|
||||
setTimeout(go,800);
|
||||
}
|
||||
})
|
||||
.catch(function(){setTimeout(probe,1000);});
|
||||
.catch(function(){});
|
||||
}
|
||||
|
||||
function probe(){
|
||||
fetch('/healthz',{cache:'no-store'})
|
||||
.then(function(r){
|
||||
if(r.ok){
|
||||
document.getElementById('st').textContent='bee-web running \u2014 checking services...';
|
||||
document.getElementById('btn').style.display='';
|
||||
pollServices();
|
||||
pollTimer=setInterval(pollServices,1500);
|
||||
} else {
|
||||
document.getElementById('st').textContent='bee-web starting (status '+r.status+')...';
|
||||
setTimeout(probe,500);
|
||||
}
|
||||
})
|
||||
.catch(function(){
|
||||
document.getElementById('st').textContent='Waiting for bee-web to start...';
|
||||
setTimeout(probe,500);
|
||||
});
|
||||
}
|
||||
probe();
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>`
|
||||
|
||||
@@ -7,6 +7,7 @@ echo " █████╗ ███████║███████╗ ╚
|
||||
echo " ██╔══╝ ██╔══██║╚════██║ ╚██╔╝ ╚════╝██╔══██╗██╔══╝ ██╔══╝"
|
||||
echo " ███████╗██║ ██║███████║ ██║ ██████╔╝███████╗███████╗"
|
||||
echo " ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝"
|
||||
echo " Hardware Audit LiveCD"
|
||||
echo ""
|
||||
|
||||
menuentry "EASY-BEE" {
|
||||
|
||||
@@ -31,6 +31,7 @@ systemctl enable bee-audit.service
|
||||
systemctl enable bee-web.service
|
||||
systemctl enable bee-sshsetup.service
|
||||
systemctl enable bee-selfheal.timer
|
||||
systemctl enable bee-boot-status.service
|
||||
systemctl enable ssh.service
|
||||
systemctl enable lightdm.service 2>/dev/null || true
|
||||
systemctl enable qemu-guest-agent.service 2>/dev/null || true
|
||||
@@ -59,7 +60,8 @@ chmod +x /usr/local/bin/bee-sshsetup 2>/dev/null || true
|
||||
chmod +x /usr/local/bin/bee-smoketest 2>/dev/null || true
|
||||
chmod +x /usr/local/bin/bee 2>/dev/null || true
|
||||
chmod +x /usr/local/bin/bee-log-run 2>/dev/null || true
|
||||
chmod +x /usr/local/bin/bee-selfheal 2>/dev/null || true
|
||||
chmod +x /usr/local/bin/bee-selfheal 2>/dev/null || true
|
||||
chmod +x /usr/local/bin/bee-boot-status 2>/dev/null || true
|
||||
if [ "$GPU_VENDOR" = "nvidia" ]; then
|
||||
chmod +x /usr/local/bin/bee-nvidia-load 2>/dev/null || true
|
||||
chmod +x /usr/local/bin/bee-gpu-burn 2>/dev/null || true
|
||||
|
||||
17
iso/overlay/etc/systemd/system/bee-boot-status.service
Normal file
17
iso/overlay/etc/systemd/system/bee-boot-status.service
Normal file
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Bee: boot status display
|
||||
DefaultDependencies=no
|
||||
After=systemd-user-sessions.service
|
||||
Before=getty@tty1.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=no
|
||||
ExecStart=/usr/local/bin/bee-boot-status
|
||||
TTYPath=/dev/tty1
|
||||
StandardInput=tty
|
||||
StandardOutput=tty
|
||||
StandardError=tty
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,2 @@
|
||||
[Unit]
|
||||
After=bee-boot-status.service
|
||||
@@ -1,6 +1,4 @@
|
||||
[Unit]
|
||||
Wants=bee-preflight.service
|
||||
After=bee-preflight.service
|
||||
|
||||
[Service]
|
||||
ExecStartPre=/usr/local/bin/bee-display-mode
|
||||
|
||||
56
iso/overlay/usr/local/bin/bee-boot-status
Normal file
56
iso/overlay/usr/local/bin/bee-boot-status
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/bin/sh
|
||||
# bee-boot-status — boot progress display on tty1.
|
||||
# Shows live service status until all bee services are done or failed,
|
||||
# then exits so getty can show the login prompt.
|
||||
# GUI (lightdm) starts independently without waiting for this.
|
||||
|
||||
# Services to wait for before handing off to login prompt.
|
||||
CRITICAL="bee-preflight bee-nvidia bee-audit"
|
||||
# Additional services shown for information only.
|
||||
ALL="bee-preflight bee-network bee-nvidia bee-audit bee-web"
|
||||
|
||||
svc_icon() {
|
||||
case "$(systemctl is-active "$1.service" 2>/dev/null)" in
|
||||
active) printf '\033[32m[ OK ]\033[0m' ;;
|
||||
failed) printf '\033[31m[ FAIL ]\033[0m' ;;
|
||||
activating) printf '\033[33m[ .. ]\033[0m' ;;
|
||||
*) printf '[ ]' ;;
|
||||
esac
|
||||
}
|
||||
|
||||
all_critical_done() {
|
||||
for svc in $CRITICAL; do
|
||||
case "$(systemctl is-active "$svc.service" 2>/dev/null)" in
|
||||
active|failed|inactive) ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
while true; do
|
||||
printf '\033[H\033[2J'
|
||||
printf '\n'
|
||||
printf ' \033[33m███████╗ █████╗ ███████╗██╗ ██╗ ██████╗ ███████╗███████╗\033[0m\n'
|
||||
printf ' \033[33m██╔════╝██╔══██╗██╔════╝╚██╗ ██╔╝ ██╔══██╗██╔════╝██╔════╝\033[0m\n'
|
||||
printf ' \033[33m█████╗ ███████║███████╗ ╚████╔╝ █████╗██████╔╝█████╗ █████╗\033[0m\n'
|
||||
printf ' \033[33m██╔══╝ ██╔══██║╚════██║ ╚██╔╝ ╚════╝██╔══██╗██╔══╝ ██╔══╝\033[0m\n'
|
||||
printf ' \033[33m███████╗██║ ██║███████║ ██║ ██████╔╝███████╗███████╗\033[0m\n'
|
||||
printf ' \033[33m╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝\033[0m\n'
|
||||
printf ' Hardware Audit LiveCD\n'
|
||||
printf '\n'
|
||||
for svc in $ALL; do
|
||||
printf ' %s %s\n' "$(svc_icon $svc)" "$svc"
|
||||
done
|
||||
printf '\n'
|
||||
|
||||
if all_critical_done; then
|
||||
printf ' \033[1mSystem ready.\033[0m Audit is running in the background.\n'
|
||||
printf ' Web UI will be available at \033[1mhttp://<ip>/\033[0m when done.\n'
|
||||
printf '\n'
|
||||
sleep 2
|
||||
break
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
done
|
||||
@@ -9,22 +9,14 @@ xset s noblank
|
||||
|
||||
tint2 &
|
||||
|
||||
# Wait up to 120s for bee-web to bind. The web server starts immediately now
|
||||
# (audit is deferred), so this should succeed in a few seconds on most hardware.
|
||||
i=0
|
||||
while [ $i -lt 120 ]; do
|
||||
if curl -sf http://localhost/healthz >/dev/null 2>&1; then break; fi
|
||||
sleep 1
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
chromium \
|
||||
--disable-infobars \
|
||||
--disable-translate \
|
||||
--no-first-run \
|
||||
--disable-session-crashed-bubble \
|
||||
--disable-features=TranslateUI \
|
||||
--user-data-dir=/tmp/bee-chrome \
|
||||
--start-maximized \
|
||||
http://localhost/ &
|
||||
http://localhost/loading &
|
||||
|
||||
exec openbox
|
||||
|
||||
Reference in New Issue
Block a user