Skip to content

Commit

Permalink
Merge branch 'main' into BEP-7
Browse files Browse the repository at this point in the history
  • Loading branch information
lvella committed Jun 16, 2022
2 parents 7334cf3 + 869741d commit e0c12ad
Show file tree
Hide file tree
Showing 146 changed files with 3,713 additions and 3,352 deletions.
1 change: 1 addition & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# untracked files
.*/*
build/*
cmake-build-*/*
libtransmission/version.h
web/node_modules/*

Expand Down
464 changes: 464 additions & 0 deletions .github/workflows/actions.yml

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions .github/workflows/code-style.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ po/*.mo
third-party/miniupnp/miniupnpcstrings.h
web/public_html/transmission-app.js.map
.DS_Store

# CLion IDE build directory
/cmake-build-*/
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ Project Contributors
Malcolm Jarvis <mjarvis@transmissionbt.com> (Web client)
Kevin Glowacz <kjg@transmissionbt.com> (Web client)
Rashid Eissing (Mac OS X Transfers preferences icon)
Dean Ostetto
Rick Patrick (Mac OS X images)
Jonas Rask (Mac OS X Globe icon)
Erick Turnquist (IPv6 code, support)
Maarten Van Coile (Wiki Wrangler, troubleshooting, support)
James "Kibo" Parry (Updated Mac Retina images)
Max Zettlmeißl <max@zettlmeissl.de>

Previous Developers
Eric Petit <eric@lapsus.org> (Project originator)
Expand Down
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ set(LIBAPPINDICATOR_MINIMUM 0.4.90)
set(OPENSSL_MINIMUM 0.9.7)
set(POLARSSL_MINIMUM 1.2)
set(QT_MINIMUM 5.6)
set(ZLIB_MINIMUM 1.2.3)

if(WIN32)
foreach(L C CXX)
Expand Down Expand Up @@ -325,11 +324,6 @@ if(ENABLE_MAC)
tr_fixup_auto_option(ENABLE_MAC MAC_FOUND MAC_IS_REQUIRED)
endif()

find_package(ZLIB ${ZLIB_MINIMUM})
if(ZLIB_FOUND)
add_definitions(-DHAVE_ZLIB)
endif()

set(THIRD_PARTY_DIR ${CMAKE_SOURCE_DIR}/third-party)

tr_add_external_auto_library(DEFLATE libdeflate deflate)
Expand Down
110 changes: 57 additions & 53 deletions Transmission.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion daemon/transmission-daemon.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ After=network-online.target
[Service]
User=transmission
Type=notify
ExecStart=/usr/bin/transmission-daemon -f --log-error
ExecStart=/usr/bin/transmission-daemon -f --log-level=error
ExecReload=/bin/kill -s HUP $MAINPID
NoNewPrivileges=true
MemoryDenyWriteExecute=true
Expand Down
29 changes: 18 additions & 11 deletions docs/rpc-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ Request arguments:
| `seedIdleMode` | number | which seeding inactivity to use. See tr_idlelimit
| `seedRatioLimit` | double | torrent-level seeding ratio
| `seedRatioMode` | number | which ratio to use. See tr_ratiolimit
| `trackerAdd` | array | **DEPRECATED** use trackerList instead
| `trackerList` | string | string of announce URLs, one per line, with a blank line between tiers
| `trackerRemove` | array | **DEPRECATED** use trackerList instead
| `trackerReplace` | array | **DEPRECATED** use trackerList instead
| `trackerAdd` | array | add a new tracker URL in its own new tier
| `trackerList` | string | rebuild the torrent's tracker list with a string of announce URLs, one per line, with a blank line between tiers
| `trackerRemove` | array | remove a tracker URL
| `trackerReplace` | array | modify a tracker URL
| `uploadLimit` | number | maximum upload speed (KBps)
| `uploadLimited` | boolean | true if `uploadLimit` is honored

Expand Down Expand Up @@ -196,6 +196,7 @@ The 'source' column here corresponds to the data structure there.
|:--|:--|:--
| `activityDate` | number | tr_stat
| `addedDate` | number | tr_stat
| `availability` | array (see below)| tr_torrentAvailability()
| `bandwidthPriority` | number | tr_priority_t
| `comment` | string | tr_torrent_view
| `corruptEver`| number | tr_stat
Expand Down Expand Up @@ -270,6 +271,7 @@ The 'source' column here corresponds to the data structure there.
| `webseeds`| array of strings | tr_tracker_view
| `webseedsSendingToUs`| number| tr_stat

`availability`: An array of `pieceCount` numbers representing the number of connected peers that have each piece, or -1 if we already have the piece ourselves.

