Commit Graph

142 Commits

Author SHA1 Message Date
Charles Kerr 3f44076e23
build: update dependency versions (#3853)
* build: rename GTK_MINIMUM, etc as GTKMM_MINIMUM in CMakeLists

* build: bump glibmm depdency min version to 2.60.0

https://github.com/transmission/transmission/issues/3846\#issuecomment-1263782526

for extraclassinit.h

* build: fix duplicated version number for deflate dependency

* build: sort dependency list in CMakeLists.txt

no functional changes, just housekeeping

* refactor: remove gtr_get_ptr()
2022-09-30 17:15:21 -05:00
Dmitry Antipov 050ee1cbbd
daemon: use signalfd-based signal handling if available (#3778)
If signalfd(2) interface is available, prefer it over traditional signal
handlers. This is mostly intended to drop dedicated signal handling thread
and hook signal processing into libevent event loop in the most natural way.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
2022-09-07 15:12:35 -05:00
Charles Kerr e8686095ed
refactor: local peer discovery (#3696) 2022-08-24 16:03:30 -05:00
Charles Kerr 5bcbb7e34b
refactor: aggregate arc4 into libtransmission (#3684) 2022-08-20 13:41:40 -05:00
Charles Kerr 8b983b3d1c
refactor: tr_sys_path_resolve() returns a std::string (#3587)
* refactor: tr_sys_path_resolve returns std::string
2022-08-05 11:36:01 -05:00
Charles Kerr 18e2a04f88
refactor: make sha1, sha256 RAII safe (#3556) 2022-07-31 15:58:14 -05:00
Charles Kerr 2bcab6be7e
refactor: remove tr_dh code (#3443)
Refactor the MSE handshake Diffie-Hellman key code.
2022-07-14 19:54:10 -05:00
Charles Kerr 745adf8332
Update libutp to 3.4+ (TRAC-5888) (#3416)
Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-07-08 10:13:22 -05:00
Charles Kerr e9d34519ff
docs: fix installation of release notes (#3390) 2022-07-02 11:25:15 -05:00
Colin B 3237323b8e
Add basic support for v2 hashes in transmission-show (#3380)
* Add basic support for v2 hashes in transmission-show

* Add sha256 for more libraries

* Fix issue with sha256 digest length
* Add sha256 for polarssl
    Note: Bumping miniumum PolarSSL version to 1.3 because of
    sha2->sha256 name change.
* Add sha256 for CommonCrypto/ccrypto
* Add sha256 for cyassl
2022-07-01 09:49:33 -05:00
FX Coudert e0c593741c
Raise minimum supported target to macOS 10.13 (High Sierra) (#3310) 2022-06-18 09:26:45 -05:00
Charles Kerr 12592e20d6
build: remove unused function checks (#3233)
* build: remove unused -DHAVE_ASPRINTF from xcode build

* build: remove unused -DHAVE_ZLIB from cmake and xcode

we use libdeflate instead

* build: remove unused -DHAVE_LIBGEN from xcode
2022-06-08 13:35:07 -05:00
Charles Kerr 2293f4336a
perf: use fast_float to parse floating-point numbers (#3092) 2022-05-16 00:06:17 -05:00
Charles Kerr 2f16e4a143
deps: update libdeflate to v1.10 (#3014) 2022-04-28 12:51:18 -05:00
Charles Kerr 1ebac744a5
build: re-enable cert-err33-c clang-tidy warning (#2968)
* refactor: re-enable cert-err33-c clang-tidy warning

* refactor: use fmt::chrono in transmission-remote

* refactor: use fmt::chrono in transmission-show

* refactor: use fmt::chrono in GTK details dialog

* refactor: use fmt::chrono in tr_session

* refactor: remove tr_localtime_r

* refactor: remove tr_gmtime_r
2022-04-22 14:56:54 -05:00
Charles Kerr 8c51c48472
fix: recent FTBFS in msvc (#2907)
* fix: recent FTBFS in msvc

It's happening a line in qt/WatchDir.cc where an enum named `ERROR` is
declared, so it's probably conflicting with a new `ERROR` name in some
header file. Rename ours and make at an `enum class` for good measure.

* build: fix cmake msvc warning

D9025 : overriding /W3 with /W4
2022-04-12 01:56:09 -05:00
Charles Kerr 4177e286a1
fix: sonarcloud (#2837)
* fix: rename variable to avoid shadow warning w/UTP

* fix: add default dtor for tr_strbuf

* fix: implicit conversion may lose precision

* fix: use init-statement to reduce variable scope

* fix: implicit conversion may lose precision

* fix: extract the assignment from this expression

* fix: use init-statement to reduce variable scope

* fix: use init-statement to reduce variable scope

* fix: do not mix public and private data members

* fix: add a condition to cv.wait call

* fix: do not throw uncaught exceptions in destructor
2022-03-29 05:57:04 -05:00
Mike Gelfand 3cd11ee1fb
Fix USE_QT_VERSION CMake option 2022-03-27 03:45:10 +01:00
Mike Gelfand c2549c3c77
Remove CPack symlinks workaround
Looks like it was a CMake defect.
2022-03-27 00:05:55 +00:00
Charles Kerr 6e8f9f3ff0
feat: add tr_strbuf (#2810)
* feat: add tr_strbuf class for building tmp strings

Based on fmt::basic_memory_buf, this is a growable string buffer that
has an initial size that's large enough to build most filenames or URLs
without needing heap allocations.

Adds a couple of extra helpers such as a `c_str()` method to make dealing
with old zero-terminated string APIs easier.
2022-03-24 16:41:29 -05:00
Charles Kerr 72a67054ea
refactor: fmt part 2 (#2771) 2022-03-15 09:52:16 -05:00
Charles Kerr a942c67199
refactor: use fmt (#2758)
* deps: use fmt (8.1.1 tag) to build log strings

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-03-13 23:43:35 -05:00
Charles Kerr e7d3e205d2 chore: update links to rpc-spec.md 2022-02-21 10:39:58 -06:00
Charles Kerr e14c7f38e5
feat: use libpsl (#2575)
Use libpsl to calculate public and private parts of URL hosts.
2022-02-12 11:30:27 -06:00
Charles Kerr eeccc3788f
docs: move rpc-spec document from txt to markdown (#2606) 2022-02-11 10:48:21 -06:00
Charles Kerr 7bc668680e
chore: remove unused function tr_strcasestr() (#2552) 2022-01-31 15:59:14 -06:00
Charles Kerr 253f4fe009
chore: remove /upload endpoint from rpc-server (#2550)
It's never been documented or supported and is unused by the web client.

In the unlikely case that a 3rd party app is using it, use 'torrent-add'
instead; it's documented + supported.
2022-01-31 14:54:21 -06:00
Charles Kerr 374c24dde1
refactor: trevent use std:: tools intead of pipes (#2520) 2022-01-28 17:56:46 -06:00
Charles Kerr d8d765c595
refactor: use libdeflate instead of zlib's deflate() (#2405)
Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-01-17 10:20:12 -06:00
Charles Kerr bbe49639d6
refactor: use cpputf for utf8 validation and conversion (#2251)
* refactor: use cpputf for utf8 validation and conversion
2021-11-30 15:13:56 -06:00
Mike Gelfand c95616eb26
Bump minimum GTK version to 3.24 (#2112) 2021-11-07 13:08:17 +03:00
Mike Gelfand be74cb6356
Qt 6 support (#2069)
* Bump minimum Qt version to 5.6

* Switch from QRegExp to QRegularExpression

While still available, QRegExp has been moved to Qt6::Core5Compat module
and is not part of Qt6::Core.

* Use qIsEffectiveTLD instead of QUrl::topLevelDomain

The latter is not part of Qt6::Core. The former is a private utility in
Qt6::Network; using it for now, until (and if) we switch to something
non-Qt-specific.

* Use QStyle::State_Horizontal state when drawing progress bars

Although available for a long time, this state either didn't apply to
progress bars before Qt 6, or was deduced based on bar size. With Qt 6,
failing to specify it results in bad rendering.

* Don't use QStringRef (and associated methods)

While still available, QStringRef has been moved to Qt6::Core5Compat
module and is not part of Qt6::Core. Related method (e.g.
QString::midRef) have been removed in Qt 6.

* Use Qt::ItemIsAutoTristate instead of Qt::ItemIsTristate

The latter was deprecated and replaced with the former in Qt 5.6.

* Don't use QApplication::globalStrut

This property has been deprecated in Qt 5.15 and removed in Qt 6.

* Use QImage::fromHICON instead of QtWin::fromHICON

WinExtras module (providind the latter helper) has been removed in Qt 6.

* Use QStringDecoder instead of QTextCodec

While still available, QTextCodec has been moved to Qt6::Core5Compat
module and is not part of Qt6::Core.

* Don't forward-declare QStringList

Instead of being a standalone class, its definition has changed to
QList<QString> template specialization in Qt 6.

* Use explicit (since Qt 6) QFileInfo constructor

* Use QDateTime's {to,from}SecsSinceEpoch instead of {to,from}Time_t

The latter was deprecated in Qt 5.8 and removed in Qt 6.

* Don't use QFuture<>'s operator==

It has been removed in Qt 6. Since the original issue this code was
solving was caused by future reuse, just don't reuse futures and create
new finished ones when necessary.

* Use std::vector<> instead of QVector<>

The latter has been changed to a typedef for QList<>, which might not be
what one wants, and which also changed behavior a bit leading to
compilation errors.

* Don't use + for flags, cast to int explicitly

Operator+ for enum values has been deleted in Qt 6, so using operator|
instead. Then, there's no conversion from QFlags<> to QVariant, so need
to cast to int.

* Support Qt 6 in CMake and for MSI packaging

* Remove extra (empty) CMake variable use when constructing Qt target names

* Simplify logic in tr_qt_add_translation CMake helper

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-11-04 00:20:11 +03:00
Dzmitry Neviadomski 25f68ec815
Bump minimum required CMake version to 3.9. (#2063)
Remove old CMake version checks.
2021-11-03 00:13:44 -05:00
Mike Gelfand 81147a8fbb
CMake fixes for universal builds on Mac (#2044)
* Use CMake to build libevent on all platforms

* Pass Mac-specific flags down to 3rd-party projects
2021-10-25 11:14:04 +03:00
Mike Gelfand 5edbcb3740
Add CommonCrypto-based crypto utils implementation (#2032)
* Add CommonCrypto-based crypto utils implementation

Ported and adapted from an old (circa 2014-2015) branch of mine.

DH helpers are based on CCBigNum since CCDH doesn't provide acceptable error
reporting, and SecDH interface is a bit weird and limiting. Given that all
mentioned APIs are private, it doesn't seem to matter which one we're using as
any of them could be changed/removed by Apple at any point.

* Switch Xcode project to CommonCrypto backend
2021-10-24 21:19:57 +03:00
Mike Gelfand bf41e1487a
Switch from gtk to gtkmm (#1969)
* Gtk to gtkmm: main.cc

* Gtk to gtkmm: details.cc

* Gtk to gtkmm: tr-window.cc

* Gtk to gtkmm: tr-prefs.cc

* Gtk to gtkmm: open-dialog.cc

* Gtk to gtkmm: file-list.cc

* Gtk to gtkmm: filter.cc

* Gtk to gtkmm: torrent-cell-renderer.cc

* Gtk to gtkmm: msgwin.cc

* Gtk to gtkmm: makemeta-ui.cc

* Gtk to gtkmm: relocate.cc

* Gtk to gtkmm: stats.cc

* Gtk to gtkmm: dialogs.cc

* Gtk to gtkmm: hig.cc

* Gtk to gtkmm: favicon.cc

* Gtk to gtkmm: icons.cc

* Gtk to gtkmm: tr-icon.cc

* Gtk to gtkmm: actions.cc

* Gtk to gtkmm: notify.cc

* Gtk to gtkmm: util.cc

* Gtk to gtkmm: tr-core.cc

* Gtk to gtkmm: conf.cc

* Glibmm <2.62 compatibility (missing Glib::ustring::sprintf)

* Glibmm <2.56 compatibility (missing Glib::RefPtr<>::get)

* Bump glibmm to 2.50.1+ (C++17 fix in Glib::Variant)

* Fix empty timestamps on message log export (broken by #1444)

* Fix LGTM build issues

* Review fixes
2021-10-18 23:22:31 +03:00
Charles Kerr 90605d4bd3
build: skip clang-tidy on lgtm (#1792)
* build: skip clang-tidy on lgtm

* build: skip clang-tidy on appveyor

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-09-12 14:36:51 -05:00
Charles Kerr 4c1b627647
refactor: port libtransmission to C++ (#1787)
Port libtransmission to C++. This PR doesn't refactor everything to c++.
Its code changes are only what was necessary to compile and link as c++.
See libtransmission/README.md for details on how to submit modernization 
patches!

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2021-09-12 12:41:49 -05:00
Mike Gelfand a459e5e11b
Switch to a standalone ARC4 implementation (#1788)
* Switch to a standalone ARC4 implementation

This frees us from expecting it being provided by one of the crypto
libraries we support, all of which deprecated and/or removed it at this
point.

Fixes: #1103
Fixes: #1777

* Suppress lgtm warnings about RC4 being weak (we don't care)
2021-09-12 06:47:29 +03:00
Mike Gelfand 8c9faf1f71 Set default Mac target version in CMake to avoid extra warnings 2021-08-17 00:32:32 +03:00
Mike Gelfand 647c171636 Clean-up leftover mentions of uncrustify, fix custom format targets 2021-08-16 01:08:56 +03:00
RobCrowston 0155252823
Add in-kernel file copying for several platforms. (#1092)
* Add in-kernel copying support for Linux (sendfile64(2), copy_file_range(2)), FreeBSD 13 (copy_file_range(2)), MacOS (copyfile(2)), and Windows (CopyFileExA).

* Fix macro name USE_COPY_FILE_RANGE.

* Minor bugfixes for userspace fallback.

* Fix linux sendfile64 bugs.

* Remove some overzealous asserts.

* Allow transmission-test-copy to take an optional argument for an external reference file.

* Fix return value error of tr_sys_path_copy.

* Use COPYFILE_ALL for Macs without COPYFILE_CLONE.

* Add in-kernel file copying for several platforms.

Numerous operating systems now have support for copying files directly in the
kernel, which is generally more efficient than copying in a userspace read(2)/
write(2) loop. (This becomes particularly relevant for 4th gen PCI-E storage,
which approaches the latency of DRAM.) For Linux I use sendfile64(2), and, for
later kernels, copy_file_range(2). FreeBSD 13 will also support
copy_file_range(2). MacOS has copyfile(2), and Windows has CopyFileExA.
Operating systems lacking such a syscall continue to use the existing
read(2)/write(2) loop.

* Appease uncrustify.

* Appease uncrustify.

* copy-test: generate random content at run time.

* copy-test: Stylistic changes and more check()s.

* copy-test: files_are_identical should follow test idioms

* tr_sys_path_copy: numerous tweaks as requested by review.

* s/old file/source file; s/new file/destination file.

* tr_sys_path_copy: handle win32 wide characters in paths.

* Uncrustify.

* test-copy: Use non-string create_file_with_contents.

* tr_sys_path_copy: numerous fixes.

Per review: generate test file content at runtime; tidy use of check();
fix style; re-measure file sizes in the copy; define a macro when the
system does not provide it; use Unicode APIs on Windows; and fix
documentation.

* Updated as per comments.

* Rebase kernel-copy changes onto 3.0 with gtest.

* Undo irrelevant comment change.

* Fix syntax error.

* Use tr_malloc() instead of tr_valloc().

* Use EXPECT instead of TR_ASSERT in gtest.

* Add error handling.

* Acceptable coding style has changed again.

Now it's camelCase. Also use nullptr instead of NULL, etc.

* Fix east/west const.

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-08-07 12:04:03 +03:00
Dzmitry Neviadomski 59cf023e57
Update libevent to 2.1.12-stable. (#1588)
* Update libevent to 2.1.12-stable.

Fixes `kq_init: detected broken kqueue; not using.: Undefined error: 0`
message on start on macOS.

* Do not build libevent samples.

* Explicitly set library type to static on MSVC for libevent.

Co-authored-by: Mitch Livingston <livings124@mac.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-05-20 11:36:12 -05:00
Charles Kerr 41f225df7b
Remove posix memalign (#1520)
* refactor: remove unnecessary func tr_valloc()

We're only using it in a handful of places, and none of them need the
kind of alignment that posix_memalign() provide. So we can drop a few
dozen lines by removing the portability wrapper.
2020-11-15 15:53:42 -06:00
Charles Kerr cd453764b1
feat: web client refresh (#1476)
Give the web client a major overhaul.

User-visible highlights include:

* Mobile is now fully supported.
* Added fullscreen support on mobile.
* Better support for dark mode.
* Added mime icons to the torrent list.
* Improved theme consistency across the app.

Maintainer highlights include:

* Updated code to use ES6 APIs.
* No longer uses jQuery UI.
* No longer uses jQuery.
* Use Webpack to bundle the Javascript, CSS, and assets together -- the entire bundle size is now 68K gzipped.
* Added eslint / prettier / stylelint tooling.
* Uses torrent-get's 'table' mode for more efficient RPC calls.
2020-10-23 20:04:25 -05:00
Mike Gelfand 4c7153fa48
Remove autotools-based build system (#1465)
* Support .git files (e.g. for worktrees, submodules)
* Fix symlinks in source tarball, switch to TXZ, adjust non-release name
* Remove autotools stuff
2020-10-13 03:15:19 +03:00
Charles Kerr 54a7cac25a
chore: run uncrustify in parallel; add package.json to web directory (#1454)
* refactor: add package.json for web client

* refactor: call uncrustify in parallel
2020-09-20 15:41:45 -05:00
Charles Kerr be219ddee0
chore: add precommit hook for testing code style (#1448)
* chore: add precommit hook for testing code style

* chore: use prettier + eslint for js code
2020-09-13 21:41:32 -05:00
Charles Kerr efaa66a920
fix: resolve some lgtm warnings (#1444)
* fix: warnings found by LGTM static analyzer
2020-09-11 16:07:45 -05:00
Mike Gelfand e61b49c2fe Disable openssl support when building bundled libevent 2020-08-26 04:09:15 +03:00