mirror of
https://github.com/jackwener/OpenCLI.git
synced 2026-09-14 18:25:42 +08:00
bf5f327775
- Show helpful hint in popup when disconnected: "This is normal. The extension connects automatically when you run any opencli command." - Stop eager reconnect after 6 attempts (reaching 60s backoff) to reduce ERR_CONNECTION_REFUSED noise in console; keepalive alarm still retries every ~24s at low frequency.
26 lines
939 B
JavaScript
26 lines
939 B
JavaScript
// Query connection status from background service worker
|
|
chrome.runtime.sendMessage({ type: 'getStatus' }, (resp) => {
|
|
const dot = document.getElementById('dot');
|
|
const status = document.getElementById('status');
|
|
const hint = document.getElementById('hint');
|
|
if (chrome.runtime.lastError || !resp) {
|
|
dot.className = 'dot disconnected';
|
|
status.innerHTML = '<strong>No daemon connected</strong>';
|
|
hint.style.display = 'block';
|
|
return;
|
|
}
|
|
if (resp.connected) {
|
|
dot.className = 'dot connected';
|
|
status.innerHTML = '<strong>Connected to daemon</strong>';
|
|
hint.style.display = 'none';
|
|
} else if (resp.reconnecting) {
|
|
dot.className = 'dot connecting';
|
|
status.innerHTML = '<strong>Reconnecting...</strong>';
|
|
hint.style.display = 'none';
|
|
} else {
|
|
dot.className = 'dot disconnected';
|
|
status.innerHTML = '<strong>No daemon connected</strong>';
|
|
hint.style.display = 'block';
|
|
}
|
|
});
|