`files`: array of objects, each containing:

Expand Down Expand Up @@ -535,7 +537,7 @@ Response arguments: `path`, `name`, and `id`, holding the torrent ID integer
| `queue-stalled-minutes` | number | torrents that are idle for N minuets aren't counted toward seed-queue-size or download-queue-size
| `rename-partial-files` | boolean | true means append `.part` to incomplete files
| `rpc-version-minimum` | number | the minimum RPC API version supported
| `rpc-version-semver` | number | the current RPC API version in a semver-compatible string
| `rpc-version-semver` | string | the current RPC API version in a semver-compatible string
| `rpc-version` | number | the current RPC API version
| `script-torrent-added-enabled` | boolean | whether or not to call the `added` script
| `script-torrent-added-filename` | string | filename of the script to run
Expand Down Expand Up @@ -580,9 +582,16 @@ to be common behavior.
#### 4.1.1 Mutators
Method name: `session-set`

Request arguments: one or more of 4.1's arguments, except: `blocklist-size`,
`config-dir`, `rpc-version`, `rpc-version-minimum`,
`version`, and `session-id`
Request arguments: the mutable properties from 4.1's arguments, i.e. all of them
except:

* `blocklist-size`
* `config-dir`
* `rpc-version-minimum`,
* `rpc-version-semver`
* `rpc-version`
* `session-id`
* `version`

Response arguments: none

Expand Down Expand Up @@ -962,6 +971,7 @@ Transmission 4.0.0 (`rpc-version-semver` 5.3.0, `rpc-version`: 17)
| `session-get` | new arg `script-torrent-done-seeding-enabled`
| `session-get` | new arg `script-torrent-done-seeding-filename`
| `torrent-add` | new arg `labels`
| `torrent-get` | new arg `availability`
| `torrent-get` | new arg `file-count`
| `torrent-get` | new arg `group`
| `torrent-get` | new arg `percentComplete`
Expand All @@ -971,9 +981,6 @@ Transmission 4.0.0 (`rpc-version-semver` 5.3.0, `rpc-version`: 17)
| `torrent-get` | new arg `trackerList`
| `torrent-set` | new arg `group`
| `torrent-set` | new arg `trackerList`
| `torrent-set` | **DEPRECATED** `trackerAdd`. Use `trackerList` instead.
| `torrent-set` | **DEPRECATED** `trackerRemove`. Use `trackerList` instead.
| `torrent-set` | **DEPRECATED** `trackerReplace`. Use `trackerList` instead.
| `group-set` | new method
| `group-get` | new method

78 changes: 32 additions & 46 deletions gtk/DetailsDialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ void gtr_text_buffer_set_text(Glib::RefPtr<Gtk::TextBuffer> const& b, Glib::ustr

void DetailsDialog::Impl::refreshInfo(std::vector<tr_torrent*> const& torrents)
{
auto const now = time(nullptr);
Glib::ustring str;
Glib::ustring const mixed = _("Mixed");
Glib::ustring const no_torrent = _("No Torrents Selected");
Expand Down Expand Up @@ -805,7 +806,7 @@ void DetailsDialog::Impl::refreshInfo(std::vector<tr_torrent*> const& torrents)
}
else
{
str = tr_strltime(time(nullptr) - baseline);
str = tr_format_time_relative(now, baseline);
}
}

Expand Down Expand Up @@ -834,7 +835,7 @@ void DetailsDialog::Impl::refreshInfo(std::vector<tr_torrent*> const& torrents)
}
else
{
str = tr_strltime(baseline);
str = tr_format_time_relative(now, baseline);
}
}

