feat: «Здесь» from a machine's terminal opens the file pane in the terminal's folder (asked of the agent); Аккаунт › Вид can turn «Здесь» back to the home folder. Version 0.2.1

This commit is contained in:
redtea committed 2026-10-16 18:28:15 +03:00
1 parent 57c2f1338f
commit 087eabf3b4
12 files changed
+163 -6

No files matched your search

+1
View File
@@ -62,6 +62,7 @@
' <label><span>Списки файлов</span><select data-pref="compact" data-bool><option value="">обычные</option><option value="1">компактные</option></select></label>' +
' <label><span>Время изменения файлов</span><select data-pref="fileTime"><option value="">показывать</option><option value="hide">скрыть</option></select></label>' +
' <label><span>Анимации</span><select data-pref="motion"><option value="">включены</option><option value="off">выключены</option></select></label>' +
' <label><span>«Здесь» в меню «+»</span><select data-pref="openHere"><option value="">в папке активной вкладки</option><option value="off">в домашней папке</option></select></label>' +
' </div></details>' +
' <div class="acct-keysec">' +
' <h3>Ключи доступа</h3>' +
+9 -1
View File
@@ -87,6 +87,8 @@
? {kind: 'ssh', id: o.agent.id + '|' + o.ssh.user + '@' + o.ssh.host + ':' + (o.ssh.port || 22), label: o.ssh.user + '@' + o.ssh.host}
: {kind: 'agent', id: o.agent.id, label: o.agent.name};
this.cwd = '/';
// startDir: the folder to open first (or a promise of it), not home.
this.startDir = o.dir || '';
this.entries = [];
this.selected = new Set();
this.uploads = [];
@@ -202,6 +204,12 @@
async start() {
// Start in the home folder of the machine's user (or the SSH home);
// a listing that fails there falls back to the root.
const dir = await this.startDir;
this.startDir = '';
if (dir) {
const d = await this.api('list', {path: dir});
if (d.ok) { this.show(d.data); return; }
}
const r = await this.api('list', {path: this.src.home()});
if (r.ok) this.show(r.data); else if (!this.trouble(r.error || '')) this.go('/');
}
@@ -434,7 +442,7 @@
window.FilePane = FilePane;
window.MachineSource = MachineSource;
Workspace.paneTypes.files = agent => new FilePane({kind: 'agent', agent});
Workspace.paneTypes.files = (agent, o) => new FilePane({kind: 'agent', agent, dir: o.dir});
Workspace.paneTypes.sshfiles = (agent, o) => new FilePane({kind: 'ssh', agent, ssh: o.ssh, src: new SSHSource(agent, o.conn, o.home, o.caps)});
// sshFiles connects agent to the SSH host t, then opens its files in a
// pane; the password or key goes to the machine once and is not kept here.
+10 -3
View File
@@ -567,9 +567,16 @@
if (here) item(content, '<span class="ico">+</span><span><b>Здесь</b><small>' + esc(here.name) + ' · ' + esc(here.user + '@' + here.host) + '</small></span>',
() => {
closeMenu();
// A terminal from a machine's file pane starts in its folder.
const dir = kind === 'term' && activePane.kind === 'files' ? activePane.cwd : '';
openPane(kind, here, dir ? {dir} : null);
// A terminal from a machine's file pane starts in its folder, a
// file pane from a machine's terminal in the terminal's (asked of
// the machine; home if it cannot tell) - unless turned off.
const on = !(window.Prefs && Prefs.get().openHere === 'off');
let opts = null;
if (on && kind === 'term' && activePane.kind === 'files') opts = {dir: activePane.cwd};
else if (on && kind === 'files' && activePane.kind === 'term' && activePane.sid) {
opts = {dir: new MachineSource(here).op('termcwd', {session: activePane.sid}).then(r => r.ok && r.data ? r.data.path : '')};
}
openPane(kind, here, opts);
});
const box = document.createElement('div');
box.innerHTML = '<div class="muted" style="padding:8px 10px;font-size:13px">загрузка…</div>';