Commit Graph

9080 Commits

Author SHA1 Message Date
DjLegolas 7c9a542006
[GTK] Hide account password length in log
We should not let anyone know the account's password length,
as it can help to crack it.
Instead, we will print a constant amount (10) of asterisks.

Closes: https://github.com/deluge-torrent/deluge/pull/346
2022-01-23 16:39:24 +00:00
Cirno the Strongest e75ef7e31f
[Packaging] Simplify PyInstaller spec file
This makes the process of editing the file much more pleasant and
removes duplicate code.

Fixed collecting twisted package which brings both build speed
improvements but also decreases package size, as it stops PyInstaller
from bundling tests (actually, some tests might even execute during
import and break build if they're designed to throw!) used by
PyInstaller

Closes: https://github.com/deluge-torrent/deluge/pull/342
2022-01-23 16:04:33 +00:00
DjLegolas 4f87612a0f
[Common] Replace distro.linux_distribution function
As of distro (1.6.0)[1], this function is marked as deprecated.
Instead, we will use the underlying functions directly, as explained in the (docs)[2].

[1] https://github.com/python-distro/distro/issues/263#issuecomment-927098357
[2] https://distro.readthedocs.io/en/latest/#distro.linux_distribution

Closes: https://github.com/deluge-torrent/deluge/pull/345
2022-01-22 12:06:38 +00:00
tbkizle 2cad0f46f2
[CI] Add pygame to windows package build/spec file
pygame is required by notification plugin for sounds
2022-01-21 13:12:23 +00:00
Calum Lind 5931d0cc0b
[CI] Fix package job not running with PR label
The job would only run when the PR was labeled since
`github.event.label.name` only available when `labeled` type event
recieved
2022-01-21 12:53:54 +00:00
Calum Lind 9d4ca77ef7
[CI] Cleanup packaging dependencies 2022-01-21 12:53:54 +00:00
tbkizle ad27a278fd
[GTK UI]About Dialog Update year 2022-01-21 12:53:54 +00:00
Calum Lind 4f17fc41a5
[Packaging] Disable GTK CSD by default on Windows
CirnoT reported how they felt that GTK3 is not reliable on Windows.
Seeing some weird issues where clicking Deluge icon on taskbar does
bring window to front but doing so again does not minimize it as one
would expect. By using GTK_CSD=0 this would reduce these problems.

> If changed to 0, this disables the default use of client-side
decorations on GTK windows, thus making the window manager responsible
for drawing the decorations of windows that do not have a custom
titlebar widget.

This can be overridden by a global env var.

Ref: https://github.com/deluge-torrent/deluge/pull/331#issuecomment-1012311605
Ref: https://docs.gtk.org/gtk3/running.html
2022-01-21 12:53:54 +00:00
Calum Lind 15d2d27a53
[CI] Specify github windows server version
To ensure builds don't break avoid using windows-latest

Refs: https://github.com/actions/virtual-environments/issues/4856
2022-01-21 10:16:15 +00:00
Calum Lind 65e5010e7f
[Core] Add pygeoip dependency support
Provide support for the pure-python pygeoip as compiled GeoIP is not
always available.

Ref: https://dev.deluge-torrent.org/ticket/3271
2022-01-21 10:02:18 +00:00
DjLegolas 9b97c74025
[GTK] Added a torrent menu option for magnet copy
this will lined-up with the WebUI, which already have this option.
in addition, it will not open the Add Torrent URL dialog after copied,
which happens automatically when there is torrent/magnet URIs in the clipboard.

Closes: deluge-torrent/deluge#328
Closes: https://dev.deluge-torrent.org/ticket/3489
2022-01-21 09:41:59 +00:00
Calum Lind d62362d6ae
[CI] Improve packaging workflow
Include arch in artifacts so they can be downloaded separately

Added libtorrent 2.0 to matrix since users often request latest
libtorrent.

Renamed workflow to make it's purpose clearer
2022-01-20 15:31:15 +00:00
Calum Lind 1a9affbbac
[Build] Add missing setuptools to requirements
Although likely to already be installed this is a runtime requirement
for Deluge
2022-01-20 14:49:53 +00:00
Calum Lind 2316088f5c
[CI] Remove PR specified branch
This branch name is the head name not the base name so prevents the job
running unless submitted has branch name that matches
2022-01-14 13:07:22 +00:00
Calum Lind d14310078b
[CI] Fix typo in CD 2022-01-13 22:46:02 +00:00
Calum Lind 1696c69776
[CI] Fix windows build tag exclude
Fixes error:

    you may only define one of `tags` and `tags-ignore` for a single event
2022-01-13 22:36:56 +00:00
Calum Lind 5f96ea4217
[CI] Restrict creating Windows installer
Limit the running of this job by only running on develop, tags and pull
requests that have label 'windows'
2022-01-13 22:23:25 +00:00
tbkizle 491a20cb08
Fix Execute and Extractor Plugins
Include missing twisted requirements resulting in errors:

    ModuleNotFoundError: No module named 'twisted.internet.utils'
2022-01-13 22:23:25 +00:00
tbkizle 490fb898af
Build With Patched Twisted Build
Fixes TypeError in simulate call

Ref: https://twistedmatrix.com/trac/ticket/9660
Ref: https://github.com/twisted/twisted/pull/1679
2022-01-13 22:23:25 +00:00
tbkizle 560a52a443
Fix OpenSSL For Libtorrent
libtorrent + pyinstaller requires a lib(ssl/crypto)-1_1.dll and
lib(ssl/crypto)-1_1-x64.dll odd quirk but solveable by just having
two copies. Maybe later compiling our own libtorrent.
2022-01-13 22:23:25 +00:00
tbkizle b9a208f18f
Update Windows Packaging
* Rename instances of win32 to generic win or the appropriate bit where applicable
* Remove files used in GTK2
* Add spec file for use with PyInstaller
* Remove Python bbfreeze Script
* Add Github Action To Build Releases
* Add Modified script to make files used by NSIS
* Update Readme

Closes: https://github.com/deluge-torrent/deluge/pull/331
2022-01-13 22:23:08 +00:00
Calum Lind 6da4c4bf66
Restore PY2 for 3rd-party plugins
Restored PY2 to avoid breaking compatibility with plugins that imported
PY2 from common.

Ref: https://bitbucket.org/bendikro/deluge-yarss-plugin/issues/67/deluge-210-removed-all-py2-support
2022-01-13 19:48:53 +00:00
Calum Lind d2390cd247
[i18n] Fix load_libintl error
Fixed libintl being undefined if no library was found
2022-01-12 20:19:56 +00:00
Calum Lind c3cd7f5e5c
[Plugins] Fix missing description with metadata 2.1
Changes to the metadata specs in v2.1 meant that Description field
might appear in the body of the message instead of as a header key.

Replaced custom parser with email parser (as outlined in the document
using compat32 policy) to simplify extracting the message header and
body.

Ref: https://dev.deluge-torrent.org/ticket/3476
Ref: https://packaging.python.org/en/latest/specifications/core-metadata/#description
2022-01-12 20:12:02 +00:00
Calum Lind 2351d65844
[Plugins] Fix and refactor get_plugin_info method
A new metadata version 2.1 has optional Description that is causing an
TypeError when looking up the key in plugin_info since clients are
assuming values are always strings but the default is None.

Fixed TypeError by ensuring that the info dict has a default empty
string set for all keys.

Separated the parsing of the pkg_info into static method to make it
easier to test.

Changed the missing plugin info to only set the Name and Version as
'not available' since all other fields are optional.

Ref: https://dev.deluge-torrent.org/ticket/3476
Ref: https://packaging.python.org/en/latest/specifications/core-metadata/#description
2022-01-12 19:19:39 +00:00
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