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:
@@ -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) {
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
</div>
|
||||
<div class="conn">
|
||||
<span id="autoBadge" class="auto-badge wait">미연결</span>
|
||||
<span id="wormholeBadge" class="auto-badge wait" title="공식 Wormhole 프로세스">Wormhole —</span>
|
||||
<button id="killWormholeBtn" type="button" class="ghost" title="케이블 자동실행 Wormhole 종료">Wormhole 종료</button>
|
||||
<span id="inputBadge" class="auto-badge wait" title="마우스·키보드 공유">입력공유 미지원</span>
|
||||
<button id="inputShareBtn" type="button" class="ghost" disabled>입력공유</button>
|
||||
<div class="control-switch" title="입력공유 미지원">
|
||||
|
||||
Reference in New Issue
Block a user