Commit Graph

9109 Commits

Author SHA1 Message Date
gmega 5930bc976c
switch libtorrent origin to https 2024-10-29 17:50:27 -03:00
gmega 5544235d6b
add missing checkout 2024-10-29 17:42:30 -03:00
gmega 3cf56bad1b
add ref id to metadata step 2024-10-29 17:38:20 -03:00
gmega 8070dad226
fix docker build flow 2024-10-29 17:10:27 -03:00
gmega 21d61c6f0f
add docker build 2024-10-29 14:40:34 -03:00
gmega 18764a904a
fixes to configurations 2024-10-29 11:52:27 -03:00
gmega ed08ed4c22
explicitly set random_port option to false to override default 2024-10-28 10:37:42 -03:00
gmega bc81481c4c
Dockerize deluge 2024-10-25 19:20:55 -03:00
gmega 73b59fb24b
check-in libtorrent as a submodule 2024-10-24 17:20:29 -03:00
gmega f138e88e5b
add simple metrics 2024-10-18 18:39:09 -03:00
Niluge_KiWi 8df36c454b
[WebUI] Accept network interface name as well as IP address
Deluge & libtorrent actually accept both IP address and device/interface namesgq
as listen_interface: 540d557c which patched ui/ console & gkt3, but not
web, this fixes it.

