MCPcopy Create free account
hub / github.com/RioArisk/claudecode_api_RemoteControl / deleteServerFromDialog

Function deleteServerFromDialog

app/src/modules/hub.js:498–539  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

496}
497
498async function deleteServerFromDialog() {
499 if (!hubEditingServerId) return;
500 const id = hubEditingServerId;
501 const servers = getSavedServers();
502 const target = servers.find(x => x.id === id) || null;
503 const deletingCurrent = !!target && (
504 (!!serverWsUrl && target.wsUrl === serverWsUrl) ||
505 (!!serverAddr && target.addr === serverAddr) ||
506 (!!serverCacheAddr && target.cacheAddr === serverCacheAddr)
507 );
508 const deletingConnecting = hubConnectingServerId === id;
509 closeServerDialog();
510 const ok = await showConfirm('Delete this server?');
511 if (!ok) { renderHubCards(); return; }
512 const removed = removeServer(id);
513 hubStatus.delete(id);
514 clearHubRetry(id);
515 if (deletingConnecting) {
516 hubConnectingServerId = null;
517 hideHubConnectOverlay();
518 }
519 if (deletingCurrent || deletingConnecting || (removed && removed.wsUrl === serverWsUrl)) {
520 if (S.reconnectTimer) { clearTimeout(S.reconnectTimer); S.reconnectTimer = null; }
521 const hadWs = !!S.ws;
522 S.intentionalDisconnect = hadWs;
523 S.skipNextCloseHandling = hadWs;
524 if (S.ws) {
525 try { S.ws.close(); } catch {}
526 } else {
527 S.intentionalDisconnect = false;
528 S.skipNextCloseHandling = false;
529 }
530 setServerAddr('');
531 setServerWsUrl('');
532 setServerCacheAddr('');
533 setServerToken('');
534 localStorage.removeItem(LAST_KEY);
535 resetAppState();
536 showConnectScreen();
537 }
538 renderHubCards();
539}
540
541export function resetAppState() {
542 clearForegroundProbe('reset_app_state');

Callers

nothing calls this directly

Calls 13

showConfirmFunction · 0.90
setServerAddrFunction · 0.90
setServerWsUrlFunction · 0.90
setServerCacheAddrFunction · 0.90
setServerTokenFunction · 0.90
getSavedServersFunction · 0.70
closeServerDialogFunction · 0.70
renderHubCardsFunction · 0.70
removeServerFunction · 0.70
clearHubRetryFunction · 0.70
hideHubConnectOverlayFunction · 0.70
resetAppStateFunction · 0.70

Tested by

no test coverage detected