fix: taskbar home tab, web chips, guac direct URL, SMB share listing

- Taskbar: permanent Home tab always visible, clicking it returns to
  main page without closing other tasks
- Taskbar: always visible (no longer hidden/shown), task panels overlay
  only shown when a non-home task is active
- Web/Copyparty chips now open correctly in iframe tasks (removed
  overly restrictive sandbox attribute)
- Guacamole: skip guac-launch redirect, load client URL directly in
  iframe so it goes straight into the session instead of the lobby
- SMB: when share field is blank, enumerate shares via smbclient CLI
  and return them as browseable directories in elFinder
- SMB: elFinder correctly encodes share name into hash when displaying
  share listing, so clicking a share navigates into it
This commit is contained in:
TailScan Bot committed 2026-04-02 16:17:22 +00:00
1 parent 331c3e62aa
commit f1dab10daf
3 files changed
+57 -39

No files matched your search

+6
View File
@@ -197,6 +197,12 @@ def smb_list_shares(host: str, username: str, password: str, port: int = 445) ->
def smb_list(host: str, username: str, password: str,
share: str, path: str, port: int = 445) -> list:
import smbclient
if not share:
# No share specified — return share list as "directories"
shares = smb_list_shares(host, username, password, port)
if shares:
return shares
raise ValueError("Could not enumerate shares. Please enter a share name.")
_smb_conn(host, username, password, port)
unc = _smb_unc(host, share, path)
entries = []
+16 -8
View File
@@ -704,8 +704,8 @@ async def api_guac_connect(request: Request, ip: str, port: int, proto: str):
request_host = request.headers.get("host", "localhost").split(":")[0]
guac_public_base = f"http://{request_host}:8085/guacamole"
client_url = f"{guac_public_base}/#/client/{client_id}"
# Route through /guac-launch so mobile gets OSK pre-enabled
url = f"/guac-launch?target={client_url}&proto={proto}"
# Load Guacamole client URL directly (works in both iframe and new tab)
url = client_url
return {"url": url, "connection_id": conn_id}
except httpx.HTTPStatusError as e:
@@ -741,7 +741,7 @@ async def api_browse_session(request: Request, url: str, width: int = 1280, heig
).decode().rstrip("=")
request_host = request.headers.get("host", "localhost").split(":")[0]
guac_url = f"http://{request_host}:8085/guacamole/#/client/{client_id}"
return {"url": f"/guac-launch?target={guac_url}&proto=vnc"}
return {"url": guac_url}
except Exception:
pass
# Container died — clean up
@@ -815,7 +815,7 @@ async def api_browse_session(request: Request, url: str, width: int = 1280, heig
).decode().rstrip("=")
request_host = request.headers.get("host", "localhost").split(":")[0]
guac_url = f"http://{request_host}:8085/guacamole/#/client/{client_id}"
return {"url": f"/guac-launch?target={guac_url}&proto=vnc"}
return {"url": guac_url}
@app.delete("/api/browse-session")
@@ -903,16 +903,24 @@ async def _elf_ls(proto, host, port, share, path, user, password):
async def _elf_open(proto, host, port, share, path, user, password):
"""Return (entries, cwd_entry) for a directory."""
cwd_entry = _elf_entry(proto, host, port, share, path, path.rstrip("/").split("/")[-1] or "root", True)
if path == "/":
if path == "/" and not share:
cwd_entry = _elf_root_entry(proto, host, port, share)
elif path == "/":
cwd_entry = _elf_root_entry(proto, host, port, share)
entries = await _asyncio.get_event_loop().run_in_executor(
None, lambda: _elf_ls_sync(proto, host, port, share, path, user, password)
)
files = []
for e in entries:
child_path = (path.rstrip("/") + "/" + e["name"])
files.append(_elf_entry(proto, host, port, share, child_path,
e["name"], e["type"] == "dir", e.get("size", 0)))
if e.get("type") == "share":
# SMB share listing — each "entry" is a share, encode share name into hash
files.append(_elf_entry(proto, host, port, e["name"], "/",
e["name"], True))
else:
child_path = (path.rstrip("/") + "/" + e["name"])
files.append(_elf_entry(proto, host, port, share, child_path,
e["name"], e["type"] == "dir", e.get("size", 0)))
return cwd_entry, files
def _elf_ls_sync(proto, host, port, share, path, user, password):
+35 -31
View File
@@ -899,13 +899,13 @@ fetch('/api/version').then(r=>r.json()).then(d=>{
</script>
<!-- ── Taskbar ────────────────────────────────────────────────────────── -->
<div id="taskbar" style="display:none;position:fixed;bottom:0;left:0;right:0;z-index:8000;background:var(--surface);border-top:1px solid var(--border);display:flex;align-items:stretch;height:36px;gap:0;">
<div id="taskbar" style="position:fixed;bottom:0;left:0;right:0;z-index:8000;background:var(--surface);border-top:1px solid var(--border);display:flex;align-items:stretch;height:36px;gap:0;">
<div id="taskbar-tabs" style="display:flex;align-items:stretch;flex:1;overflow-x:auto;gap:2px;padding:3px 4px;"></div>
<button id="taskbar-close-all" onclick="tsCloseAll()" title="Close all tasks" style="padding:0 10px;background:none;border:none;border-left:1px solid var(--border);color:var(--muted);cursor:pointer;font-size:13px;flex-shrink:0;">&times; all</button>
</div>
<!-- Task panels container (iframes + elFinder panels live here) -->
<div id="task-panels" style="position:fixed;bottom:36px;left:0;right:0;top:0;z-index:7999;pointer-events:none;"></div>
<div id="task-panels" style="position:fixed;bottom:36px;left:0;right:0;top:0;z-index:7999;pointer-events:none;display:none;"></div>
<style>
.ts-tab {
@@ -1106,13 +1106,25 @@ if (_origApplyTheme) {
// ── Taskbar ───────────────────────────────────────────────────────────────────
const _tsTasks = {}; // id -> { label, type, url, elfState }
let _tsActive = null;
let _tsActive = 'home';
let _tsNextId = 1;
const _tsIcons = { web: '🌐', ssh: '🖥', rdp: '🖥', vnc: '🖥', files: '📁' };
const _tsIcons = { home: '🏠', web: '🌐', ssh: '🖥', rdp: '🖥', vnc: '🖥', files: '📁' };
// Create permanent Home tab on page load
(function() {
const tabs = document.getElementById('taskbar-tabs');
const tab = document.createElement('div');
tab.className = 'ts-tab active';
tab.id = 'tab-home';
tab.innerHTML = `<span class="ts-icon">🏠</span><span class="ts-label">Home</span>`;
tab.addEventListener('click', () => tsActivate('home'));
tabs.appendChild(tab);
document.body.style.paddingBottom = '36px';
})();
function tsOpen(url, label, type, elfState) {
// Reuse existing task with same url/label if already open
// Reuse existing task with same url if already open
for (const [id, t] of Object.entries(_tsTasks)) {
if (t.url === url && t.type === type && url !== null) {
tsActivate(id); return;
@@ -1135,18 +1147,14 @@ function tsOpen(url, label, type, elfState) {
panels.appendChild(panel);
if (type === 'files') {
// elFinder panel — render creds dialog inside
panel.style.display = 'flex';
panel.innerHTML = `<div id="elf-inner-${id}" style="flex:1;display:flex;flex-direction:column;"></div>`;
// Defer to after DOM update
setTimeout(() => {
_elfState = { ...elfState };
const container = document.getElementById('elf-inner-' + id);
_elfShowCredsInContainer(container, id);
}, 0);
} else {
// iframe for web / guacamole
panel.innerHTML = `<iframe src="${escAttr(url)}" allow="fullscreen" sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-modals"></iframe>`;
panel.innerHTML = `<iframe src="${escAttr(url)}" allow="fullscreen *" allowfullscreen></iframe>`;
}
// Create tab
@@ -1158,21 +1166,27 @@ function tsOpen(url, label, type, elfState) {
tab.addEventListener('click', () => tsActivate(id));
tabs.appendChild(tab);
document.getElementById('taskbar').style.display = 'flex';
tsActivate(id);
}
function tsActivate(id) {
// Hide all panels, deactivate all tabs
document.querySelectorAll('.ts-panel').forEach(p => p.classList.remove('visible'));
document.querySelectorAll('.ts-tab').forEach(t => t.classList.remove('active'));
_tsActive = id;
const panel = document.getElementById('panel-' + id);
const tab = document.getElementById('tab-' + id);
if (panel) panel.classList.add('visible');
if (tab) tab.classList.add('active');
// Shrink main content area
document.body.style.paddingBottom = '36px';
if (id === 'home') {
// Show main page content, hide panels overlay
document.getElementById('task-panels').style.display = 'none';
document.querySelector('.main-layout, main, #app, body > div:not(#taskbar):not(#task-panels):not(#elfinder-modal)')?.style && null;
} else {
// Show panels overlay
document.getElementById('task-panels').style.display = 'block';
const panel = document.getElementById('panel-' + id);
if (panel) panel.classList.add('visible');
}
}
function tsClose(id) {
@@ -1181,28 +1195,18 @@ function tsClose(id) {
if (panel) panel.remove();
if (tab) tab.remove();
delete _tsTasks[id];
if (_tsActive === id) {
_tsActive = null;
document.body.style.paddingBottom = '';
// Activate last remaining task if any
const ids = Object.keys(_tsTasks);
if (ids.length) tsActivate(ids[ids.length - 1]);
}
if (!Object.keys(_tsTasks).length) {
document.getElementById('taskbar').style.display = 'none';
document.body.style.paddingBottom = '';
}
// Go to last task or home
const ids = Object.keys(_tsTasks);
tsActivate(ids.length ? ids[ids.length - 1] : 'home');
}
function tsCloseAll() {
Object.keys(_tsTasks).forEach(id => {
document.getElementById('panel-' + id)?.remove();
document.getElementById('tab-' + id)?.remove();
delete _tsTasks[id];
});
Object.keys(_tsTasks).forEach(k => delete _tsTasks[k]);
_tsActive = null;
document.getElementById('taskbar').style.display = 'none';
document.body.style.paddingBottom = '';
tsActivate('home');
}
function escAttr(s) {