feat(ui): fall through to HOME when /workspace does not exist on this node
On a plain node the folder panel opened on root=workspace and answered root_unavailable, leaving an empty table. It now retries once with root=home and flips the segmented control, so the panel always lands on data that exists.
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-11 07:01:11
Commit2f19c009
Parents3b6f6858
Changed files
src/plugin_disks.c+13−2■■■■■
2 files+13−2
Diff
src/plugin_disks.c+13−2■■■■■
index 18829ec..8a51b22 100644
--- a/src/plugin_disks.c
+++ b/src/plugin_disks.c
@@ -1159,11 +1159,22 @@ static int mode_html(int embed)
11591159 " d.scan_ms + ' ms' + (d.truncated ? ' \\u00b7 truncated' : ''));\n"
11601160 " }\n"
11611161 "\n"
1162-" function loadDirs(){\n"
1162+" function loadDirs(fallbackDone){\n"
11631163 " var u = withCtx(base('dirs')) + '&root=' + encodeURIComponent(ROOT);\n"
11641164 " return fetch(u, { headers: hdr(), cache: 'no-store' })\n"
11651165 " .then(function(r){ return r.json(); })\n"
1166-" .then(function(d){ renderDirs(d, d && d.ok === true); })\n"
1166+" .then(function(d){\n"
1167+" /* /workspace only exists on BotCloud containers. On a plain node the\n"
1168+" first request answers root_unavailable, so fall through to HOME\n"
1169+" once instead of showing an empty panel. */\n"
1170+" if (d && d.error === 'root_unavailable' && ROOT === 'workspace' && !fallbackDone){\n"
1171+" ROOT = 'home';\n"
1172+" Array.prototype.forEach.call(document.querySelectorAll('#segRoot button'),\n"
1173+" function(x){ x.classList.toggle('on', x.getAttribute('data-root') === 'home'); });\n"
1174+" return loadDirs(true);\n"
1175+" }\n"
1176+" renderDirs(d, d && d.ok === true);\n"
1177+" })\n"
11671178 " .catch(function(e){ renderDirs({error: String(e)}, false); });\n"
11681179 " }\n"
11691180 "\n"
tests/__pycache__/e2e.cpython-310.pyc+0−0■
11new file mode 100644
index 0000000..7db03d9
22
Binary file changed
src/plugin_disks.c+13−2■■■■■
index 18829ec..8a51b22 100644index 18829ec..8a51b22 100644
--- a/src/plugin_disks.c--- a/src/plugin_disks.c
+++ b/src/plugin_disks.c+++ b/src/plugin_disks.c
@@ -1159,11 +1159,22 @@ static int mode_html(int embed)@@ -1159,11 +1159,22 @@ static int mode_html(int embed)
1159 " d.scan_ms + ' ms' + (d.truncated ? ' \\u00b7 truncated' : ''));\n"1159 " d.scan_ms + ' ms' + (d.truncated ? ' \\u00b7 truncated' : ''));\n"
1160 " }\n"1160 " }\n"
1161 "\n"1161 "\n"
1162-" function loadDirs(){\n"1162+" function loadDirs(fallbackDone){\n"
1163 " var u = withCtx(base('dirs')) + '&root=' + encodeURIComponent(ROOT);\n"1163 " var u = withCtx(base('dirs')) + '&root=' + encodeURIComponent(ROOT);\n"
1164 " return fetch(u, { headers: hdr(), cache: 'no-store' })\n"1164 " return fetch(u, { headers: hdr(), cache: 'no-store' })\n"
1165 " .then(function(r){ return r.json(); })\n"1165 " .then(function(r){ return r.json(); })\n"
1166-" .then(function(d){ renderDirs(d, d && d.ok === true); })\n"1166+" .then(function(d){\n"
1167+" /* /workspace only exists on BotCloud containers. On a plain node the\n"
1168+" first request answers root_unavailable, so fall through to HOME\n"
1169+" once instead of showing an empty panel. */\n"
1170+" if (d && d.error === 'root_unavailable' && ROOT === 'workspace' && !fallbackDone){\n"
1171+" ROOT = 'home';\n"
1172+" Array.prototype.forEach.call(document.querySelectorAll('#segRoot button'),\n"
1173+" function(x){ x.classList.toggle('on', x.getAttribute('data-root') === 'home'); });\n"
1174+" return loadDirs(true);\n"
1175+" }\n"
1176+" renderDirs(d, d && d.ok === true);\n"
1177+" })\n"
1167 " .catch(function(e){ renderDirs({error: String(e)}, false); });\n"1178 " .catch(function(e){ renderDirs({error: String(e)}, false); });\n"
1168 " }\n"1179 " }\n"
1169 "\n"1180 "\n"
tests/__pycache__/e2e.cpython-310.pyc+0−0■
1new file mode 1006441new file mode 100644
index 0000000..7db03d9index 0000000..7db03d9
22
Binary file changed