Commit Graph

8905 Commits

Author SHA1 Message Date
Calum Lind e50927f575
[GTK] Fix unable to prefetch magnet in thinclient
A UnicodeDecodeError is raised in transfer module when attempting to
prefetch a magnet.

This is result of passing a Python dict containing text bytes and raw
bytes that cannot be decoded as utf-8 in rencode when recieving the
message. This could be handled in rencode by returning raw bytes if
decoding fails (perhaps with a strict mode?) however better to follow
convention of encoding raw bytes in base64 in API calls.

Fixed by retaining bencoding and encoding with base64 when sending
result.

Resolves: https://github.com/deluge-torrent/deluge/pull/334
2022-01-08 19:43:40 +00:00
Calum Lind 79b7e6093f
Fix is_url and is_infohash error with None value
Encountered a TypeError with None value passed to is_infohash function
so add guard clause.
2022-01-08 13:56:05 +00:00
DjLegolas 4f0c786649
[AutoAdd] Fixed error dialog not being shown on error
This happened due to the removal of `exception_msg` attribute, which was
removed with the changes to `RPC` protocol in commit 9b812a4.
Now we access the message using the `message` attribute.

Closes: deluge-torrent/deluge#332
Closes: https://dev.deluge-torrent.org/ticket/3069
2022-01-06 10:06:03 +00:00
DjLegolas fca08cf583
[TrackerIcon] Fixed old-large icon removal
After downloading and resizing the new icon, we try to remove the downloaded
file, which is larger, but it fails because it tries to do so when the file
is still open, and therefor locked.
On close of the UI, we got `PermissionError` exceptions for each new icon.
2022-01-06 10:04:22 +00:00
DjLegolas 517b2c653b
[TrackerIcon] Fixed parse error on UTF-8 sites with non-english chars
When parsing the site's page in search for the FAVICON, the page gets opens.
The default file encoding in dependent on the running OS, and might not
be `UTF-8` on Windows.
Therefor, some trackers might not get their icon downloaded at all because of
an error:
`UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 2158: character maps to <undefined>`.
This fix adds a detection of file encoding using the optional `chardet` dependency, and also a test.

Closes: deluge-torrent/deluge#333
Closes: https://dev.deluge-torrent.org/ticket/3479
2022-01-06 10:04:19 +00:00
Patrick Byrne 44dcbee5f4
[GTK] Make combobox_window expand to width
This makes the download location entry textbox resizable which is very
useful for entering long paths.

Closes: deluge-torrent/deluge#295
2022-01-03 22:17:00 +00:00
DjLegolas efc9f465f0
[WebUI] Define foreground and background colors
There is no promise that default bg is white and default fg is black so
define in deluge.css

Ref: https://dev.deluge-torrent.org/ticket/3435
Closes: deluge-torrent/deluge#330
2022-01-03 22:07:11 +00:00
DjLegolas 5321d24f2a
[GTK] Use GtkSpinner when testing open port
this switched was motivated by an error which happened each time the check
port button was clicked, and was caused by the GtkImage when loading the
loading.gif file on Windows:

    cannot register existing type 'GdkPixbufGdipAnim'

Closes: deluge-torrent/deluge#329
2022-01-03 22:02:53 +00:00
RedBearAK f30f7f4629
[UI] Add Keywords property to desktop file
Deluge fails to appear in some app launchers (GNOME app search, Albert launcher) when searching for just "torrent" or other keywords, rather than "bittorrent". This is due to the lack of a Keywords header/property in its desktop entry file. Adding this line should solve the issue.

I don't know if the underscore "_" is actually necessary for this line, I just copied the appearance of the lines above it when inserting. Please check that this comes out without the underscore in the final file after processing.

Closes: deluge-torrent/deluge#323
2021-12-29 21:54:00 +00:00
DjLegolas ec0bcc11f5
Upgrade codebase with pyupgrade (>=py3.6)
Added pyupgrade utility with manual stage to pre-commit and run on all
files.

Ref: https://github.com/asottile/pyupgrade
Closes: deluge-torrent/deluge#326
2021-12-29 21:51:07 +00:00
Calum Lind 16895b4a49
[Docs] Fix spinx-contrib-spelling build error
CI docs build was failing with the following error when using latest
sphinx-contrib-spelling 7.3.1

    error: option -j not recognized

Fixed by pinning to previous version.

GitHub-ref: https://github.com/sphinx-contrib/spelling/issues/142
2021-12-29 21:43:03 +00:00
DjLegolas f3784723ae
[UI] Add SVG support for tracker icons
SVG files are supported by all browsers so need to support it as well,
according to https://www.w3schools.com/html/html_favicon.asp

Also, it appears as SEO.com site, which was dropped because of a cert issue,
has only SVG icon. So enabled it again.

Lastly, from python 3.2, `os.path.samefile` is supported on Windows.
So Windows will now test TrackerIcons as well.
2021-12-29 21:38:55 +00:00
DjLegolas 7f5857296e [CI] Upgrade Windows python version to 3.8 (same as linux) 2021-12-29 20:06:10 +02:00
DjLegolas 897955f0a1
Remove all Python 2 support
* Removed all __future__ imports from code
* Removed all six dependencies
* Removed all future_builtins imports
* Removed all Python 2 related code

