feat(torrent): complete lifecycle controls and diagnostics

- add durable Torrent telemetry, availability, sharing, relocation, and web-seed workflows\n- fence queue ownership, lifecycle recovery, persistence, and native control races\n- add localized UI, generated bindings, regression coverage, and smoke validation
This commit is contained in:
NimBold
2026-08-04 01:18:24 +03:30
parent 55a905df14
commit 579a8f7f80
33 changed files with 3505 additions and 139 deletions
+19 -2
View File
@@ -3,12 +3,16 @@ import type { DownloadProgressEvent } from '../bindings/DownloadProgressEvent';
interface DownloadProgressState {
progressMap: Record<string, DownloadProgressEvent>;
moveProgressMap: Record<string, number>;
updateDownloadProgress: (id: string, payload: DownloadProgressEvent) => void;
clearDownloadProgress: (id: string) => void;
setMoveProgress: (id: string, fraction: number) => void;
clearMoveProgress: (id: string) => void;
}
export const useDownloadProgressStore = create<DownloadProgressState>((set) => ({
progressMap: {},
moveProgressMap: {},
updateDownloadProgress: (id, payload) =>
set((state) => ({
progressMap: {
@@ -18,9 +22,22 @@ export const useDownloadProgressStore = create<DownloadProgressState>((set) => (
})),
clearDownloadProgress: (id) =>
set((state) => {
if (!(id in state.progressMap)) return state;
if (!(id in state.progressMap) && !(id in state.moveProgressMap)) return state;
const next = { ...state.progressMap };
delete next[id];
return { progressMap: next };
const nextMove = { ...state.moveProgressMap };
delete nextMove[id];
return { progressMap: next, moveProgressMap: nextMove };
}),
setMoveProgress: (id, fraction) =>
set((state) => ({
moveProgressMap: { ...state.moveProgressMap, [id]: fraction }
})),
clearMoveProgress: (id) =>
set((state) => {
if (!(id in state.moveProgressMap)) return state;
const next = { ...state.moveProgressMap };
delete next[id];
return { moveProgressMap: next };
}),
}));