diff --git a/build-plugin.sh b/build-plugin.sh index be190c0..9b77775 100755 --- a/build-plugin.sh +++ b/build-plugin.sh @@ -2,7 +2,7 @@ set -eu PLUGIN="u-navigator" -VERSION="2026.06.23.r008" +VERSION="2026.06.23.r009" PKG_DIR="packages" WORK_DIR=".plugin-build" PKG_NAME="${PLUGIN}-${VERSION}.tgz" diff --git a/packages/u-navigator-2026.06.23.r008.tgz b/packages/u-navigator-2026.06.23.r008.tgz deleted file mode 100644 index b500b03..0000000 Binary files a/packages/u-navigator-2026.06.23.r008.tgz and /dev/null differ diff --git a/packages/u-navigator-2026.06.23.r009.tgz b/packages/u-navigator-2026.06.23.r009.tgz new file mode 100644 index 0000000..69dd1f3 Binary files /dev/null and b/packages/u-navigator-2026.06.23.r009.tgz differ diff --git a/server/public/app.js b/server/public/app.js index 5935991..34a6b99 100644 --- a/server/public/app.js +++ b/server/public/app.js @@ -14,6 +14,7 @@ const state = { debug: [], nextDebugId: 1, jobs: new Map(), + jobRefresh: new Map(), nextWindowId: 1, zIndex: 20 }; @@ -389,8 +390,8 @@ async function handleDrop(event, win, targetPath) { } } -async function createJob(type, source, destination) { - recordDebug('job.create.request', { type, source, destination }); +async function createJob(type, source, destination, refreshWindowIds = []) { + recordDebug('job.create.request', { type, source, destination, refreshWindowIds }); const body = new URLSearchParams(); body.set('source', source); body.set('destination', destination); @@ -402,8 +403,13 @@ async function createJob(type, source, destination) { }); recordDebug('job.create.response', job); state.jobs.set(job.id, job); + state.jobRefresh.set(job.id, { + windowIds: [...new Set(refreshWindowIds)].filter(Boolean), + done: false + }); pollJob(job.id); render(); + return job; } async function reloadExplorerWindows(ids) { @@ -466,8 +472,7 @@ async function renameEntry(win, entry) { showError(new Error('Der Name darf keinen Slash enthalten.')); return; } - await createJob('move', entry.path, `${dirname(entry.path)}/${nextName}`); - await loadExplorer(win, win.data.path); + await createJob('move', entry.path, `${dirname(entry.path)}/${nextName}`, [win.id]); } async function promptTransfer(win, entry, type) { @@ -475,8 +480,7 @@ async function promptTransfer(win, entry, type) { if (!targetDir) { return; } - await createJob(type, entry.path, `${targetDir.replace(/\/$/, '')}/${entry.name}`); - await loadExplorer(win, win.data.path); + await createJob(type, entry.path, `${targetDir.replace(/\/$/, '')}/${entry.name}`, []); } function showContextMenu(event, win, entry) { @@ -551,6 +555,8 @@ async function pollJob(id) { render(); if (['queued', 'running', 'cancel_requested'].includes(job.status)) { setTimeout(() => pollJob(id), 700); + } else { + await refreshAfterJob(job); } } catch (error) { recordDebug('job.poll.error', { id, error: serializeError(error) }); @@ -558,6 +564,22 @@ async function pollJob(id) { } } +async function refreshAfterJob(job) { + const refresh = state.jobRefresh.get(job.id); + if (refresh?.done) { + return; + } + if (refresh) { + refresh.done = true; + } + const windowIds = refresh?.windowIds || []; + recordDebug('job.refresh', { id: job.id, status: job.status, windowIds }); + await reloadExplorerWindows(windowIds); + if (refresh) { + state.jobRefresh.delete(job.id); + } +} + function selectEntry(win, entry, scrollBody = null) { if (state.suppressClickPath === entry.path) { state.suppressClickPath = null; @@ -680,8 +702,7 @@ async function finishItemPointerDrag(event, move, up) { if (destination === drag.path) { throw new Error('Quelle und Ziel sind identisch.'); } - await createJob(event.altKey ? 'copy' : 'move', drag.path, destination); - await reloadExplorerWindows([drag.sourceWindowId, target.windowId]); + await createJob(event.altKey ? 'copy' : 'move', drag.path, destination, [drag.sourceWindowId, target.windowId]); } catch (error) { showError(error); } diff --git a/u-navigator.plg b/u-navigator.plg index 254ffcc..ad0c88a 100644 --- a/u-navigator.plg +++ b/u-navigator.plg @@ -1,7 +1,7 @@ - + ]> @@ -14,7 +14,7 @@ https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/packages/&package; -6a584ee446fc442c9a3c95877f15d1ae +1388b0f68a4cc0ddfaacc4e6f2402ea7