diff --git a/internal/agent/sshfs.go b/internal/agent/sshfs.go index 8848501..6963987 100644 --- a/internal/agent/sshfs.go +++ b/internal/agent/sshfs.go @@ -139,7 +139,8 @@ func (a *Agent) sshfsOpen(ctx context.Context, t proto.SSHTarget) (any, error) { } c := &sshfsConn{client: client, target: t, last: time.Now()} out, _ := sshRun(client, "stat -c %F / >/dev/null 2>&1 && echo GNU; stat -f %HT / >/dev/null 2>&1 && echo BSD; "+ - "command -v zip >/dev/null 2>&1 && echo ZIP; command -v unzip >/dev/null 2>&1 && echo UNZIP; echo \"$HOME\"") + "command -v zip >/dev/null 2>&1 && echo ZIP; command -v unzip >/dev/null 2>&1 && echo UNZIP; "+ + "command -v python3 >/dev/null 2>&1 && echo PY; echo \"$HOME\"") lines := strings.Split(strings.TrimSpace(out), "\n") switch { case strings.Contains(out, "GNU"): @@ -158,7 +159,7 @@ func (a *Agent) sshfsOpen(ctx context.Context, t proto.SSHTarget) (any, error) { sshfsJanitor.Do(func() { go sshfsSweep() }) // zip and unzip, where the host has them, for the pane's buttons. return map[string]any{"id": id, "home": c.home, - "zip": hasLine(lines, "ZIP"), "unzip": hasLine(lines, "UNZIP")}, nil + "zip": hasLine(lines, "ZIP") || hasLine(lines, "PY"), "unzip": hasLine(lines, "UNZIP") || hasLine(lines, "PY")}, nil } func hasLine(lines []string, w string) bool { @@ -410,7 +411,10 @@ func zipCommand(paths []string, dest string) (string, error) { } names[i] = shq("./" + path.Base(p)) } - return "cd -- " + shq(dir) + " && zip -r -q -y " + shq(path.Clean(dest)) + " " + strings.Join(names, " "), nil + // zip where the host has it, else Python's zipfile, which most have. + items := strings.Join(names, " ") + return "cd -- " + shq(dir) + " && if command -v zip >/dev/null 2>&1; then zip -r -q -y " + shq(path.Clean(dest)) + " " + items + "; " + + "else python3 -m zipfile -c " + shq(path.Clean(dest)) + " " + items + "; fi", nil } // unzipCommand unpacks the archive p into dest (its own folder if empty), @@ -419,7 +423,8 @@ func unzipCommand(p, dest string) string { if dest == "" { dest = path.Dir(path.Clean(p)) } - return "unzip -o -q " + shq(path.Clean(p)) + " -d " + shq(path.Clean(dest)) + return "if command -v unzip >/dev/null 2>&1; then unzip -o -q " + shq(path.Clean(p)) + " -d " + shq(path.Clean(dest)) + "; " + + "else python3 -m zipfile -e " + shq(path.Clean(p)) + " " + shq(path.Clean(dest)) + "; fi" } // writeCommand writes stdin to p through a file beside it, so a broken diff --git a/internal/agent/sshfs_test.go b/internal/agent/sshfs_test.go index 281d0f6..a6b2ac1 100644 --- a/internal/agent/sshfs_test.go +++ b/internal/agent/sshfs_test.go @@ -114,7 +114,8 @@ func TestZipCommand(t *testing.T) { if err != nil { t.Fatal(err) } - want := `cd -- '/srv' && zip -r -q -y '/tmp/x.zip' './a b' './it'\''s'` + want := `cd -- '/srv' && if command -v zip >/dev/null 2>&1; then zip -r -q -y '/tmp/x.zip' './a b' './it'\''s'; ` + + `else python3 -m zipfile -c '/tmp/x.zip' './a b' './it'\''s'; fi` if cmd != want { t.Fatalf("got %s\nwant %s", cmd, want) } @@ -124,7 +125,7 @@ func TestZipCommand(t *testing.T) { if _, err := zipCommand(nil, "/t.zip"); err == nil { t.Fatal("no items: want an error") } - if got := unzipCommand("/srv/a.zip", ""); got != `unzip -o -q '/srv/a.zip' -d '/srv'` { + if got := unzipCommand("/srv/a.zip", ""); got != `if command -v unzip >/dev/null 2>&1; then unzip -o -q '/srv/a.zip' -d '/srv'; else python3 -m zipfile -e '/srv/a.zip' '/srv'; fi` { t.Fatalf("unzip: %s", got) } } diff --git a/internal/server/web/static/app.css b/internal/server/web/static/app.css index c5b640b..9901f30 100644 --- a/internal/server/web/static/app.css +++ b/internal/server/web/static/app.css @@ -303,6 +303,7 @@ dialog.sshdlg { max-width:460px; } .sshdlg .seg button:hover { color:var(--text); } .sshdlg .seg button.on { background:#12202f; color:var(--text); box-shadow:inset 0 0 0 1px #1f3a57; } .sshdlg .sshmsg { margin:0; min-height:18px; font-size:13px; color:var(--danger); } +.sshdlg .sshmsg.going { color:var(--muted); } .sshdlg .row.end { display:flex; justify-content:flex-end; gap:8px; } @media (max-width:520px) { .sshdlg .seg button { font-size:12px; padding:6px 4px; } } /* The page is the terminal: bar, tabs, then the terminals to the bottom. */ @@ -859,9 +860,10 @@ body.touch.term-active .ai-fab { bottom:104px; } } .ai-send { width:40px; height:40px; padding:0; flex:none; display:inline-flex; align-items:center; justify-content:center; border-radius:8px; } /* The panel's own confirm and prompt. */ -dialog.uidlg { max-width:420px; width:92vw; } +dialog.uidlg { width:auto; min-width:min(320px, 92vw); max-width:min(560px, 92vw); } .uidlg form { padding:18px; display:grid; gap:14px; } .uidlg .ui-text { margin:0; white-space:pre-wrap; line-height:1.45; } +.uidlg .ui-long { display:inline-block; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; vertical-align:bottom; } .uidlg .ui-input[hidden] { display:none; } .sshdlg .chk { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); } .sshdlg .chk input { width:auto; } diff --git a/internal/server/web/static/ui.js b/internal/server/web/static/ui.js index 49b2b70..47fb364 100644 --- a/internal/server/web/static/ui.js +++ b/internal/server/web/static/ui.js @@ -16,7 +16,17 @@ if (!dlg) make(); if (dlg.open) dlg.close(''); const input = dlg.querySelector('.ui-input'), yes = dlg.querySelector('.ui-yes'); - dlg.querySelector('.ui-text').textContent = text; + // Long words (a file name) stay on one line, cut with "…"; the window + // is as wide as its words, up to the screen's room. + const t = dlg.querySelector('.ui-text'); + t.textContent = ''; + String(text).split(/(\s+)/).forEach(w => { + if (w.length > 28 && !/\s/.test(w)) { + const s = document.createElement('span'); + s.className = 'ui-long'; s.textContent = w; s.title = w; + t.appendChild(s); + } else t.appendChild(document.createTextNode(w)); + }); input.hidden = !o.input; input.value = o.value || ''; yes.textContent = o.ok || 'OK'; diff --git a/internal/server/web/static/workspace.js b/internal/server/web/static/workspace.js index 9228acb..3129952 100644 --- a/internal/server/web/static/workspace.js +++ b/internal/server/web/static/workspace.js @@ -573,7 +573,7 @@ '