fix: resolve 7 critical security vulnerabilities from audit

This commit is contained in:
NimBold
2026-06-24 23:36:21 +03:30
parent 1a687d0081
commit b147ec5f78
8 changed files with 110 additions and 92 deletions
+11 -2
View File
@@ -368,6 +368,8 @@ function App() {
const allCompleted = scheduledItems.every(item => item?.status === 'completed');
settings.setSchedulerActiveDownloadIds([]);
settings.setSchedulerRunning(false);
let timer: number | undefined;
if (!allCompleted) {
addToast({
message: 'Scheduled downloads did not all complete. The post-queue system action was skipped.',
@@ -395,7 +397,7 @@ function App() {
</div>
)
});
window.setTimeout(() => {
timer = window.setTimeout(() => {
if (cancelled) return;
const activeTransfers = useDownloadStore.getState().downloads.some(download =>
isActiveDownloadStatus(download.status)
@@ -418,6 +420,12 @@ function App() {
});
}, 10_000);
}
return () => {
if (timer !== undefined) {
window.clearTimeout(timer);
}
};
}, [addToast, downloads, schedulerRunning, schedulerActiveDownloadIds]);
useEffect(() => {
@@ -505,7 +513,7 @@ function App() {
}, [theme]);
useEffect(() => {
initDownloadListener();
const unlistenDownload = initDownloadListener();
const unlistenTerminalState = listen('download-state', (event) => {
if (event.payload.status !== 'completed' && event.payload.status !== 'failed') return;
@@ -561,6 +569,7 @@ function App() {
unlistenTerminalState.then(f => f());
unlistenExtension.then(f => f());
unlistenDeepLink.then(f => f());
unlistenDownload.then(f => { if (f) f(); });
};
}, []);
+3 -1
View File
@@ -1,6 +1,7 @@
import { useEffect, useRef, useState } from 'react';
import { invokeCommand as invoke } from '../ipc';
import { save } from '@tauri-apps/plugin-dialog';
import { writeTextFile } from '@tauri-apps/plugin-fs';
import { attachLogger, setLogPaused, getLogPaused, initLogger } from '../utils/logger';
import { FileDown, Trash2, Terminal, Filter, Play, Pause, Info, Copy } from 'lucide-react';
import { WindowDragRegion } from './WindowDragRegion';
@@ -128,7 +129,8 @@ export default function LogsView() {
filters: [{ name: 'Log Files', extensions: ['log'] }],
});
if (!path) return;
await invoke('export_logs', { destPath: path });
const logsContent = await invoke('export_logs', {});
await writeTextFile(path, logsContent);
addToast({ message: 'Support logs exported', variant: 'success' });
} catch (e) {
console.error('Export failed:', e);
+1 -1
View File
@@ -71,7 +71,7 @@ type CommandMap = {
args: { baseFolder: string; subfolders: Record<string, string> };
result: void;
};
export_logs: { args: { destPath: string }; result: string };
export_logs: { args: Record<string, never>; result: string };
read_logs: { args: { limit: number }; result: string[] };
clear_logs: { args: undefined; result: void };
toggle_log_pause: { args: { pause: boolean }; result: void };
+15
View File
@@ -98,4 +98,19 @@ export async function initDownloadListener() {
}
});
}
return () => {
if (unlistenProgress) {
unlistenProgress();
unlistenProgress = null;
}
if (unlistenState) {
unlistenState();
unlistenState = null;
}
if (unlistenTray) {
unlistenTray();
unlistenTray = null;
}
};
}