(Inspired by https://github.com/deluge-torrent/deluge/pull/300)

(Translation should be ok: this string already exists)

Also, resync listen & outgoing widths: they hold the same data types.

Closes: https://github.com/deluge-torrent/deluge/pull/458
2024-09-10 19:04:37 +01:00
Martin Hertz 40d4f7efef
[Console] Fix 'move' command hanging when done
Console.get_torrent_name() expects string, but was given list from console.match_torrent(), so NoneType breaking join() in move message.

Console.get_torrent_name() expects string, but was given list from console.match_torrent(), so NoneType breaking join() in move message. Simplified and fixed now.

Co-authored-by: Calum Lind <calumlind+deluge@gmail.com>
Closes: https://github.com/deluge-torrent/deluge/pull/447
2024-09-10 19:00:41 +01:00
Calum Lind d064ad06c5
[Docs] Replace black/flake8 with pre-commit 2024-09-08 18:32:06 +01:00
Calum Lind 0d72195281
[Lint] Format code with ruff
`pre-commit run --all-files`
2024-09-08 17:51:43 +01:00
Calum Lind 2247668571
[Lint] Fix ruff lint gettext and type comparison
The gettext strings cannot be formatted until after the function return
from gettext.

Refs: https://docs.astral.sh/ruff/rules/f-string-in-get-text-func-call/
Refs: https://docs.astral.sh/ruff/rules/printf-in-get-text-func-call/
2024-09-08 17:48:43 +01:00
Calum Lind e7d08d7645
[Typing] Add pyright config to suppress warnings
VSCode uses pylance/pyright, a performant type checker. So
setup the builtins used by Deluge and set missing imports to
informational due to OS-specific imports.

It might be possible using extraPaths with extra stubs or use
defineConstants to make pyright not check Windows or Macos conditional
paths but that would require changing all usage so leaving for another
time.

Refs: https://github.com/microsoft/pyright/blob/main/docs/configuration.md
Refs: https://github.com/microsoft/pyright/blob/main/docs/builtins.md
2024-09-08 17:48:05 +01:00
Calum Lind 90c5e75373
[Lint] Replace black/flake8/isort with ruff
Use ruff as a single performant tool to lint and format Python code.
2024-09-08 17:46:40 +01:00
Martin Hertz c88f750108
[Console] Block interactive-mode on Windows even with windows-curses
Testing with window-curses results in hangs on initial loading with background error:

    File "C:\Users\Docker\Deluge\.venv\lib\site-packages\twisted\internet\selectreactor.py", line 39, in win32select
        r, w, e = select.select(r, w, w, timeout)
    builtins.OSError: [WinError 10038] An operation was attempted on something that is not a socket

This is due to passing a Console class to addReader but this fails since
select on Windows cannot handle non-socket file object unlike Unix which accepts
sockets and file objects.

There is likely a further issue where windows-curses has not implemented
resizeterm so would need to use resize_term instead.

Refs: https://docs.python.org/3/library/select.html#select.select
Refs: https://stackoverflow.com/questions/11731175/python-twisted-addreader-works-in-linux-but-not-windows
Refs: https://github.com/zephyrproject-rtos/windows-curses/issues/40
Refs: https://docs.python.org/3/library/curses.html#curses.resize_term

Closes: https://github.com/deluge-torrent/deluge/pull/457
Co-authored-by: Calum Lind <calumlind+deluge@gmail.com>
2024-09-08 10:04:42 +01:00
Calum Lind 491458c4ad
[CI] Fix accidental revert of Twisted pin for Windows
In commit 9d802b2 I pushed a change to tests which included a revert of
Windows pinned dependencies which was an accident. The actual change
should only have reverted setup.py pinned dependency since we down want
a release to not be able to use a later fixed version of Twisted.
2024-09-08 09:49:18 +01:00
Mamoru TASAKA 5d96cfc72f
[UI] Replace deprecated cgi module with email
As PEP 594 says, cgi module is marked as deprecated
in python 3.11, and will be removed in 3.13
(actually removed at least in 3.13 rc1).

As suggested on PEP 594, replace cgi.parse_header
with email.message.EmailMessage introduced in python 3.6.

Updated test modify test_download_with_rename_sanitised
- With RFC2045 specification, Content-Disposition filenames
parameter containing slash (directory separator) must be
quoted, so changing as such.

Ref: https://peps.python.org/pep-0594/#deprecated-modules
Ref: https://peps.python.org/pep-0594/#cgi

Closes: https://github.com/deluge-torrent/deluge/pull/462
2024-09-08 09:45:14 +01:00
zakary 3bceb4bfc1
[UI][Common] Wrap torrent comment and tracker status URLs in HTML (clickable)
Closes: https://github.com/deluge-torrent/deluge/pull/460
2024-09-08 09:45:14 +01:00
Calum Lind 9d802b2a91
[Tests] Fix missing __qualname__ for mock callback
test_pop_alerts raised the following error:

    File "/home/runner/work/deluge/deluge/deluge/core/alertmanager.py", line 177, in handle_alerts
        handler=handler.__qualname__,
    File "lib/python3.10/unittest/mock.py", line 645, in __getattr__
        raise AttributeError(name)
    AttributeError: __qualname__

Mocks don't generate dunder methods like `__qualname__` attribute so
we need to manually specify it.
2024-09-06 21:02:50 +01:00
Gregorio Litenstein 8867da94f8
[Console] endwin() not needed when using wrapper
Using it anyway produces a crash because it returns an error if called two times without any intervening updates.

Closes: https://github.com/deluge-torrent/deluge/pull/461
2024-08-26 20:48:38 +01:00
Martin Hertz e1fa8d18ec
[Console] Improve interactive-mode preferences saving
The bottom options for cancel/apply/ok where confusing for end-users as being checkboxes needing spacebar prepended to activate firstly, before return/enter to activate said previous selection, but changed now to omit. Also fixed not showing canceled options as sticking.

Co-authored-by: Calum Lind <calumlind+deluge@gmail.com>
Closes: https://github.com/deluge-torrent/deluge/pull/445
2024-08-26 19:43:11 +01:00
kenstir d5af32802f
[Build] Fix Ubuntu dependency for appindicator
Change name to gir1.2-appindicator3-0.1.  Tested on Ubuntu 22.04.4 LTS
and Ubuntu 20.04.6 LTS.
Replace appindicator3 refs with newer ayatanaappindicator3
Replace broken python-appindicator link with working jammy link.

Closes: https://github.com/deluge-torrent/deluge/pull/459
2024-08-26 19:39:59 +01:00
Calum Lind d1d72b1be8
[UI] Replace deprecated Pillow Image.Antialias with Lanczos
ANTIALIAS was removed in Pillow 10.0.0 so replace with suggested
alternative.

Ref: https://pillow.readthedocs.io/en/stable/releasenotes/10.0.0.html#constants
2024-08-26 19:36:53 +01:00
Calum Lind 776efe4faa
[i18n] Update po files from launchpad 2024-08-24 23:14:49 +01:00
Jacob Siverskog f101f0afdd
[Console] Fix ports typo
incomming -> incoming.

Closes: https://github.com/deluge-torrent/deluge/pull/442
2024-08-24 17:40:12 +01:00
Martin Hertz d98d15422a
[AutoAdd] Fix Windows display scaling breaking WebUI elements
Closes: https://github.com/deluge-torrent/deluge/pull/444
2024-08-24 17:35:31 +01:00
zakary d9e3facbe8
[CI] Update actions to latest version (node 16 deprecation)
Closes: https://github.com/deluge-torrent/deluge/pull/453
2024-08-24 17:33:18 +01:00
Martin Hertz 6ba23a8013
[Packaging] NSIS x64 reg-keys into proper place
Closes: https://github.com/deluge-torrent/deluge/pull/455
2024-08-24 16:13:36 +01:00
Calum Lind af70ff1fdc
[Util] Refactor reset language env vars 2024-08-24 13:52:24 +01:00
DjLegolas 18fa028d2d
[3635][WebUI] fix language change to system default
When setting a language, we set 2 environment variables at run time.
Setting the language back to `System Default`, we don't clean those env
variables.
In the WebUI, the page only reloads, and we still use the env variables
to set the language back to the previous one.
This does not affect GTK.

Closes: https://dev.deluge-torrent.org/ticket/3635
Closes: https://github.com/deluge-torrent/deluge/pull/450
2024-08-24 13:42:13 +01:00
DjLegolas 322faa7a54
[Build] Prevent usage of twisted>=23 on Windows
with newer versions of twisted, a regression was added for the GTK
reactor on Windows.
it effects all versions, including latest (currently 24.3.0).

So will prevent the upgrade on Windows only.

Issue: https://dev.deluge-torrent.org/ticket/3634
Related: https://github.com/twisted/twisted/issues/11987
Closes: https://github.com/deluge-torrent/deluge/pull/448
2024-08-24 11:34:16 +01:00
Calum Lind 785ad00d2b
[WebUI] Fix gettext _ imports 2024-08-24 09:23:22 +01:00
Calum Lind 1e5f248fb8
[WebUI] Fix error stopping daemon in connection manager
The wrong number of arguments was being parsed from get_host_info.
2024-08-24 09:23:22 +01:00
Calum Lind 80985c02da
[CI] Disable failing alertmanager test on Windows
The test_pause_not_pop_alert test passes on Linux but is consistently failing
in CI pipeline for Windows:

    AssertionError: Expected 'mock' to not have been called. Called 1 times.
    Calls: [call.deferred.cancel(),
    call(LtAlertMock(type=1, name='mock_alert1', message='Alert 1'))].

Disabling the test until it can be resolved.
2024-08-19 16:30:12 +01:00
Calum Lind 7660e2e5ca
Add deluge.pot to repo for new translation app
Attempting to move to weblate but need deluge.pot in the repo
2024-07-15 08:39:31 +01:00
Calum Lind 7f3f7f69ee
[GtkUI] Reword preferences to prefer dark theme
The GTK option for dark theme only provides a preference to use the dark
theme, there is not a similar option for light theme so the settings
should only refer to 'prefer dark theme' and whether it's on or off.
2024-02-19 17:50:37 +00:00
Calum Lind 5dd7aa5321
[WebUI] Refactor changing theme
Simplify searching for themes and ensure theme is ordered last.

Ideally themes would be set client-side but seems to be quite tricky to
accomplish with ExtJS.
2024-02-19 17:50:32 +00:00
DjLegolas ee97864086
[GtkUI] Add a way to change themes
Currently, the only way to change the themes is by manually set a value
in the command line or set it as env variable.

Closes: https://dev.deluge-torrent.org/ticket/3536
Closes: https://github.com/deluge-torrent/deluge/pull/392
2024-02-19 17:49:04 +00:00
DjLegolas 848d668af9
[WebUI] Add a way to change themes
Currently, the only way to change the themes is by manually set a value
in the `web.conf` file itself.

Closes: https://dev.deluge-torrent.org/ticket/3536
2024-02-19 15:54:57 +00:00
Chris Ross d9ef65d745
[WebUI] Fix tracker icon to fit within tracker column rows
For me at least, Safari on Mac OS X, the tracker icon significantly
overflows in the Tracker column of the torrent list. (It does show the
correct size in the Trackers filter, though. Different CSS.)

This change causes it to constrain down to the height of the column and
display correctly.

Closes: https://github.com/deluge-torrent/deluge/pull/440
2024-01-21 15:20:24 +00:00
freddy2659 7f70d6c6ff
[WebUI] Fix progress divide by 0 error with empty dir
If a dir exists with no contents then the following error occurred:

```
Traceback (most recent call last):
  ...
  File "/usr/lib/python3.10/site-packages/deluge/ui/web/json_api.py", line 608, in _on_got_files
    dirinfo['progress'] = sum(progresses) / dirinfo['size'] * 100
builtins.ZeroDivisionError: float division by zero
```

Closes: https://github.com/deluge-torrent/deluge/pull/439
2024-01-21 15:18:29 +00:00
Calum Lind b7450b5082
[Docs] Bump sphinx version requirements
There are still warnings that need to be resolved but the build is
passing.
2024-01-21 15:10:47 +00:00
Calum Lind 7046824115
[Alerts] Fix alert handler segfault on lt.pop_alerts
We cannot handle an alert after calling lt.pop_alerts for a subsequent
time since the alert objects are invalidated and with cause a segfault.

To resolve this issue add a timeout to the handler calls and wait in the
alert thread for either the handlers to be called or eventually be
cancelled before getting more alerts.

This is still not an ideal solution and might leave to backlog of alerts
but this is better than crashing the application. Perhaps the timeout
could be tweaked to be shorter for certain alert types such as stats.

Related: https://github.com/arvidn/libtorrent/issues/6437
2024-01-21 14:16:22 +00:00
Calum Lind fa8d19335e
[GTK3] Fix changing torrent ownership
The change ownership menu item was broken due to Gtk deprecation
changes in commit #bcaaeac.

Fixed by correctly setting the RadioMenuItem group

Refactored to simplify the code
Removed dead or unneeded code

Fixes: https://dev.deluge-torrent.org/ticket/3610
2023-12-02 21:20:22 +00:00
Calum Lind 0c1a02dcb5
[Core] Remove usage of deprecated torrent status.paused
Noticed mismatch with current lt docs and found usage of deprecated
status.paused.

The actual check here is not required we should just attempt to pause
the torrent.

Issue: https://dev.deluge-torrent.org/ticket/3499
2023-12-02 21:20:11 +00:00
Calum Lind 810751d72a
[Tests] Refactor parse_human_size test 2023-11-30 19:03:40 +00:00
Calum Lind 7199805c89
[Common] Fix order of size_units for parse_human_size
The previous commit changed the order of the size
2023-11-27 16:52:03 +00:00