Closes: deluge-torrent/deluge#325
2021-12-28 19:26:38 +00:00
Calum Lind ff309ea4c5
[GtkUI] Fix ETA sorting to match WebUI
The sort for Ascending was putting longest eta first but seems more
intuitive that the smallest time to wait should be first. The WebUI
in previous commit swapped this behaviour so updating GtkUI.
2021-12-22 23:17:14 +00:00
DjLegolas 3b11613cc7
[WebUI] Fixed ETA sorting in WebUI
When sorting the according to ETA values, all torrents with infinite value were being
considered a lower value (INF -> 12 -> 32) instead of largest (12 -> 32 -> INF).
This is due to the fact that the INF symbol is placed to lower value (<= 0).
Now the lower values are being treated as the largest JS number when sorting.

Closes: https://dev.deluge-torrent.org/ticket/3413
Closes: https://github.com/deluge-torrent/deluge/pull/321
2021-12-22 22:04:24 +00:00
DjLegolas a2d0cb7141
[Console] Removed Core dependency from Console UI
UIs should not depend on core directly, so removing the dependency in ConsoleUI.
This is done by adding a hard-coded variable.

Closes https://dev.deluge-torrent.org/ticket/3491
Closes: https://github.com/deluge-torrent/deluge/pull/320
2021-12-22 21:53:17 +00:00
DjLegolas 88ffd1b843
[Servers] Moved check_ssl_keys and generate_ssl_keys to crypto_utils.py
With this change, we drop a core dependency from the UI. This will help group together
all related functionality in one place, i.e. all security related functions.

Also updated testssl.sh version to 3.0.6 (SECURITY_TEST)

Closes: deluge-torrent/deluge#288
2021-12-20 22:09:08 +00:00
Calum Lind 6a10e57f7e
back to development 2021-12-15 19:43:39 +00:00
Calum Lind 612e0061ed
Release 2.0.5 2021-12-15 18:48:16 +00:00
Calum Lind 2eee7453cb
Update Changelog 2021-12-15 18:45:25 +00:00
Calum Lind 58cc278145
[i18n] Fix set_language error with empty lang string
The Web server config for language was set to an empty string which
resulted in an warning logged by i18n set_language.

* Changed set_language to ignore empty language string and do nothing.
We don't want to override the user's system language unless actually
specified by the user.
* Improved the translation warning message.
2021-12-15 18:35:50 +00:00
Calum Lind a03e649da6
[Build] Fix WebUI js minifying error
Some users encoutered a bug where WebUI in browser show a white screen,
which indicates a problem with loading javascript files. The problem was
due to closure minifying failure leaving a zero-length deluge-all.js
file which broke the usual fallback mechanism to debug files.

* Fixed usage of ES6 const declaration breaking closure minifying.
* Cleanup minified files upon errors so no zero length files left
* Replaced broken and unmaintained slimit with rjsmin.
* Fixed unable to set dev or debug query args due to request args
requiring bytes.
2021-12-15 09:37:55 +00:00
Calum Lind 073bbbc09d
[Packaging] Start replacing deprecated distutils
Working towards removing distutils

> direct usage of distutils is now actively discouraged,
with setuptools being the preferred replacement.

Ref: https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html
2021-12-13 23:57:09 +00:00
Calum Lind bca0aa3532
[CI] Replace pypi deluge-libtorrent with libtorrent
* Remove certifi since included in requirements.txt
* Remove old travis config
2021-12-12 21:49:31 +00:00
Calum Lind cb588d0205
[Docs] Update release checklist page 2021-12-12 21:43:54 +00:00
Calum Lind 2b20e9689b
back to development 2021-12-12 19:35:54 +00:00
Calum Lind 65f7cf0d83 Release 2.0.4 2021-12-12 18:57:38 +00:00
Calum Lind 5ac8f4c81b Update changelog 2021-12-12 18:55:41 +00:00
Calum Lind c33c9082d9 [Docs] Add Flatpak install links 2021-12-12 18:39:41 +00:00
Calum Lind 62ae0f5ef6 [Docs] Update install guide
Rewrite install instructions to include more details on Deluge 2.0
install.

* Added other Linux distros
* Added stable PPA details
* Added link to forum for Windows and macOS community packages

Co-authored-by: Sergio M <sergio@example.com>
Co-authored-by: Ofry Linkovsky <15746116+OfryL@users.noreply.github.com>
Closes: deluge-torrent/deluge#296
Closes: deluge-torrent/deluge#310
2021-12-12 18:27:05 +00:00
Calum Lind 24aa48187e [Docs] Replace recommonmark with MyST parser
We used recommonmark so that we can use markdown in sphinx but it is
buggy and now so switch to better supported MyST-parser.

* Fixed incorrect heading warnings in markdown.
* Added sphinx toctree to markdown using directive as required by MyST.
* Upgraded Sphinx to 4.3

