adding a wizard for setup
This commit is contained in:
+436
-54
@@ -293,6 +293,125 @@
|
||||
.retry-btn.active {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* ── Setup Wizard ──────────────────────────────────────────── */
|
||||
.setup-wizard {
|
||||
display: none;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: #0a0a1a;
|
||||
z-index: 200;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40px 20px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.setup-wizard.active { display: flex; }
|
||||
|
||||
.setup-step {
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
max-width: 520px;
|
||||
width: 100%;
|
||||
animation: fadeIn 0.3s ease-out;
|
||||
}
|
||||
.setup-step.active { display: flex; }
|
||||
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
|
||||
|
||||
.setup-steps {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
.setup-dot {
|
||||
width: 10px; height: 10px;
|
||||
border-radius: 50%;
|
||||
background: rgba(255,255,255,0.15);
|
||||
transition: all 0.3s;
|
||||
}
|
||||
.setup-dot.done { background: #22d3ee; box-shadow: 0 0 6px rgba(34,211,238,0.5); }
|
||||
.setup-dot.current { background: #6366f1; box-shadow: 0 0 6px rgba(99,102,241,0.5); }
|
||||
|
||||
.setup-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
|
||||
.setup-subtitle { font-size: 14px; opacity: 0.5; margin-bottom: 28px; text-align: center; }
|
||||
|
||||
.setup-card {
|
||||
background: rgba(255,255,255,0.04);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.check-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 10px 0;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.04);
|
||||
}
|
||||
.check-row:last-child { border-bottom: none; }
|
||||
.check-icon { font-size: 18px; min-width: 24px; text-align: center; }
|
||||
.check-label { flex: 1; font-size: 14px; }
|
||||
.check-value { font-size: 12px; opacity: 0.5; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
|
||||
.setup-input {
|
||||
width: 100%;
|
||||
padding: 10px 14px;
|
||||
background: rgba(255,255,255,0.06);
|
||||
border: 1px solid rgba(255,255,255,0.12);
|
||||
border-radius: 8px;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
.setup-input:focus { border-color: #6366f1; }
|
||||
|
||||
.setup-btn {
|
||||
padding: 10px 28px;
|
||||
background: linear-gradient(135deg, #6366f1, #8b5cf6);
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
.setup-btn:hover { opacity: 0.85; }
|
||||
.setup-btn:disabled { opacity: 0.4; cursor: not-allowed; }
|
||||
.setup-btn.outline {
|
||||
background: transparent;
|
||||
border: 1px solid rgba(255,255,255,0.15);
|
||||
}
|
||||
.setup-btn.outline:hover { background: rgba(255,255,255,0.06); }
|
||||
|
||||
.setup-btns { display: flex; gap: 12px; margin-top: 8px; }
|
||||
|
||||
.progress-bar {
|
||||
width: 100%;
|
||||
height: 8px;
|
||||
background: rgba(255,255,255,0.08);
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
margin: 12px 0;
|
||||
}
|
||||
.progress-fill {
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, #6366f1, #22d3ee);
|
||||
border-radius: 4px;
|
||||
transition: width 0.5s ease;
|
||||
width: 0%;
|
||||
}
|
||||
|
||||
.status-ok { color: #22d3ee; }
|
||||
.status-err { color: #ef4444; }
|
||||
.status-warn { color: #f59e0b; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -354,100 +473,363 @@
|
||||
<div class="error-msg" id="error-msg"></div>
|
||||
<button class="retry-btn" id="retry-btn" onclick="location.reload()">Try Again</button>
|
||||
|
||||
<!-- ── Setup Wizard ── -->
|
||||
<div class="setup-wizard" id="setup-wizard">
|
||||
<div class="setup-steps">
|
||||
<div class="setup-dot current" id="sdot-1"></div>
|
||||
<div class="setup-dot" id="sdot-2"></div>
|
||||
<div class="setup-dot" id="sdot-3"></div>
|
||||
<div class="setup-dot" id="sdot-4"></div>
|
||||
<div class="setup-dot" id="sdot-5"></div>
|
||||
</div>
|
||||
|
||||
<!-- Step 1: Welcome -->
|
||||
<div class="setup-step active" id="sstep-1">
|
||||
<div class="robot" style="margin-bottom:20px">
|
||||
<div class="robot-antenna"></div>
|
||||
<div class="robot-head"><div class="robot-eye left"></div><div class="robot-eye right"></div></div>
|
||||
<div class="robot-body">
|
||||
<div class="robot-arm left"></div><div class="robot-arm right"></div>
|
||||
<div class="robot-leg left"></div><div class="robot-leg right"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="setup-title">Welcome to CoastIT CRM</div>
|
||||
<div class="setup-subtitle">Let's check your environment before we start</div>
|
||||
<div class="setup-card" id="env-checks">
|
||||
<div class="check-row"><span class="check-icon" id="env-ollama">⏳</span><span class="check-label">Ollama</span><span class="check-value" id="env-ollama-val">checking...</span></div>
|
||||
<div class="check-row"><span class="check-icon" id="env-model">⏳</span><span class="check-label">AI Model</span><span class="check-value" id="env-model-val">checking...</span></div>
|
||||
<div class="check-row"><span class="check-icon" id="env-profile">⏳</span><span class="check-label">Browser Profile</span><span class="check-value" id="env-profile-val">checking...</span></div>
|
||||
<div class="check-row"><span class="check-icon" id="env-fb">⏳</span><span class="check-label">Facebook Login</span><span class="check-value" id="env-fb-val">checking...</span></div>
|
||||
</div>
|
||||
<button class="setup-btn" id="welcome-next" onclick="goStep(2)">Next →</button>
|
||||
</div>
|
||||
|
||||
<!-- Step 2: Browser Profile -->
|
||||
<div class="setup-step" id="sstep-2">
|
||||
<div class="setup-title">Browser Profile</div>
|
||||
<div class="setup-subtitle">We need a Firefox or Chrome profile with Facebook logged in</div>
|
||||
<div class="setup-card">
|
||||
<div class="check-row">
|
||||
<span class="check-icon" id="prof-auto-icon">⏳</span>
|
||||
<span class="check-label">Auto-detected</span>
|
||||
<span class="check-value" id="prof-auto-val">scanning...</span>
|
||||
</div>
|
||||
<div style="margin-top:14px;font-size:13px;opacity:0.5;margin-bottom:8px">Or enter the path manually:</div>
|
||||
<input class="setup-input" id="prof-input" placeholder="C:\Users\You\AppData\Roaming\Mozilla\Firefox\Profiles\..." oninput="onProfileInput()">
|
||||
<div style="margin-top:6px;font-size:12px;color:#22d3ee" id="prof-feedback"></div>
|
||||
</div>
|
||||
<div class="setup-btns">
|
||||
<button class="setup-btn outline" onclick="goStep(1)">← Back</button>
|
||||
<button class="setup-btn" id="prof-next" onclick="saveProfile()" disabled>Next →</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 3: Facebook Login -->
|
||||
<div class="setup-step" id="sstep-3">
|
||||
<div class="setup-title">Facebook Login</div>
|
||||
<div class="setup-subtitle">Make sure you're logged into Facebook in your browser</div>
|
||||
<div class="setup-card" style="text-align:center">
|
||||
<div style="font-size:48px;margin-bottom:12px" id="fb-icon">🔍</div>
|
||||
<div style="font-size:14px;opacity:0.7" id="fb-status">Click "Check Login" to verify</div>
|
||||
<div class="progress-bar" id="fb-progress" style="display:none;margin-top:16px"><div class="progress-fill" id="fb-progress-fill"></div></div>
|
||||
</div>
|
||||
<div class="setup-btns">
|
||||
<button class="setup-btn outline" onclick="goStep(2)">← Back</button>
|
||||
<button class="setup-btn" id="fb-check-btn" onclick="checkFacebookLogin()">Check Login</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 4: Ollama Model -->
|
||||
<div class="setup-step" id="sstep-4">
|
||||
<div class="setup-title">AI Model</div>
|
||||
<div class="setup-subtitle">We need to pull the AI model for the scraper to work</div>
|
||||
<div class="setup-card" style="text-align:center">
|
||||
<div style="font-size:14px;margin-bottom:8px;font-weight:600" id="model-name">dolphin-llama3:8b</div>
|
||||
<div class="progress-bar"><div class="progress-fill" id="model-progress-fill"></div></div>
|
||||
<div style="font-size:12px;opacity:0.5;margin-top:6px" id="model-status">Not downloaded yet</div>
|
||||
</div>
|
||||
<div class="setup-btns">
|
||||
<button class="setup-btn outline" onclick="goStep(3)">← Back</button>
|
||||
<button class="setup-btn" id="model-pull-btn" onclick="pullModel()">Pull Model</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 5: Done -->
|
||||
<div class="setup-step" id="sstep-5">
|
||||
<div style="font-size:64px;margin-bottom:16px">🎉</div>
|
||||
<div class="setup-title">All set!</div>
|
||||
<div class="setup-subtitle">Your environment is configured. We'll now start all services.</div>
|
||||
<div class="setup-card" id="final-checks" style="text-align:center">
|
||||
<div style="font-size:13px;opacity:0.7" id="final-summary">All checks passed</div>
|
||||
</div>
|
||||
<button class="setup-btn" onclick="finishSetup()" style="margin-top:8px">Launch 🚀</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// ── State ──
|
||||
let setupData = null;
|
||||
let currentStep = 1;
|
||||
const TOTAL_STEPS = 5;
|
||||
|
||||
// ── Normal loading state ──
|
||||
const MAX_ATTEMPTS = 30;
|
||||
let attempts = 0;
|
||||
|
||||
const CHECKS = [
|
||||
{ id: 'ai', key: 'ai', ready: false, failed: false },
|
||||
{ id: 'scraper', key: 'scraper', ready: false, failed: false },
|
||||
{ id: 'frontend',key: 'frontend', ready: false, failed: false },
|
||||
];
|
||||
|
||||
const MSGS = { ai: 'AI Ready', scraper: 'Scraper Ready', frontend: 'Frontend Ready' };
|
||||
const NAMES = { ai: 'AI Server', scraper: 'Scraper', frontend: 'Frontend' };
|
||||
|
||||
// ── Step navigation ──
|
||||
function goStep(n) {
|
||||
currentStep = n;
|
||||
document.querySelectorAll('.setup-step').forEach((el, i) => {
|
||||
el.classList.toggle('active', i + 1 === n);
|
||||
});
|
||||
document.querySelectorAll('.setup-dot').forEach((el, i) => {
|
||||
el.classList.toggle('current', i + 1 === n);
|
||||
el.classList.toggle('done', i + 1 < n);
|
||||
});
|
||||
}
|
||||
|
||||
// ── Step 1: Welcome / Env check ──
|
||||
async function checkEnv() {
|
||||
try {
|
||||
const res = await fetch('/setup/status');
|
||||
setupData = await res.json();
|
||||
} catch {
|
||||
setupData = { first_run: true, ollama_running: false, model_available: false, profile_detected: false, facebook_logged_in: false };
|
||||
}
|
||||
|
||||
setEnvStatus('ollama', setupData.ollama_running, setupData.ollama_running ? 'Running' : 'Not running');
|
||||
setEnvStatus('model', setupData.model_available, setupData.model_available ? `${setupData.model_name} ✓` : 'Not pulled');
|
||||
setEnvStatus('profile', setupData.profile_detected, setupData.profile_path || 'Not found');
|
||||
setEnvStatus('fb', setupData.facebook_logged_in, setupData.facebook_logged_in ? 'Logged in' : 'Not checked');
|
||||
|
||||
if (!setupData.first_run) {
|
||||
document.getElementById('setup-wizard').classList.remove('active');
|
||||
startNormalFlow();
|
||||
return;
|
||||
}
|
||||
document.getElementById('setup-wizard').classList.add('active');
|
||||
// Pre-fill step 2 fields
|
||||
updateProfileUI();
|
||||
}
|
||||
|
||||
function setEnvStatus(id, ok, label) {
|
||||
document.getElementById('env-' + id).textContent = ok ? '✅' : '❌';
|
||||
document.getElementById('env-' + id + '-val').textContent = label;
|
||||
}
|
||||
|
||||
// ── Step 2: Browser Profile ──
|
||||
function updateProfileUI() {
|
||||
const icon = document.getElementById('prof-auto-icon');
|
||||
const val = document.getElementById('prof-auto-val');
|
||||
const input = document.getElementById('prof-input');
|
||||
if (setupData.profile_path) {
|
||||
icon.textContent = '✅';
|
||||
val.textContent = setupData.profile_path;
|
||||
input.value = setupData.profile_path;
|
||||
document.getElementById('prof-next').disabled = false;
|
||||
} else {
|
||||
icon.textContent = '❌';
|
||||
val.textContent = 'None detected';
|
||||
}
|
||||
}
|
||||
|
||||
function onProfileInput() {
|
||||
const val = document.getElementById('prof-input').value.trim();
|
||||
const fb = document.getElementById('prof-feedback');
|
||||
const btn = document.getElementById('prof-next');
|
||||
if (!val) { fb.textContent = ''; btn.disabled = true; return }
|
||||
fb.textContent = 'Entered: ' + val;
|
||||
btn.disabled = false;
|
||||
}
|
||||
|
||||
async function saveProfile() {
|
||||
const path = document.getElementById('prof-input').value.trim();
|
||||
if (!path) return;
|
||||
const btn = document.getElementById('prof-next');
|
||||
btn.textContent = 'Saving...';
|
||||
btn.disabled = true;
|
||||
try {
|
||||
const res = await fetch('/setup/profile', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ path }) });
|
||||
const data = await res.json();
|
||||
if (data.success) {
|
||||
setupData.profile_detected = true;
|
||||
setupData.profile_path = path;
|
||||
goStep(3);
|
||||
} else {
|
||||
document.getElementById('prof-feedback').textContent = 'Error: ' + (data.error || 'failed');
|
||||
}
|
||||
} catch { document.getElementById('prof-feedback').textContent = 'Error: could not save'; }
|
||||
btn.textContent = 'Next →';
|
||||
btn.disabled = false;
|
||||
}
|
||||
|
||||
// ── Step 3: Facebook Login ──
|
||||
async function checkFacebookLogin() {
|
||||
const btn = document.getElementById('fb-check-btn');
|
||||
const status = document.getElementById('fb-status');
|
||||
const icon = document.getElementById('fb-icon');
|
||||
const prog = document.getElementById('fb-progress');
|
||||
const fill = document.getElementById('fb-progress-fill');
|
||||
btn.disabled = true;
|
||||
btn.textContent = 'Checking...';
|
||||
prog.style.display = 'block';
|
||||
fill.style.width = '50%';
|
||||
status.textContent = 'Opening Facebook...';
|
||||
|
||||
try {
|
||||
const path = setupData.profile_path || '';
|
||||
const res = await fetch('/setup/check-login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ profile_path: path }) });
|
||||
const data = await res.json();
|
||||
if (data.logged_in) {
|
||||
fill.style.width = '100%';
|
||||
icon.textContent = '✅';
|
||||
status.textContent = 'You are logged into Facebook!';
|
||||
status.className = 'status-ok';
|
||||
setupData.facebook_logged_in = true;
|
||||
setTimeout(() => goStep(4), 1000);
|
||||
} else {
|
||||
fill.style.width = '100%';
|
||||
icon.textContent = '❌';
|
||||
status.textContent = 'Not logged in. Log into Facebook in your browser and try again.';
|
||||
status.className = 'status-err';
|
||||
btn.textContent = 'Retry';
|
||||
btn.disabled = false;
|
||||
}
|
||||
} catch {
|
||||
icon.textContent = '❌';
|
||||
status.textContent = 'Could not reach the scraper service';
|
||||
status.className = 'status-err';
|
||||
btn.textContent = 'Retry';
|
||||
btn.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Step 4: Ollama Model ──
|
||||
let pullPolling = false;
|
||||
async function pullModel() {
|
||||
if (pullPolling) return;
|
||||
const btn = document.getElementById('model-pull-btn');
|
||||
const fill = document.getElementById('model-progress-fill');
|
||||
const status = document.getElementById('model-status');
|
||||
btn.disabled = true;
|
||||
btn.textContent = 'Starting...';
|
||||
|
||||
try {
|
||||
const res = await fetch('/setup/ollama/pull', { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (data.status === 'already_running') { btn.textContent = 'Already running'; return }
|
||||
btn.textContent = 'Downloading...';
|
||||
pullPolling = true;
|
||||
pollPullProgress();
|
||||
} catch {
|
||||
status.textContent = 'Failed to start download';
|
||||
status.className = 'status-err';
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'Retry';
|
||||
}
|
||||
}
|
||||
|
||||
async function pollPullProgress() {
|
||||
const fill = document.getElementById('model-progress-fill');
|
||||
const status = document.getElementById('model-status');
|
||||
const btn = document.getElementById('model-pull-btn');
|
||||
try {
|
||||
const res = await fetch('/setup/ollama/pull/progress');
|
||||
const data = await res.json();
|
||||
fill.style.width = data.progress + '%';
|
||||
if (data.status === 'done') {
|
||||
status.textContent = '✅ Model downloaded successfully!';
|
||||
status.className = 'status-ok';
|
||||
btn.textContent = 'Done';
|
||||
setupData.model_available = true;
|
||||
pullPolling = false;
|
||||
setTimeout(() => goStep(5), 1500);
|
||||
return;
|
||||
}
|
||||
if (data.status === 'failed') {
|
||||
status.textContent = '❌ Download failed: ' + data.message;
|
||||
status.className = 'status-err';
|
||||
btn.textContent = 'Retry';
|
||||
btn.disabled = false;
|
||||
pullPolling = false;
|
||||
return;
|
||||
}
|
||||
status.textContent = data.message || `Downloading... ${data.progress}%`;
|
||||
setTimeout(pollPullProgress, 1000);
|
||||
} catch {
|
||||
status.textContent = 'Checking...';
|
||||
setTimeout(pollPullProgress, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Step 5: Finish ──
|
||||
function finishSetup() {
|
||||
document.getElementById('setup-wizard').classList.remove('active');
|
||||
startNormalFlow();
|
||||
}
|
||||
|
||||
// ── Normal loading flow ──
|
||||
function startNormalFlow() {
|
||||
poll();
|
||||
}
|
||||
|
||||
async function checkAllServices() {
|
||||
try {
|
||||
const res = await fetch('/status', { cache: 'no-store' });
|
||||
const data = await res.json();
|
||||
for (const svc of CHECKS) {
|
||||
svc.ready = data[svc.key] === true;
|
||||
}
|
||||
for (const svc of CHECKS) svc.ready = data[svc.key] === true;
|
||||
} catch {
|
||||
for (const svc of CHECKS) svc.ready = false;
|
||||
}
|
||||
}
|
||||
|
||||
function updateUI() {
|
||||
let allReady = true;
|
||||
let anyFailed = false;
|
||||
let allReady = true, anyFailed = false;
|
||||
const failedNames = [];
|
||||
|
||||
for (const svc of CHECKS) {
|
||||
const el = document.getElementById('svc-' + svc.id);
|
||||
const statusText = document.getElementById('status-' + svc.id);
|
||||
const st = document.getElementById('status-' + svc.id);
|
||||
el.classList.remove('ready', 'failed');
|
||||
|
||||
if (svc.ready) {
|
||||
el.classList.add('ready');
|
||||
statusText.textContent = MSGS[svc.id];
|
||||
} else if (svc.failed) {
|
||||
el.classList.add('failed');
|
||||
statusText.textContent = 'Failed';
|
||||
anyFailed = true;
|
||||
allReady = false;
|
||||
failedNames.push(NAMES[svc.id]);
|
||||
} else {
|
||||
statusText.textContent = 'waiting...';
|
||||
allReady = false;
|
||||
}
|
||||
if (svc.ready) { el.classList.add('ready'); st.textContent = MSGS[svc.id] }
|
||||
else if (svc.failed) { el.classList.add('failed'); st.textContent = 'Failed'; anyFailed = true; allReady = false; failedNames.push(NAMES[svc.id]) }
|
||||
else { st.textContent = 'waiting...'; allReady = false }
|
||||
}
|
||||
|
||||
const loadingText = document.getElementById('loading-text');
|
||||
const errorMsg = document.getElementById('error-msg');
|
||||
const retryBtn = document.getElementById('retry-btn');
|
||||
|
||||
const lt = document.getElementById('loading-text'), em = document.getElementById('error-msg'), rb = document.getElementById('retry-btn'), lo = document.getElementById('launch-overlay');
|
||||
if (anyFailed) {
|
||||
loadingText.className = 'loading-text error';
|
||||
loadingText.textContent = 'Something went wrong';
|
||||
errorMsg.textContent = failedNames.join(', ') + ' failed to start. Check your terminal for details.';
|
||||
errorMsg.classList.add('active');
|
||||
retryBtn.classList.add('active');
|
||||
document.getElementById('launch-overlay').classList.remove('active');
|
||||
lt.className = 'loading-text error'; lt.textContent = 'Something went wrong';
|
||||
em.textContent = failedNames.join(', ') + ' failed to start. Check your terminal.';
|
||||
em.classList.add('active'); rb.classList.add('active'); lo.classList.remove('active');
|
||||
} else if (allReady) {
|
||||
loadingText.className = 'loading-text';
|
||||
loadingText.textContent = 'All systems ready!';
|
||||
errorMsg.classList.remove('active');
|
||||
retryBtn.classList.remove('active');
|
||||
document.getElementById('launch-overlay').classList.add('active');
|
||||
lt.className = 'loading-text'; lt.textContent = 'All systems ready!';
|
||||
em.classList.remove('active'); rb.classList.remove('active');
|
||||
lo.classList.add('active');
|
||||
setTimeout(() => { window.location.href = 'http://localhost:3006/login'; }, 5000);
|
||||
} else {
|
||||
loadingText.className = 'loading-text';
|
||||
const ready = CHECKS.filter(s => s.ready).length;
|
||||
loadingText.textContent = `Loading... (${ready}/${CHECKS.length})`;
|
||||
lt.className = 'loading-text';
|
||||
lt.textContent = `Loading... (${CHECKS.filter(s => s.ready).length}/${CHECKS.length})`;
|
||||
}
|
||||
}
|
||||
|
||||
async function poll() {
|
||||
attempts++;
|
||||
if (attempts > MAX_ATTEMPTS) {
|
||||
for (const svc of CHECKS) {
|
||||
if (!svc.ready) svc.failed = true;
|
||||
}
|
||||
updateUI();
|
||||
return;
|
||||
for (const svc of CHECKS) { if (!svc.ready) svc.failed = true }
|
||||
updateUI(); return;
|
||||
}
|
||||
|
||||
await checkAllServices();
|
||||
updateUI();
|
||||
|
||||
if (!CHECKS.every(s => s.ready) && !CHECKS.some(s => s.failed)) {
|
||||
await checkAllServices(); updateUI();
|
||||
if (!CHECKS.every(s => s.ready) && !CHECKS.some(s => s.failed))
|
||||
setTimeout(poll, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
poll();
|
||||
// ── Boot ──
|
||||
checkEnv();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user