Add Wormhole auto-kill so Interface 5 can be claimed

Cable autorun holds IF5; kill on launch/connect and via GUI button/CLI.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
joyharam
2026-07-15 10:58:35 +09:00
parent 2035c0b4fe
commit d9c0b8078c
9 changed files with 398 additions and 6 deletions
+47 -2
View File
@@ -450,6 +450,47 @@ function updateBadge(connected, text) {
badge.className = connected ? "auto-badge ok" : "auto-badge wait";
}
function updateWormholeUI(info) {
const badge = $("wormholeBadge");
const btn = $("killWormholeBtn");
if (!badge) return;
if (!info) {
badge.textContent = "Wormhole —";
badge.className = "auto-badge wait";
return;
}
if (info.running) {
badge.textContent = `Wormhole ${info.count}개 실행중`;
badge.className = "auto-badge wait";
badge.title = (info.processes || [])
.map((p) => `${p.name} (${p.pid})`)
.join("\n") || info.message || "";
if (btn) btn.disabled = false;
} else {
badge.textContent = "Wormhole 없음";
badge.className = "auto-badge ok";
badge.title = info.message || "공식 Wormhole 프로세스 없음";
if (btn) btn.disabled = false;
}
}
async function killWormhole() {
setStatus("공식 Wormhole 종료 중…");
try {
const data = await api("/api/wormhole/kill", { method: "POST" });
updateWormholeUI({
running: (data.remaining || []).length > 0,
count: (data.remaining || []).length,
processes: data.remaining || [],
message: data.message,
});
setStatus(data.message || "Wormhole 종료 완료");
await refreshStatus();
} catch (e) {
setStatus(e.message || String(e), true);
}
}
function sortEntries(entries, sort) {
const dir = sort.dir;
const key = sort.key;
@@ -503,6 +544,7 @@ async function refreshStatus() {
if (s.local_root) $("localRootHint").textContent = s.local_root;
updateInputShareUI(s.inputshare);
updateWormholeUI(s.wormhole);
if (state.connected) {
updateBadge(true, "연결됨");
@@ -536,8 +578,8 @@ async function connectOneClick() {
state.connecting = true;
$("connectBtn").disabled = true;
updateBadge(false, "연결 중…");
setStatus("상대 JUC500 프로그램 대기 중…");
$("peerInfo").textContent = "USB 핸드셰이크 중… 상대에서도 GUI를 실행하세요";
setStatus("공식 Wormhole 종료 후 상대 프로그램 대기 중…");
$("peerInfo").textContent = "Wormhole 정리 · USB 핸드셰이크 중…";
try {
const data = await api("/api/connect/auto", { method: "POST" });
@@ -1099,6 +1141,9 @@ function bindSort(prefix, getSort, setSort, rerender) {
function bindUi() {
$("connectBtn").onclick = () => connectOneClick();
$("disconnectBtn").onclick = () => disconnect().catch((e) => setStatus(e.message, true));
if ($("killWormholeBtn")) {
$("killWormholeBtn").onclick = () => killWormhole();
}
$("upBtn").onclick = () => goUp().catch((e) => setStatus(e.message, true));
$("refreshBtn").onclick = () => {
if (!state.connected) {