Enhance DownloadsPanel and Gofile error handling improvements#198
Merged
Conversation
- Added support for resuming downloads in the DownloadsPanel by introducing a new `canResume` property. - Updated logic to determine when downloads can be paused or resumed based on the protocol and status. - Modified the download cancellation process to handle output file names correctly. - Improved error handling for HTTP downloads, ensuring proper user feedback for unsupported operations. - Refactored hoster resolution functions to streamline the download process and improve maintainability.
- Enhanced error messages for Gofile API responses, providing clearer user feedback for various error states. - Refactored error handling in the Gofile module to utilize new helper functions for better maintainability. - Updated the HTTP download process to include more specific error messages based on the URI, improving user experience during downloads. - Removed outdated error handling code to streamline the overall error management system.
- Updated the process listing logic to iterate directly over process values, improving code clarity and performance. - Removed unnecessary tuple destructuring for a more straightforward approach to accessing process data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors and improves the HTTP hoster download subsystem, focusing on unifying network client usage, enhancing error handling, and improving the download job model. The main changes include consolidating hoster network logic into a new module, standardizing error reporting for hoster downloads, and making HTTP download jobs more robust and easier to manage.
Network Client Refactor and Consolidation
hoster_downloadmodule that centralizes all hoster-related HTTP client logic, replacing the previous scattered approach. The newHOSTER_DOWNLOAD_CLIENTis now used for all hoster download and resolution operations, and the related constants and client definitions have been removed from individual hoster modules. (apps/desktop/src-tauri/src/network/mod.rs,apps/desktop/src-tauri/src/sources/hosters/constants.rs, [1] [2] [3] [4]Error Handling Improvements
HosterErrorenum and associated helpers to provide more detailed, user-friendly error messages, especially for Gofile and other major hosters. Added conversion fromHttpStatusErrorand utility functions for common error scenarios. (apps/desktop/src-tauri/src/sources/hosters/error.rs, [1] [2]Hoster Resolution Logic Update
apps/desktop/src-tauri/src/sources/hosters/buzzheavier.rs,apps/desktop/src-tauri/src/sources/hosters/datanodes.rs,apps/desktop/src-tauri/src/sources/hosters/fuckingfast.rs, [1] [2] [3] [4] [5] [6] [7]Download Job Model Enhancements
output_file_namefield to theSourceDownloadJobstruct, allowing the resolved filename to be tracked and reused for cancellation and management. Updated job creation and cancellation logic to use this field. (apps/desktop/src-tauri/src/sources/domain.rs,apps/desktop/src-tauri/src/sources/commands.rs, [1] [2] [3]HTTP Download Protocol Handling
apps/desktop/src-tauri/src/sources/commands.rs, [1] [2] [3]These changes make the hoster download subsystem more maintainable, robust, and user-friendly, especially in terms of error diagnosis and job management.