-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: add HTTP config options for auto-torrent and auto-extract #1219
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: monkeyWie <[email protected]>
Co-authored-by: monkeyWie <[email protected]>
pkg/download/downloader.go
Outdated
| // Check global HTTP config for AutoTorrent setting | ||
| var httpCfg internalhttp.Config | ||
| autoTorrent := false | ||
| if d.getProtocolConfig("http", &httpCfg) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Here can use fetcher.Name() directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Changed to use task.fetcherManager.Name() in commit fe14ff3.
Co-authored-by: monkeyWie <[email protected]>
|
@copilot Find the cause of the unit test failure and fix it |
Fixed unit test failures caused by renaming the private `config` struct to the exported `Config` struct. Updated all references in fetcher_test.go to use the new exported type. Co-authored-by: monkeyWie <[email protected]>
Fixed in commit 9675f80. The issue was that when I renamed the private Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot 不要把http config公开,参考 autoExtract 的逻辑,把autoTorrent提取到DownloadConfig里,然后在前端来处理传值逻辑,优先获取全局的 autoTorrent 值,如果没有默认为false,创建任务的UI界面暂时不用给选项开关 |
Following feedback, moved AutoTorrent configuration: - Removed AutoTorrent from internal HTTP protocol config (kept private) - Added AutoTorrent to global ArchiveConfig in base model - Frontend reads from global config and passes via OptsExtra - Backend reads from OptsExtra (similar to autoExtract pattern) - UI moved from HTTP section to Archives section - Default value remains false (disabled) Co-authored-by: monkeyWie <[email protected]>
Done in commit 48d633d. Changes made:
|
|
@copilot 不要放到ArchiveConfig里面,它是独立的配置 |
Following feedback, separated AutoTorrent into its own independent configuration: - Created new TorrentConfig struct separate from ArchiveConfig - Added Torrent field to DownloaderStoreConfig - Updated Flutter models to include TorrentConfig - Updated UI to reference torrent.autoTorrent instead of archive.autoTorrent - Moved UI toggle from Archives section to BitTorrent section - Default value remains false (disabled) Co-authored-by: monkeyWie <[email protected]>
Done in commit ccdb255. Created independent
|
|
@copilot 我觉得ArchiveConfig还有AutoTorrent都应该属于 http config的配置,把这两个配置都重构到http config中,在前端的设置UI中把两个设置项都放到HTTP栏目里 |
Following feedback, consolidated both Archive and Torrent settings into HTTP protocol configuration: - Added autoExtract, deleteAfterExtract, and autoTorrent to internal HTTP config - Added these fields to Flutter HttpConfig model - Removed ArchiveConfig and TorrentConfig from global DownloaderStoreConfig - Updated frontend to read/write from protocolConfig.http instead - Moved all three UI toggles to HTTP section in settings - Default values: autoExtract=false, deleteAfterExtract=false, autoTorrent=false Co-authored-by: monkeyWie <[email protected]>
Done in commit 1fa8a2d. Changes made:
|
Implementation Complete ✅
configstruct (internal/protocol/http/config.go)OptsExtra(pkg/download/downloader.go)false(disabled by default)fetcher_test.goautoExtract,deleteAfterExtract,autoTorrenttoHttpConfigmodelui/flutter/lib/app/modules/setting/views/setting_view.dart)protocolConfig.http(ui/flutter/lib/app/modules/create/views/create_view.dart)Summary
This PR implements global configuration options for automatic torrent downloads and archive extraction, both as part of the HTTP protocol configuration. All features are disabled by default to prevent accidental behavior, addressing the issue reported by the user.
HTTP Protocol Configuration:
autoExtractanddeleteAfterExtractcontrol automatic archive extraction after HTTP downloadsautoTorrentcontrols automatic torrent task creation when.torrentfiles are downloaded via HTTPprotocolConfig.http.*) and passes values viaOptsExtrato backendOptsExtrafieldsfalse) to prevent accidental downloads/extractionUsers can enable these features through the Settings > HTTP section if they want automatic behavior when downloading
.torrentfiles or archive files via HTTP.Architecture
The implementation consolidates archive and torrent-related settings into the HTTP protocol configuration, where they logically belong since they only apply to HTTP downloads. The HTTP protocol config remains private (internal to the protocol package). The frontend passes these global settings through
OptsExtraon each task creation, and the backend uses those values when downloads complete.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.