summaryrefslogtreecommitdiffstats
path: root/deluge
Commit message (Collapse)AuthorAge
* Fix parsing magnet with tracker tiersCalum Lind2022-07-08
| | | | | | | | | Magnets with trackers specified with tr.x param were not being unquoted so unusable raw tracker string was being set. Fixed by unquoting tracker and adding test See-also: https://dev.deluge-torrent.org/ticket/2716
* Fix missing trackers adding magnetsCalum Lind2022-07-05
| | | | | | | | | | | The changes to remove deprecated lt methods didn't account for magnet trackers so magnets are missing trackers when added. Previously the addition of trackers was handled by libtorrent when a url was passed in add_torrent_params. The url parameter is deprecated so instead we need to add both the info_hash and trackers. Trac: https://dev.deluge-torrent.org/ticket/3530
* [Core] Fix typo in AUTH_LEVEL_MAPPINGN91992022-06-19
| | | | Closes: https://github.com/deluge-torrent/deluge/pull/387
* [Web] Accept charset in content-type for json messagesibizaman2022-06-12
| | | | | Trac: https://dev.deluge-torrent.org/ticket/3521 Closes: https://github.com/deluge-torrent/deluge/pull/385
* [WebUI] Fixed 'Complete Seen' and 'Completed' sortingMartin Hertz2022-05-17
| | | | Closes: https://github.com/deluge-torrent/deluge/pull/384
* [Notifications] Fix UnicodeEncodeError upon non-ascii torrent nameMartin Hertz2022-05-17
| | | | | | | | | smtplib.SMTP.sendmail expects 'msg' in string of ascii chars or bytes, where the former gets encoded to bytes through ascii codec, hence raising said error, but now fixed by encoding to bytes ourself through utf-8 Closes: https://github.com/deluge-torrent/deluge/pull/383
* [Core] Refactor prefetch_metadata for more clarityChase Sterling2022-05-17
| | | | | | | | | | | | | | | | | | | | | | | | Just trying to clean up some of the more complicated callback logic. Notable changes: * The test was awaiting a DeferredList. By default that will eat exceptions and just add them to the result list (including test assertion exceptions.) Added fireOnOneErrback=True to make sure that wasn't happening. * Moved the logic for multiple calls to await the same response into torrentmanager from core, so no matter where the prefetch is called from it will wait for the original call. * Implemented the multiple calls with an explicit queue of waiting callbacks, rather than a callback callback chain. * Moved to one inline async function rather than split into a main and callback after alert function. * Added some more type hints to the stuff I changed. Adjusted test since we are using prefetch as an async function now we have to schedule the alert to come after we start awaiting the prefetch call. Closes: https://github.com/deluge-torrent/deluge/pull/368
* [Console] Fix curses.init_pair raise ValueError on Py3.10Calum Lind2022-05-01
| | | | | | | Fix ValueError crash for console users with Python 3.10 Trac: https://dev.deluge-torrent.org/ticket/3518 See-also: https://docs.python.org/3/whatsnew/3.10.html#curses
* [Core] Cleanup temp files in add_torrent_urlCalum Lind2022-05-01
| | | | | | | | | | | | | Temporary torrent files are not deleted by add_torrent_url. Not as big a problem as with tracker icons pages but should be removed after use. Fixed by updating the method to use async and a try..finally cleanup block. Perhaps could be refactored to not require temporary files and instead store the downloaded torrent as object for passing to add_torrent_file. Trac: https://dev.deluge-torrent.org/ticket/3167
* [TrackerIcons] Cleanup tmp files created by downloading pageCalum Lind2022-05-01
| | | | | | | | | | | | | Temporary files created while download host html page are no cleaned up if the download fails. Fixed by adding a 'finally' step in the callback chain to delete any created temporary files. Added tests to ensure the temporary files are deleted, using a fixture that creates a known filename for the test. Trac: https://dev.deluge-torrent.org/ticket/3167
* [TrackerIcon] Use httpdownloader page redirect handlingCalum Lind2022-05-01
| | | | | | | | | | | User reported infinite redirecting when attempting to fetch tracker icon. Fixed by allowing httpdownloader and RedirectAgent to handle page redirects including catching infinite redirects Trac: https://dev.deluge-torrent.org/ticket/3167 See-also: https://github.com/twisted/twisted/blob/5c24e9/src/twisted/web/client.py#L168
* [Tests] Remove winreg interface name checkCalum Lind2022-05-01
| | | | | | | GitHub CI tests on Windows failing for get_windows_interface_name so remove the fragile tests since not a requirement to be this specific with testing whether name exists for these methods relying on standard lib or 3rd-party libs.
* [AutoAdd] Verify torrent decode and errors cleanly if invaliddeaddrop92022-05-01
| | | | | | | | Watch folder was disabled in AutoAdd and torrent filename is unchanged if an invalid torrent was added. Trac: https://dev.deluge-torrent.org/ticket/3515 Closes: https://github.com/deluge-torrent/deluge/pull/381
* [Core] Fixed KeyError in sessionproxy after torrent deleteDjLegolas2022-03-02
| | | | | | | | | | | When several torrents are being removed from session, an exception was being raised in a callback function `on_status` with the `torrent_id` of one (or more) of the removed torrents. Now we will catch when the torrent does not exist anymore and print a debug log about it. Closes: https://dev.deluge-torrent.org/ticket/3498 Closes: https://github.com/deluge-torrent/deluge/pull/341
* [Tests] Remove reference to Twisted TrialCalum Lind2022-03-02
| | | | | With the move to pytest remove remainings documentation or comments that refer to Trial.
* [Tests] Skip SNI icon testCalum Lind2022-03-02
| | | | | | | The SNI icon test is failing due to seo.com removing their favicon. A new test to replace it would be needed to check SNI support. Ideally new tests would not rely on external sites.
* [Console] Swap j and k key's behavior to fit vim modemarik2022-03-02
| | | | | | | | | There is a problem in the Deluge's Console UI. This UI supports the j and k keys as up and down, but for some reason they are inverted. This commit inverts back the behaviour of j and k in several places. Resolves: https://dev.deluge-torrent.org/ticket/3483 Closes: https://github.com/deluge-torrent/deluge/pull/377
* [GTK] Remove unneeded glade icon activatable False propertyCalum Lind2022-03-02
| | | | | | This propery cause issue with added extra space in the entries, likely a minor GTK bug and property being leftover from GTK2 migration. The default is True and should have no effect since no icon is shown.
* [GTK] Refactor Connection Manager Add Host dialogCalum Lind2022-03-02
| | | | Replace table with grid and use single column for entries.
* [GTK] Fix obscured port number in Connection Manager Add HostCalum Lind2022-03-02
| | | | | | | | | | | | | | A visual problem with the port spin button meant that the port number was not fully visible in the entry field. The problem is related to icon activatable property value set to False when default is True. Although no icon is used is creates a left-hand 5px space in the entry which narrows the available text space and the entry does not expand to account for this. Fixed by removing primary_icon_activatable and secondary_icon_activatable properies so that default values of True is used.
* [Hostlist] Support IPv6 in host liststbkizle2022-02-18
| | | | | | | socket.gethostbyname does not support IPv6 name resolution, and getaddrinfo() should be used instead for IPv4/v6 dual stack support. Closes: https://github.com/deluge-torrent/deluge/pull/376
* [Console] Fix torrent details status errorCalum Lind2022-02-17
| | | | | | | | The torrent status num_peers and num_seeds was replaced for session status keys by accident as part of replacing deprecated session keys so revert those changes Ref: 2bd095e5bf
* [Core] Fix Twisted fromCoroutine AttrErrorCalum Lind2022-02-16
| | | | | | | | | | | | | | | Users with older versions of Twisted <= 21.2 were encoutering the following error: File "/home/calum/projects/deluge/deluge/decorators.py", line 191, in activate d = defer.Deferred.fromCoroutine(self.coro) builtins.AttributeError: type object 'Deferred' has no attribute 'fromCoroutine' Fixed by falling back to ensureDeferred since fromCoroutine was introduced in Twisted 21.2 as a saner name for handling of coroutines. Ref: https://twistedmatrix.com/trac/ticket/9825
* Automatically refresh and expire the torrent status cache.Chase Sterling2022-02-15
| | | | | | | | | | Stop at ratio was not working when no clients were connected, because it was using a cached version of the torrent status, and never calling for a refresh. When a client connected, it called for the refresh and started working properly. Closes: https://dev.deluge-torrent.org/ticket/3497 Closes: https://github.com/deluge-torrent/deluge/pull/369
* [WebUI] Move HTML entity encoding to clientCalum Lind2022-02-14
| | | | | | | | | | | | | | | | | | | We should not be mangling the torrent data in the JSON API since this can have unintended consquences with names and filepaths that can be edited. If we escape those symbols in the JSON API then the data no longer matches that stored by core. Therefore shift the encoding to the client and consider dealing separetely with these entities when the user first adds a torrent. * Created a modified htmlEncode in Deluge Formatter based on extjs method that also encodes single quotes. * Removed renderers in ListViews since only templates specified via tpl are used and any render attribute specified was a no-op. * Removed old buggy escapeHtml Resolves: https://dev.deluge-torrent.org/ticket/3459 Ref: https://docs.sencha.com/extjs/6.5.3/modern/src/String.js.html#Ext.String-method-htmlEncode Ref: https://docs.sencha.com/extjs/3.4.0/source/Format.html#Ext-util-Format-method-htmlEncode
* [WebUI] Fix encoding HTML entities for torrent attributesCalum Lind2022-02-14
| | | | | | | | | | Ensure all torrent attributes that might contain malicious HTML entities are encoded. By allowing HTML entities to be rendered it enable malicious torrent files to perform XSS attacks. Resolves: https://dev.deluge-torrent.org/ticket/3459
* [GTK] Increase connection mgr default heightCalum Lind2022-02-13
| | | | | | | | | Could not see more than one host when connection manager opens so need to scroll or resize window Increased default height to now show three hosts when first opens Closes: https://dev.deluge-torrent.org/ticket/3431
* [GTK] Fix ui logic/bug of checked move_completedHenry Kwan2022-02-13
| | | | | | | | | | | | if move_completed is checked/True, options should be updated, not the other way round The path was updated the first time the move_completed option is selected and then ignored on further updated to the path. Fixed by checking instead if the path has changed. Closes: https://github.com/deluge-torrent/deluge/pull/374
* [Lint] Update linter version and fix issuesCalum Lind2022-02-13
| | | | | | | | | | | Notable changes: * Prettier >=2.3 with more consistent js assignments * Black now formats docstrings * Added isort to list of autoformaters * Update flake8 config for v4 Ref: https://prettier.io/blog/2021/05/09/2.3.0.html
* [Core] Stopped using libtorrent deprecated functionsDjLegolas2022-02-13
| | | | | | | | | | | | | | | | | As part of the process of adding support to LT 2.0, we should stop using all deprecated function, as some (if not all) were removed. For this process, we should use the LT 1.2 upgrade (guide)[1]. The change includes: * stop using file entries directly * start using the torrent handle's set/unset flags * stop using url key in add_torrent_params (for magnet) * stop accessing resume_data from save_resume_data_alert * stop using deprecated session status keys in UI [1] https://libtorrent.org/upgrade_to_1.2-ref.html Closes: https://dev.deluge-torrent.org/ticket/3499 Closes: https://github.com/deluge-torrent/deluge/pull/342
* [lt] Upgraded libtorrent minimum version to 1.2DjLegolas2022-02-13
| | | | | As part of the preparations for libtorrent 2.0, we should stop supporting lower versions of it.
* [Core] Enable file_completed_alert handling.Chase Sterling2022-02-13
| | | | | | | | | Without adding file_progress to the alert mask, the TorrentFileCompletedEvent would never fire. Closes: https://dev.deluge-torrent.org/ticket/3421 Closes: https://github.com/deluge-torrent/deluge/pull/370 Ref: https://libtorrent.org/upgrade_to_1.2-ref.html
* [GTK] Fix adding daemon accountsCalum Lind2022-02-12
| | | | | | | | | | | Errors were raised when trying to add a new daemon account due to dialog being destroyed before looking up widget values. Fixed by saving widget values before destroying. Refactored code to be simplified with a named tuple for the account details instead of separate attributes and modernized the preferences dialog creation and account saving by replacing callback functions.
* [Console] Fix incorrect test for when a host is onlinebendikro2022-02-12
| | | | | | | | | | | | The tests in connectionmanager for when a host is online are broken and always considers a host as online. When an error occurs in e.g. in _on_connect_fail, report_message() in PopupsHandler expects the message to be string, not a Twisted Failure. Fix by checking if message is string and log a warning before converting to string. Closes: https://github.com/deluge-torrent/deluge/pull/277
* [plugins] Add dev links script for WindowsDjLegolas2022-02-12
| | | | | | | | | | | Currently, when creating a new plugin, a script for creating the dev links was created for *NIX systems only. Now, it will detect the system type and create the correct script: Windows: create_dev_links.bat *NIX: create_dev_links.sh Closes: https://github.com/deluge-torrent/deluge/pull/257
* [Config] Fix callLater func missing argsDjLegolas2022-02-12
| | | | | | | | | | | | In a6840296, a refactor to the `config` class was introduced. The change included an internal wrapper for `reactor.callLater`, for lazy import, but didn't wrap it correctly and therefor, no args/kwargs were passed to the wrapped method. Furthermore, the exception was silently ignored. This caused changes to be ignored and not applied, including `preferencesmanager._on_config_value_change` callback. Closes: https://github.com/deluge-torrent/deluge/pull/372
* [Tests] Make file priority test more consistent.Chase Sterling2022-02-12
| | | | | | | | | | | Our file priority test was using time.sleep to wait until libtorrent had processed the command. This was sometimes not long enough and the test would fail. On libtorrent 2.0.3+ there is an alert when the process has finished, switch to waiting for that in this test to make the test more consistent. On older libtorrent, make the delay a bit longer, to try to make the test more consistent there as well. Closes: https://github.com/deluge-torrent/deluge/pull/373
* [Core] Document all exported core methods with type hintsChase Sterling2022-02-11
| | | | | | | | | | | | | | | Standardize docstrings in core.py to google standard. Remove type hints in docstrings in favor of the ones in method signatures. Use function signature type hints in autodoc generated docs. Change Deferred type hints to strings. Older versions of twisted (<21.7) don't support generic Deferred type hinting, this prevents crashes on those versions. Closes: https://github.com/deluge-torrent/deluge/pull/359
* [GtkUI] Fix ETA being copied to neighboring empty cellsChase Sterling2022-02-11
| | | | | | | | | An optimization that avoided re-rendering treeview cells sometimes went wrong, and rendered a value from the wrong row when moving the mouse around the torrentview window. Closes: https://dev.deluge-torrent.org/ticket/3500 Closes: https://github.com/deluge-torrent/deluge/pull/371
* [GTK] Workaround crash on Windows with ico or gif iconsCalum Lind2022-02-09
| | | | | | | | | | A problem with GdkPixbuf loaders on Windows causes a hard crash when attempting to load ico or gif tracker icons. Added a workaround by skipping these icon types until a more permanent solution is found. Ref: https://dev.deluge-torrent.org/ticket/3501
* [GTK] Refactor out get_pixbuf_at_sizeCalum Lind2022-02-09
| | | | | The functionality of get_pixbuf and get_pixbuf_at_size is almost identical so reuse get_pixbuf with an optional size arg.
* [Core] Convert inlineCallbacks to maybe_coroutineChase Sterling2022-02-06
| | | | | | | | | | Make logging functions synchronous. They were not calling any async functions, and wrapping them in maybe_coroutine caused reactor to be imported before gtkui could install the gtk reactor. Closes: https://github.com/deluge-torrent/deluge/pull/353
* [Decorators] Add maybe_coroutine decoratorChase Sterling2022-02-06
| | | | | | | | | | | | - Clean up callback hell by making more code inline - Use async/await syntax as it has more modern niceties than inlineCallbacks - Also gets us closer if we want to transition to asyncio in the future - `await` is usable in places that `yield` is not. e.g. `return await thething` `func(await thething, 'otherparam')` - IDEs know async semantics of async/await syntax to help more than with `inlineCallbacks` - `maybe_coroutine` decorator has nice property (over `ensureDeferred`) that when used in a chain of other coroutines, they won't be wrapped in deferreds on each level, and so traceback will show each `await` call leading to the error. - All async functions wrapped in `maybe_coroutine` are 100% backwards compatible with a regular Deferred returning function. Whether called from a coroutine or not. - Use Deferred type hints as strings since older versions of twisted (<21.7) don't support generic Deferred type hinting.
* [Plugins] Fix namespace deprecation warningCalum Lind2022-02-06
| | | | | The plugin namespace was changed from deluge.plugins to deluge_ in 535b13b5f1b7b7 but deprecation warning was not updated.
* [Config] Add mask_funcs to help mask passwords in logsCalum Lind2022-02-06
| | | | | | | | | | | Added a new Config class parameter `log_mask_funcs` to enable config instances hide sensitive information that would normally appear in config debug logs. Added mask password function to hostlist to replace passwords with '*'s in logs. Closes: https://github.com/deluge-torrent/deluge/pull/363
* [Console] Add the torrent label to info commandkingamajick2022-02-06
| | | | | Closes: https://dev.deluge-torrent.org/ticket/1556 Closes: https://github.com/deluge-torrent/deluge/pull/356
* Revert "[Core] Document all exported core methods with type hints"Calum Lind2022-02-05
| | | | | | | | | | | | | | | Typing is broken with older versions of Twisted e.g. with v21.2 deluge/deluge/core/core.py", line 404, in Core ) -> defer.Deferred[str]: TypeError: 'type' object is not subscriptable Also it might not be compatible with Python 3.6 or 3.7 with use of certain types such as dict rather than Dict This reverts commit 4096cdfdfe4fc7e42746cedd868bd7d8fea99f23. Ref: https://twistedmatrix.com/trac/ticket/9816
* [Core] Document all exported core methods with type hintsChase Sterling2022-02-05
| | | | | | | | | Standardize docstrings in core.py to google standard. Remove type hints in docstrings in favor of the ones in method signatures. Use function signature type hints in autodoc generated docs. Closes: https://github.com/deluge-torrent/deluge/pull/359
* [Config] Replace custom property decoratorCalum Lind2022-02-05
|
* [Config] Refactor config classCalum Lind2022-02-05
| | | | | | | | | | | | | * Refactored duplication with setting config key and logging * Simplified lazy importing reactor for callLater. This lazy importing is required for testing and also prevents Gtk UI lockup if reactor imported in Config. * Fixed saving config to file when setting a key that doesn't exist yet. This was due to returning early in the set_item method. * Added a `default` arg to set_item to prevent saving to file when only setting a default value for a key in init. * Moved casting value to existing key type from set_item to dedicated function.