mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-21 00:16:37 +00:00
fix: address post-audit regressions across queue, db, and ui
- Preserved extension-captured cookies through the Add modal, with a clean fallback when captured cookies break metadata fetching. - Prevented batched extension captures from losing URLs or reusing stale cookie/header contexts. - Fixed pause/resume and enqueue generation races, including cancellation during queue reservation and replay after task removal. - Made startup database initialization safe under React StrictMode. - Serialized keyring operations and corrected Linux legacy migration/deletion behavior. - Restored `Downloading` state after yt-dlp retries. - Replaced hardcoded media heights with dynamically detected formats, including nonstandard qualities such as 576p and 2880p.
This commit is contained in:
+18
-3
@@ -37,6 +37,20 @@ const waitForSettingsHydration = (): Promise<void> => {
|
||||
});
|
||||
};
|
||||
|
||||
let downloadStateInitialization: Promise<void> | null = null;
|
||||
const initializeDownloadState = (): Promise<void> => {
|
||||
if (!downloadStateInitialization) {
|
||||
downloadStateInitialization = (async () => {
|
||||
await waitForSettingsHydration();
|
||||
await useDownloadStore.getState().initDB();
|
||||
})().catch(error => {
|
||||
downloadStateInitialization = null;
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
return downloadStateInitialization;
|
||||
};
|
||||
|
||||
const getScheduledQueueIds = () => {
|
||||
const downloadState = useDownloadStore.getState();
|
||||
const availableQueueIds = new Set(downloadState.queues.map(queue => queue.id));
|
||||
@@ -227,10 +241,11 @@ function App() {
|
||||
let active = true;
|
||||
const initialize = async () => {
|
||||
try {
|
||||
await waitForSettingsHydration();
|
||||
await useDownloadStore.getState().initDB();
|
||||
if (active) setCoreReady(true);
|
||||
await initializeDownloadState();
|
||||
if (!active) return;
|
||||
setCoreReady(true);
|
||||
} catch (error) {
|
||||
if (!active) return;
|
||||
console.error('Failed to initialize Firelink state:', error);
|
||||
addToast({
|
||||
message: `Could not initialize saved downloads: ${String(error)}`,
|
||||
|
||||
Reference in New Issue
Block a user