Ref: https://myst-parser.readthedocs.io
2021-12-12 18:16:21 +00:00
DjLegolas 342cca4367 [GTKUI] Open tracker edit with double click
Closes #2434
Closes: deluge-torrent/deluge#253
2021-11-26 07:29:34 +00:00
Unit 193 9194092d7b [GTKUI] Support using the Ayatana fork of indicators.
As this fork is maintained in Debian, and as of Impish/21.10 is the supported
variant in Ubuntu as well.

Closes: deluge-torrent/deluge#317
2021-11-24 19:49:49 +00:00
Andrew Stone 5f6f65a065 [GTKUI] Add "Last Transfer" column
Closes: deluge-torrent/deluge#255
2021-11-23 20:45:09 +00:00
Gregorio Litenstein 967537a409 [GTK3UI] Allow escape key to close Create Torrent dialog 2021-11-23 20:07:44 +00:00
Calum Lind f74163489c [Packaging] Fix gtk3 glade path in MANIFEST
Missed path update when moving from gtk2 to gtk3
2021-11-23 20:07:33 +00:00
Martin Hertz 7a110bd60f [Plugins] Fix allow enabling any plugin Python version
Properly fix allow enabling any plugin Python version, first attempted
in previous commit 3433a91

Closes: deluge-torrent/deluge#316
2021-11-08 19:27:24 +00:00
Matias Wilkman d56636426e [GTKUI] Added detection of torrent URL on GTK UI focus
In case deluge GTK gets focus with a new torrent URL on the clipboard,
the "Add Torrent from URL" dialog will pop up automatically

Closes: deluge-torrent/deluge#306
2021-10-03 19:34:09 +01:00
Calum Lind de4fbd2e82 [Core] Workaround torrent file_progress lt 2.0 error
Workaround lt 2.0 python bindings error when calling a torrent handle
file_progress:

```
Boost.Python.ArgumentError: Python argument types in
    torrent_handle.file_progress(torrent_handle)
did not match C++ signature:
    file_progress(libtorrent::torrent_handle {lvalue}, libtorrent:🎏:bitfield_flag<unsigned char, libtorrent::file_progress_flags_tag, void> flags=0)
```

Should be fixed in 2.0.5 release: https://github.com/arvidn/libtorrent/commit/3feba04e6d
2021-10-03 18:53:31 +01:00
Calum Lind 9c3982d4ff [GTKUI] Fix piecesbar crashing when enabled
When enabled in preferences the piecesbar was crashing the application.

This was narrowed down to an issue with text_font property and there was a
suggestion that the PangoFontDescription should be freed after getting
the result from get_style_context.

Fixed by creating a copy of the PangoFontDescription

Refs:

 * https://trac.wxwidgets.org/ticket/15697#comment:1
2021-10-03 17:20:22 +01:00
Calum Lind 88fc21e993 [Stats] Fix cairo error and failing tests
Fixed the Stats GTKUI test not updated to the new GTK3 dir layout.

Fixed pygobject cairo ImageSurface error:

    AttributeError: 'gi.repository.cairo' object has no attribute 'ImageSurface'

The documentation seems to suggest that using `import cairo` is the correct
usage and this fixed the issue, along with adding suggested gi.require_foreign
call.

References:

https://pygobject.readthedocs.io/en/latest/guide/cairo_integration.html
2021-10-03 14:22:11 +01:00
Calum Lind 54674576db [UI] Remove num_blocks_cache_hits usage for stats
Removed in libtorrent v2: https://github.com/arvidn/libtorrent/commit/569d4
2021-10-03 14:19:40 +01:00
iczero 89189adb24 [Core] Stop using removed disk.num_blocks_cache_hits stat
Removed in libtorrent v2.0.0:
569d47c391
2021-10-03 14:19:17 +01:00
Calum Lind a5a7da4a1a [Core] Use external_address in external_ip alert handler
Unit tests are segfaulting and this is a result of a subsequent call to
pop_alert creating a dangling pointer to alert.message method.

Replace alert.message call with correct external_address property that
doesn't require any parsing and wonder trigger segfault to expired
pointer.

https://github.com/arvidn/libtorrent/issues/6437
2021-10-03 14:16:57 +01:00
Calum Lind 1e6cc03946 [Lint] Fix spelling mistakes
A quick fix of some of the mistakes caught by codespell.
Updated readme with new IRC server

Useful to add it as part of linting checks.
2021-09-21 21:43:53 +01:00
Calum Lind d8526ba653 [UI] Add magnet icons for copy and add actions
Added new magnet icons with a consistent naming scheme
Run script to update all icons

Co-authored-by: Matias Wilkman <matias.wilkman@gmail.com>
2021-09-21 20:38:08 +01:00
Gargaj c38f913948 [WebUI] Add menu option to copy magnet URI 2021-09-21 20:35:24 +01:00
Calum Lind 0659fe4641 [Core] Export torrent get_magnet_uri method
Returns a generated magnet uri from torrent info
2021-09-21 20:27:38 +01:00
Calum Lind 10501db63d [i18n] Update translation PO files from Launchpad 2021-09-14 22:02:56 +01:00