summaryrefslogtreecommitdiffstats
path: root/deluge/ui/web/server.py
Commit message (Collapse)AuthorAge
* Upgrade codebase with pyupgrade (>=py3.6)DjLegolas2021-12-29
| | | | | | | | 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
* Remove all Python 2 supportdeluge-2.1.0.dev0DjLegolas2021-12-28
| | | | | | | | | * 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
* [Servers] Moved check_ssl_keys and generate_ssl_keys to crypto_utils.pyDjLegolas2021-12-20
| | | | | | | | | 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
* [Build] Fix WebUI js minifying errorCalum Lind2021-12-15
| | | | | | | | | | | | | 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.
* [Lint] Fix spelling mistakesCalum Lind2021-09-21
| | | | | | | 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.
* [WebUI] Fix tracker icon download errorEFS2021-01-29
| | | | | | | | | | Encoutering an error when webui attempts to download tracker icon: Error occurred downloading file from "http://b'acg.rip'/": invalid hostname: b'acg.rip' Fixed by ensuring the request.tracker_name is decoded from bytes before looking up the icon name.
* [Web] Change request.base path encoding to utf-8Calum Lind2019-06-11
| | | | | | | | | | | A user reported a problem with setting base path resulting in this error: encoding with 'idna' codec failed (UnicodeError: label too long) It is likely the base path is longer than 63 chars, which is unusual, however the idna codec is for domain name not paths so switch to utf-8. Fixes: #3261
* [Web] Fix TypeError with reverse proxy x-deluge-base headerCalum Lind2019-06-11
| | | | | | The request header needs decoded otherwise string comparisons fail. Fixes: #3260
* [Web] Fix peers tab failing to set flag locationthelamer2019-06-11
| | | | The request.country returns bytes not a string so decode.
* [Core] Refactor the base argparser and translation code.Calum Lind2019-05-11
| | | | | | | | | | | | | | - Move baseargparser out of deluge/ui since it is also used by the Daemon and could cause packaging issues if UI code is not available. - Renamed baseargparser to argparserbase to follow existing Deluge naming. - Renamed get_version to distinguish from deluge.common.get_version. - Translation code is usable by more than just the UIs so also move it to Deluge namespace and re-use i18n directory and make it a package. - Renamed setup_translations to singular as it felt more correct. - Renamed set_dummy_trans to be more descriptive. Closes: #3081
* [#3244|Web] Add support for accept-encoding headerCalum Lind2019-05-09
| | | | | | * Use EncodingResourceWrapper to replace compress function so that the proper checks for accept-encoding header are made. * Ensure only text is compressed and images are left uncompressed.
* [Lint] Fix flake8 3.7 warningsCalum Lind2019-03-29
| | | | | | | | | | | - Fix new flake8 warnings from latest version. Note: The `addSlash` variable was orphaned with no reference in Twisted or Deluge code so removed. - Update pre-commit config - New pinned versions. - Fix prettier output. - Use new flake8 hook config and add naming plugin.
* [GTK3] Fix gettext translation codeCalum Lind2018-11-02
| | | | | | | | | Add translation setup for Gtk.Builder ui files. Refactor and cleanup up the translations_util: - Remove old gtk.glade code. - Add macos libintl support. - Remove unneeded setup_translations parameters.
* [WebUI][#2009] Add About windowDjLegolas2018-10-21
| | | | | | | | - Add an About window to see version details like GTKUI. - The author and license text were left out as unnecessary. - Added a daemon get_version method since daemon version was not available through the json-api. - Fix LookupResource to ensure path exists when rendering.
* [WebUI] Enable debug URL parameter to parse false valuesCalum Lind2018-10-16
| | | | | | | When installed as a development version there was no way to load the normal js scripts so improve the debug arg handling by parsing for false values to force use of normal type scripts. Since debug arg overrides dev, leave dev as is.
* [WebUI] Keep debug js in packaging and fix script lookupCalum Lind2018-10-16
| | | | | | | | | | | | | | | | | | | | | | Packaging: - Decided that the debug files are useful for end-user so keep them in package installation. For debug script_type to be usable all debug file need to be avaialble so extjs debug files also included. Script type selection: - Fixed dev and debug request args to be properly decoded on Python 3, otherwise comparison would fail and allowed any case for values. - Modified the choosing of the script type to pick debug if specified as previously always choosing dev type if dev version was True. A rare scenario but useful but now debug is used if specified otherwise use dev. - Changed the order when looking for alternative script types to start with dev so that if debug is specified but missing it uses a similar script type as previously would fallback to normal which is likely undesired.
* [WebUI|Py3] Fix and refactor torrent uploadCalum Lind2018-10-10
|
* [Lint] Use Black to auto-format codeCalum Lind2018-10-03
| | | | | | | | | | | | | | | | | The move to using auto-formatter makes it easier to read, submit and speeds up development time. https://github.com/ambv/black/ Although I would prefer 79 chars, the default line length of 88 chars used by black suffices. The flake8 line length remains at 120 chars since black does not touch comments or docstrings and this will require another round of fixes. The only black setting that is not standard is the use of double-quotes for strings so disabled any formatting of these. Note however that flake8 will still flag usage of double-quotes. I may change my mind on double vs single quotes but for now leave them. A new pyproject.toml file has been created for black configuration.
* [Py2to3] More fixes for web uiCalum Lind2018-09-14
|
* [Py2to3] Fixes to display Web UICalum Lind2018-09-14
|
* [Py2to3] Fix log.warn deprecation warningCalum Lind2018-09-14
|
* [Py2to3] Fix putChild requires bytesCalum Lind2018-09-14
|
* [WebUI][Daemon] Enhance TLS SecurityDjLegolas2018-09-06
| | | | | | | | | | | | | | | | | This applies the following for both WebUI and Daemon: 1. Raised minimal TLS version to TLSv1.2 2. Added specific cipher suite list 3. Added support for ECDSA auth keys 4. Added support for ECDHE key exchange algorithm We disabled the ability to perform TLS/SSL renegotiation and therefore will prevent the clients from renegotiating, which can be exploit for DoS attacks. New security tests now will be skipped when running `pydef` and `trial` testenvs. To run the test, use the testenv `security` or add the environment variable `SECURITY_TESTS` before running the tests. Also should only run when adding to the commit message the string `SECURITY_TEST`.
* [WebUI] Handle missing gettext.js fileDjLegolas2018-07-16
| | | | | Removed the creation code of `gettext.js` and now it will just mock the `_` function by being the identity function.
* [Py3] A large set of fixes for tests to pass under Python 3Calum Lind2018-06-27
| | | | | | | | | The usual minor fixes for unicode/bytes for library calls. The minimum Twisted version is now 16 for Python 3 support so remove old code and start replacing deprecated methods. Raised the minimum TLS version to 1.2 for the web server.
* Fix files to pass new Flake8 checkersCalum Lind2018-06-01
| | | | | | | | | | | Some new flake8 checkers were added so fix these new warnings and any issues uncovered. Use add-trailing-comma to fix missing trailing commas. It does not format it as well as I would like however it was fast to change and helps with git changes in future. Removed pylint from tox due to large number of warnings.
* [#3064|WebUI] Fix server not sending TLS intermediate certsCalum Lind2017-06-15
| | | | * Sending of cert chain was unintentionallly removed in commit c1902e43 (#2792).
* [WebUI] Fix error displaying tracker iconsCalum Lind2017-03-16
|
* [WebUI] Return 404.html for files not foundCalum Lind2017-03-15
| | | | - This ensures a proper request response is returned.
* [WebUI] Check render template files exist and raise 404 if notKyle Neideck2017-03-15
| | | | | - Check render/* requests match to .html files in the 'render' dir - Protects against directory (path) traversal
* [WebUI] Markup byte strings for twisted requestCalum Lind2017-02-22
|
* [Py2to3] Force unicode_literals and fix related issuesCalum Lind2017-02-22
| | | | | | | | | | | | | | | | | | * Added `from __future__ import unicode_literals` to every file so now all strings in code are forced to be unicode strings unless marked as byte string `b'str'` or encoded to byte string `'str'.encode('utf-8')`. This is a large change but we have been working towards the goal of unicode strings passed in the code so decoding external input and encoding output as byte strings (where applicable). Note that in Python 2 the `str` type still refers to byte strings. * Replaced the use of `str` for `basestring` in isinstance comparison as this was the original intention but breaks code when encoutering unicode strings. * Marked byte strings in gtkui as the conversion to utf8 is not always handled, mostly related to gobject signal names.
* [UI] Move and rename util/lang to translations_utilCalum Lind2016-11-28
| | | | | | | - The name needed to be more descriptive of it's function. - Moved into ui directory because of upcoming changes being made to setup.py meant it would be easier to include all the 'common' ui files if there are no sub-dirs such as 'util'.
* [WebUI] Log correct http address if listening on IPv6bendikro2016-11-22
|
* [Docs] Fix example and param notation in reST docstringsCalum Lind2016-11-17
| | | | * For future parsing into other docstring styles.
* [Lint] Quote cleanupCalum Lind2016-11-17
|
* [Lint] Refactor flake8 noqa's and add msg numbersCalum Lind2016-11-04
| | | | | | From pep8-naming: * N802: function name should be lowercase * N803: argument name should be lowercase
* [Lint] Convert all python double quotes to single quotesCalum Lind2016-11-03
| | | | | | | | | | | | | | | | | | * A rather disruptive change but for a few reasons such as easier to read, easier type, keep consistent and javascript code uses single quotes. * There are a few exceptions for the automated process: * Any double quotes in comments * Triple double quotes for docstrings * Strings containing single quotes are left e.g. "they're" * To deal with merge conflicts from feature branches it is best to follow these steps for each commit: * Create a patch: `git format-patch -1 <sha1>` * Edit the patch and replace double quotes with single except those in comments or strings containing an unescaped apostrophe. * Check the patch `git apply --check <patchfile>` and fix any remaining issues if it outputs an error. * Apply the patch `git am < <patchfile>`
* [#2914] Fix: Specifying file version for default configbendikro2016-10-30
|
* [#2889] Fixes for 'Too many files open' errorCalum Lind2016-10-18
| | | | | | | | * Ensure all file descriptors are closed. Using the with statement ensures closure. * The main problem was with thousands of unclosed file desciptors from tracker_icons mkstemp. * Use a prefix 'deluge_ticon.' to identify created tracker_icon tmp files.
* [WebUI] Handle missing script files and fallback to available filesbendikro2016-05-19
| | | | | | | * To help user's encountering a blank web page, log warnings if script files for a selected mode are missing and attempt to fallback to a working mode. * There is no logging for dev version detection to prevent spamming output. * Add slimit dependency to tox
* [UI] Add tests for ui_entrybendikro2016-05-08
|
* [#1959] [WebUI] Allow user selectable GUI languagebendikro2016-04-25
|
* [#2677] [Web] With --base option set, serve locally on new base pathbendikro2016-04-22
| | | | | | | | | | | When specifying the --base option to work with reverse proxy the WebUI is no longer accessible locally since it listens on the server root, but serves on the path specified to work for the reverse proxy. Change this to also handle local requests to the base path such that the WebUI will be available both for the reverse proxy as well as locally on the interface/port which the twisted sever listens on.
* [WebUi] [Core] Fixes to plugin handling and WebUi plugin + testsbendikro2016-04-18
| | | | | | | | | | | | | | | This should fix problems with errors occuring when failing to enable plugins. Errors in plugin handling are handled better and properly logged. WebUI plugin in particular had issues when being enabled and disabled multiple times because it was trying to create DelugeWeb component each time it was enabled. If deluge-web is already listening on the same port, enabling the WebUI plugin will fail, and the checkbox will not be checked. There are still some issues when enabling/disabling plugins by clicking fast multiple times on the checkbox.
* [WebUI] Fix #2798: WebUI plugin fails to startbendikro2016-04-18
|
* [Tests] [Web] Make JSON independent of Web componentbendikro2016-04-10
| | | | | * Implement JSONTestCase in test_json_api.py * Implement WebAPITestCase test case in test_web_api.py
* [#2782] [WebUI] Fix HTTPS negotiating incorrect cipherCalum Lind2015-12-11
|
* [WebUI] Remove old codeCalum Lind2015-12-11
|
* [Lint] Autopep8 aggressive runCalum Lind2015-11-04
| | | | | * Uses isinstance() instead of type() * Uses sorted() where possible