mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-08 02:13:24 +00:00
fix(downloads): support offline fallback drafts
- launch Firefox handoffs through authenticated reconnect - preserve usable drafts when metadata lookup fails - reject stale metadata results and retry failed rows only
This commit is contained in:
@@ -172,6 +172,37 @@ describe('useDownloadStore', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('redownloads fallback media without requiring a format selector', async () => {
|
||||
useDownloadStore.setState({
|
||||
downloads: [{
|
||||
id: 'media-fallback',
|
||||
url: 'https://youtube.com/watch?v=test',
|
||||
fileName: 'watch',
|
||||
destination: '/tmp',
|
||||
status: 'completed',
|
||||
category: 'Other',
|
||||
dateAdded: '',
|
||||
isMedia: true
|
||||
}] as any[]
|
||||
});
|
||||
vi.mocked(ipc.invokeCommand).mockImplementation(async (cmd: string) => {
|
||||
if (cmd === 'get_pending_order') return [];
|
||||
return undefined;
|
||||
});
|
||||
|
||||
await useDownloadStore.getState().redownload('media-fallback');
|
||||
|
||||
expect(ipc.invokeCommand).toHaveBeenCalledWith(
|
||||
'enqueue_download',
|
||||
expect.objectContaining({
|
||||
item: expect.objectContaining({
|
||||
is_media: true,
|
||||
format_selector: null
|
||||
})
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('starts and pauses all items regardless of legacy missing queue ids', async () => {
|
||||
useDownloadStore.setState({
|
||||
downloads: [
|
||||
|
||||
@@ -444,9 +444,6 @@ export const useDownloadStore = create<DownloadState>((set, get) => ({
|
||||
}
|
||||
|
||||
const mediaFormatSelector = targetItem.mediaFormatSelector?.trim();
|
||||
if (targetItem.isMedia && !mediaFormatSelector) {
|
||||
throw new Error('Cannot redownload: selected media format is missing.');
|
||||
}
|
||||
|
||||
const settings = useSettingsStore.getState();
|
||||
const destPath = targetItem.destination ||
|
||||
|
||||
Reference in New Issue
Block a user