Expand Down Expand Up @@ -933,6 +934,7 @@ void DetailsDialog::Impl::refreshInfo(std::vector<tr_torrent*> const& torrents)
else if (haveUnchecked == 0)
{
str = fmt::format(
// xgettext:no-c-format
_("{current_size} ({percent_done}% of {percent_available}% available)"),
fmt::arg("current_size", total),
fmt::arg("percent_done", buf2),
Expand All @@ -941,6 +943,7 @@ void DetailsDialog::Impl::refreshInfo(std::vector<tr_torrent*> const& torrents)
else
{
str = fmt::format(
// xgettext:no-c-format
_("{current_size} ({percent_done}% of {percent_available}% available; {unverified_size} unverified)"),
fmt::arg("current_size", total),
fmt::arg("percent_done", buf2),
Expand Down Expand Up @@ -1067,19 +1070,13 @@ void DetailsDialog::Impl::refreshInfo(std::vector<tr_torrent*> const& torrents)
{
str = _("Never");
}
else if ((now - latest) < 5)
{
str = _("Active now");
}
else
{
time_t const period = time(nullptr) - latest;

if (period < 5)
{
str = _("Active now");
}
else
{
// e.g. 5 minutes ago
str = fmt::format(_("{time_span} ago"), fmt::arg("time_span", tr_strltime(period)));
}
str = tr_format_time_relative(now, latest);
}
}

Expand Down Expand Up @@ -1909,56 +1906,45 @@ auto constexpr SuccessMarkupEnd = "</span>"sv;

std::array<std::string_view, 3> const text_dir_mark = { ""sv, "\u200E"sv, "\u200F"sv };

// if it's been longer than a minute, don't bother showing the seconds
Glib::ustring tr_strltime_rounded(time_t t)
{
if (t > 60)
{
t -= (t % 60);
}

return tr_strltime(t);
}

void appendAnnounceInfo(tr_tracker_view const& tracker, time_t const now, Gtk::TextDirection direction, std::ostream& gstr)
{
if (tracker.hasAnnounced && tracker.announceState != TR_TRACKER_INACTIVE)
{
gstr << '\n';
gstr << text_dir_mark[direction];
auto const timebuf = tr_strltime_rounded(now - tracker.lastAnnounceTime);
auto const time_span_ago = tr_format_time_relative(now, tracker.lastAnnounceTime);

if (tracker.lastAnnounceSucceeded)
{
gstr << fmt::format(
// {markup_begin} and {markup_end} should surround the peer text
ngettext(
"Got a list of {markup_begin}{peer_count} peer{markup_end} {time_span} ago",
"Got a list of {markup_begin}{peer_count} peers{markup_end} {time_span} ago",
"Got a list of {markup_begin}{peer_count} peer{markup_end} {time_span_ago}",
"Got a list of {markup_begin}{peer_count} peers{markup_end} {time_span_ago}",
tracker.lastAnnouncePeerCount),
fmt::arg("markup_begin", SuccessMarkupBegin),
fmt::arg("peer_count", tracker.lastAnnouncePeerCount),
fmt::arg("markup_end", SuccessMarkupEnd),
fmt::arg("time_span", timebuf));
fmt::arg("time_span_ago", time_span_ago));
}
else if (tracker.lastAnnounceTimedOut)
{
gstr << fmt::format(
// {markup_begin} and {markup_end} should surround the time_span
_("Peer list request {markup_begin}timed out {time_span} ago{markup_end}; will retry"),
_("Peer list request {markup_begin}timed out {time_span_ago}{markup_end}; will retry"),
fmt::arg("markup_begin", TimeoutMarkupBegin),
fmt::arg("time_span", timebuf),
fmt::arg("time_span_ago", time_span_ago),
fmt::arg("markup_end", TimeoutMarkupEnd));
}
else
{
gstr << fmt::format(
// {markup_begin} and {markup_end} should surround the error
_("Got an error '{markup_begin}{error}{markup_end}' {time_span} ago"),
_("Got an error '{markup_begin}{error}{markup_end}' {time_span_ago}"),
fmt::arg("markup_begin", ErrMarkupBegin),
fmt::arg("error", Glib::Markup::escape_text(tracker.lastAnnounceResult)),
fmt::arg("markup_end", ErrMarkupEnd),
fmt::arg("time_span", timebuf));
fmt::arg("time_span_ago", time_span_ago));
}
}

Expand All @@ -1974,8 +1960,8 @@ void appendAnnounceInfo(tr_tracker_view const& tracker, time_t const now, Gtk::T
gstr << '\n';
gstr << text_dir_mark[direction];
gstr << fmt::format(
_("Asking for more peers in {time_span}"),
fmt::arg("time_span", tr_strltime_rounded(tracker.nextAnnounceTime - now)));
_("Asking for more peers {time_span_from_now}"),
fmt::arg("time_span_from_now", tr_format_time_relative(now, tracker.nextAnnounceTime)));
break;

case TR_TRACKER_QUEUED:
Expand All @@ -1988,10 +1974,10 @@ void appendAnnounceInfo(tr_tracker_view const& tracker, time_t const now, Gtk::T
gstr << '\n';
gstr << text_dir_mark[direction];
gstr << fmt::format(
// {markup_begin} and {markup_end} should surround the time_span
_("Asking for more peers now… {markup_begin}{time_span}{markup_end}"),
// {markup_begin} and {markup_end} should surround time_span_ago
_("Asked for more peers {markup_begin}{time_span_ago}{markup_end}"),
fmt::arg("markup_begin", "<small>"),
fmt::arg("time_span", tr_strltime_rounded(now - tracker.lastAnnounceStartTime)),
fmt::arg("time_span_ago", tr_format_time_relative(now, tracker.lastAnnounceStartTime)),
fmt::arg("markup_end", "</small>"));
break;

Expand All @@ -2006,28 +1992,28 @@ void appendScrapeInfo(tr_tracker_view const& tracker, time_t const now, Gtk::Tex
{
gstr << '\n';
gstr << text_dir_mark[direction];
auto const timebuf = tr_strltime_rounded(now - tracker.lastScrapeTime);
auto const time_span_ago = tr_format_time_relative(now, tracker.lastScrapeTime);

if (tracker.lastScrapeSucceeded)
{
gstr << fmt::format(
// {markup_begin} and {markup_end} should surround the seeder/leecher text
_("Tracker had {markup_begin}{seeder_count} {seeder_or_seeders} and {leecher_count} {leecher_or_leechers}{markup_end} {time_span} ago"),
_("Tracker had {markup_begin}{seeder_count} {seeder_or_seeders} and {leecher_count} {leecher_or_leechers}{markup_end} {time_span_ago}"),
fmt::arg("seeder_count", tracker.seederCount),
fmt::arg("seeder_or_seeders", ngettext("seeder", "seeders", tracker.seederCount)),
fmt::arg("leecher_count", tracker.leecherCount),
fmt::arg("leecher_or_leechers", ngettext("leecher", "leechers", tracker.leecherCount)),
fmt::arg("time_span", timebuf),
fmt::arg("time_span_ago", time_span_ago),
fmt::arg("markup_begin", SuccessMarkupBegin),
fmt::arg("markup_end", SuccessMarkupEnd));
}
else
{
gstr << fmt::format(
// {markup_begin} and {markup_end} should surround the error text
_("Got a scrape error '{markup_begin}{error}{markup_end}' {time_span} ago"),
_("Got a scrape error '{markup_begin}{error}{markup_end}' {time_span_ago}"),
fmt::arg("error", Glib::Markup::escape_text(tracker.lastScrapeResult)),
fmt::arg("time_span", timebuf),
fmt::arg("time_span_ago", time_span_ago),
fmt::arg("markup_begin", ErrMarkupBegin),
fmt::arg("markup_end", ErrMarkupEnd));
}
Expand All @@ -2042,8 +2028,8 @@ void appendScrapeInfo(tr_tracker_view const& tracker, time_t const now, Gtk::Tex
gstr << '\n';
gstr << text_dir_mark[direction];
gstr << fmt::format(
_("Asking for peer counts in {time_span}"),
fmt::arg("time_span", tr_strltime_rounded(tracker.nextScrapeTime - now)));
_("Asking for peer counts in {time_span_from_now}"),
fmt::arg("time_span_from_now", tr_format_time_relative(now, tracker.nextScrapeTime)));
break;

case TR_TRACKER_QUEUED:
Expand All @@ -2056,9 +2042,9 @@ void appendScrapeInfo(tr_tracker_view const& tracker, time_t const now, Gtk::Tex
gstr << '\n';
gstr << text_dir_mark[direction];
gstr << fmt::format(
_("Asking for peer counts now… {markup_begin}{time_span}{markup_end}"),
_("Asked for peer counts {markup_begin}{time_span_ago}{markup_end}"),
fmt::arg("markup_begin", "<small>"),
fmt::arg("time_span", tr_strltime_rounded(now - tracker.lastScrapeStartTime)),
fmt::arg("time_span_ago", tr_format_time_relative(now, tracker.lastScrapeStartTime)),
fmt::arg("markup_end", "</small>"));
break;

Expand Down
4 changes: 2 additions & 2 deletions gtk/StatsDialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ bool StatsDialog::Impl::updateStats()

setLabel(one_up_lb_, tr_strlsize(one.uploadedBytes));
setLabel(one_down_lb_, tr_strlsize(one.downloadedBytes));
setLabel(one_time_lb_, tr_strltime(one.secondsActive));
setLabel(one_time_lb_, tr_format_time(one.secondsActive));
setLabelFromRatio(one_ratio_lb_, one.ratio);

setLabel(all_sessions_lb_, startedTimesText(all.sessionCount));
setLabel(all_up_lb_, tr_strlsize(all.uploadedBytes));
setLabel(all_down_lb_, tr_strlsize(all.downloadedBytes));
setLabel(all_time_lb_, tr_strltime(all.secondsActive));
setLabel(all_time_lb_, tr_format_time(all.secondsActive));
setLabelFromRatio(all_ratio_lb_, all.ratio);

return true;
Expand Down

0 comments on commit e0c12ad

Please sign in to comment.