-
Notifications
You must be signed in to change notification settings - Fork 0
Mass-download #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mass-download #36
Conversation
…ures - Deleted the `contributing.md` file to streamline documentation. - Updated `roadmap.md` to reflect the addition of batch download functionality and configurable download settings. - Enhanced database migration handling to include new columns for download folder and settings. - Added IPC channels and controller methods for managing download settings and batch downloads. - Improved type definitions in `renderer.d.ts` to accommodate new download settings.
- Integrated global download state management using `useDownloadStore` to track download progress across components. - Updated `DownloadAllButton` to disable during active downloads and provide contextual tooltips. - Enhanced `PendingDownloadBanner` to manage download state and display appropriate messages based on download status. - Refined `useDownloadAll` hook to synchronize global download state, ensuring consistent UI behavior during downloads. - Improved post count display in `Favorites` and `Updates` pages to reflect total downloads accurately. - Added query invalidation for playlist entries to ensure UI reflects the latest state after modifications.
🛡️ Архитектор (AI Review)Слушай сюда. Твой PR на "Mass-download" — это классический пример того, как полезная фича превращается в мину замедленного действия для производительности Main-процесса. Ты добавил кучу полезного функционала, но забил на базовые принципы Electron. Вот твой список грехов: 🚨 Критично
|
- Introduced `onPendingDownloadStateChanged` IPC channel to notify the renderer of changes in download state. - Enhanced `FileController` to manage pending downloads more effectively, including asynchronous file operations for reading, writing, and deleting queue files. - Updated `PendingDownloadBanner` to utilize the new IPC channel for real-time updates on download status. - Improved path handling in `getFilePath` to prevent traversal attacks, ensuring security during file operations. - Refactored methods to use async/await for better readability and error handling in file operations.
🛡️ Архитектор (AI Review)Так, посмотрим, что ты тут наворотил. "Mass-download", говоришь? Звучит как отличный способ заблокировать Main-процесс и угробить производительность. Поехали. 🚨 Критично1. Блокировка Main-процесса при массовой загрузке Ты серьезно? Массовая загрузка файлов, с сетевыми запросами и записью на диск, прямо в Main-процессе? Даже с --- a/src/main/ipc/controllers/FileController.ts
+++ b/src/main/ipc/controllers/FileController.ts
@@ -301,6 +301,10 @@
* Uses concurrency limit and delay between requests to avoid bans (see docs/download-batch-risks.md)
*/
private async downloadAll(
- _event: IpcMainInvokeEvent,
- items: Array<{ url: string; filename: string }>
- ): Promise<{
- success: boolean;
- downloaded: number;
- failed: number;
- canceled: boolean;
- error?: string;
- }> {
+ // _event: IpcMainInvokeEvent, // Event object is not needed in a Worker
+ items: Array<{ url: string; filename: string }>,
+ // Add a way to communicate progress back to Main process, e.g., a callback or event emitter
+ // This method should be executed in a Worker Thread.
+ ): Promise<{ /* ... */ }> {
+ // ... весь код downloadAll должен быть перенесен в Worker Thread
+ // Main процесс должен только инициировать Worker и слушать его события.Как исправить:
|
- Added a new worker for handling downloads in the `FileController`, offloading heavy I/O operations to prevent UI blocking. - Updated methods to communicate with the worker for canceling, pausing, and resuming downloads, enhancing responsiveness. - Refactored download logic to utilize the worker, ensuring better performance and maintainability. - Included a new entry point for the worker in the Electron Vite configuration. - Improved accessibility comments in the `QuickAddToPlaylistMenu` component and removed unnecessary role attributes in `PostCard` for better compliance.
🛡️ Архитектор (AI Review)Ладно, посмотрим, что ты тут наваял. "Массовая загрузка", говоришь? Обычно это заканчивается блокировкой UI и дырами в безопасности. Но ты, кажется, попытался. Посмотрим, насколько успешно. 🚨 Критично
parentPort?.postMessage({
|
- Updated error handling in `FileController` and `QuickAddToPlaylistMenu` to use `unknown` type for caught errors, enhancing type safety. - Added a `finally` block in `PendingDownloadBanner` to ensure consistent state management during download operations. - Refactored error logging to provide clearer context for failures, improving maintainability and debugging capabilities.
🛡️ Архитектор (AI Review)LGTM 🟢. Архитектура чиста, но я слежу за тобой. Analyzed by: gemini-2.5-flash-lite |
useDownloadStoreto track download progress across components.DownloadAllButtonto disable during active downloads and provide contextual tooltips.PendingDownloadBannerto manage download state and display appropriate messages based on download status.useDownloadAllhook to synchronize global download state, ensuring consistent UI behavior during downloads.FavoritesandUpdatespages to reflect total downloads accurately.