mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
parent
c962a6b1d7
commit
8f709b5fbc
8 changed files with 41 additions and 8 deletions
|
@ -1,5 +1,12 @@
|
|||
# WebAPI Changelog
|
||||
|
||||
## 2.12.0
|
||||
|
||||
* [#22989](https://github.com/qbittorrent/qBittorrent/pull/22989)
|
||||
* `sync/maindata` returns one new field: `share_limit_action`
|
||||
* `torrents/setShareLimits` now requires a new `shareLimitAction` param that sets a torrent's shareLimitAction property
|
||||
* possible values `Default`, `Stop`, `Remove`, `RemoveWithContent` and `EnableSuperSeeding`
|
||||
|
||||
## 2.11.10
|
||||
|
||||
* [#22932](https://github.com/qbittorrent/qBittorrent/pull/22932)
|
||||
|
|
|
@ -171,6 +171,7 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent)
|
|||
{KEY_TORRENT_POPULARITY, torrent.popularity()},
|
||||
{KEY_TORRENT_SEEDING_TIME_LIMIT, torrent.seedingTimeLimit()},
|
||||
{KEY_TORRENT_INACTIVE_SEEDING_TIME_LIMIT, torrent.inactiveSeedingTimeLimit()},
|
||||
{KEY_TORRENT_SHARE_LIMIT_ACTION, Utils::String::fromEnum(torrent.shareLimitAction())},
|
||||
{KEY_TORRENT_LAST_SEEN_COMPLETE_TIME, Utils::DateTime::toSecsSinceEpoch(torrent.lastSeenComplete())},
|
||||
{KEY_TORRENT_AUTO_TORRENT_MANAGEMENT, torrent.isAutoTMMEnabled()},
|
||||
{KEY_TORRENT_TIME_ACTIVE, torrent.activeTime()},
|
||||
|
|
|
@ -85,6 +85,7 @@ inline const QString KEY_TORRENT_MAX_INACTIVE_SEEDING_TIME = u"max_inactive_seed
|
|||
inline const QString KEY_TORRENT_RATIO_LIMIT = u"ratio_limit"_s;
|
||||
inline const QString KEY_TORRENT_SEEDING_TIME_LIMIT = u"seeding_time_limit"_s;
|
||||
inline const QString KEY_TORRENT_INACTIVE_SEEDING_TIME_LIMIT = u"inactive_seeding_time_limit"_s;
|
||||
inline const QString KEY_TORRENT_SHARE_LIMIT_ACTION = u"share_limit_action"_s;
|
||||
inline const QString KEY_TORRENT_LAST_SEEN_COMPLETE_TIME = u"seen_complete"_s;
|
||||
inline const QString KEY_TORRENT_LAST_ACTIVITY_TIME = u"last_activity"_s;
|
||||
inline const QString KEY_TORRENT_TOTAL_SIZE = u"total_size"_s;
|
||||
|
|
|
@ -497,6 +497,7 @@ void SyncController::updateFreeDiskSpace(const qint64 freeDiskSpace)
|
|||
// - "max_seeding_time": Upload max seeding time
|
||||
// - "ratio_limit": Upload share ratio limit
|
||||
// - "seeding_time_limit": Upload seeding time limit
|
||||
// - "share_limit_action": Action to execute when the limit is reached
|
||||
// - "seen_complete": Indicates the time when the torrent was last seen complete/whole
|
||||
// - "last_activity": Last time when a chunk was downloaded/uploaded
|
||||
// - "total_size": Size including unwanted data
|
||||
|
|
|
@ -1360,18 +1360,21 @@ void TorrentsController::setDownloadLimitAction()
|
|||
|
||||
void TorrentsController::setShareLimitsAction()
|
||||
{
|
||||
requireParams({u"hashes"_s, u"ratioLimit"_s, u"seedingTimeLimit"_s, u"inactiveSeedingTimeLimit"_s});
|
||||
requireParams({u"hashes"_s, u"ratioLimit"_s, u"seedingTimeLimit"_s, u"inactiveSeedingTimeLimit"_s, u"shareLimitAction"_s});
|
||||
|
||||
const qreal ratioLimit = params()[u"ratioLimit"_s].toDouble();
|
||||
const qlonglong seedingTimeLimit = params()[u"seedingTimeLimit"_s].toLongLong();
|
||||
const qlonglong inactiveSeedingTimeLimit = params()[u"inactiveSeedingTimeLimit"_s].toLongLong();
|
||||
const BitTorrent::ShareLimitAction shareLimitAction = Utils::String::toEnum(params()[u"shareLimitAction"_s], BitTorrent::ShareLimitAction::Default);
|
||||
|
||||
const QStringList hashes = params()[u"hashes"_s].split(u'|');
|
||||
|
||||
applyToTorrents(hashes, [ratioLimit, seedingTimeLimit, inactiveSeedingTimeLimit](BitTorrent::Torrent *const torrent)
|
||||
applyToTorrents(hashes, [ratioLimit, seedingTimeLimit, inactiveSeedingTimeLimit, shareLimitAction](BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
torrent->setRatioLimit(ratioLimit);
|
||||
torrent->setSeedingTimeLimit(seedingTimeLimit);
|
||||
torrent->setInactiveSeedingTimeLimit(inactiveSeedingTimeLimit);
|
||||
torrent->setShareLimitAction(shareLimitAction);
|
||||
});
|
||||
|
||||
setResult(QString());
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include "base/utils/version.h"
|
||||
#include "api/isessionmanager.h"
|
||||
|
||||
inline const Utils::Version<3, 2> API_VERSION {2, 11, 10};
|
||||
inline const Utils::Version<3, 2> API_VERSION {2, 12, 0};
|
||||
|
||||
class APIController;
|
||||
class AuthController;
|
||||
|
|
|
@ -385,7 +385,7 @@ const initializeWindows = () => {
|
|||
const hash = hashes[i];
|
||||
const row = torrentsTable.getRow(hash).full_data;
|
||||
const origValues = `${row.ratio_limit}|${row.seeding_time_limit}|${row.inactive_seeding_time_limit}|${row.max_ratio}`
|
||||
+ `|${row.max_seeding_time}|${row.max_inactive_seeding_time}`;
|
||||
+ `|${row.max_seeding_time}|${row.max_inactive_seeding_time}|${row.share_limit_action}`;
|
||||
|
||||
// initialize value
|
||||
if (shareRatio === null)
|
||||
|
@ -414,8 +414,8 @@ const initializeWindows = () => {
|
|||
maximizable: false,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: window.qBittorrent.Dialog.limitWidthToViewport(424),
|
||||
height: 220
|
||||
width: window.qBittorrent.Dialog.limitWidthToViewport(500),
|
||||
height: 250
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -12,8 +12,11 @@
|
|||
|
||||
const UseGlobalLimit = -2;
|
||||
const NoLimit = -1;
|
||||
let limitReachedActionsEl;
|
||||
|
||||
window.addEventListener("DOMContentLoaded", (event) => {
|
||||
limitReachedActionsEl = document.getElementById("limitReachedActions");
|
||||
|
||||
window.addEventListener("keydown", (event) => {
|
||||
switch (event.key) {
|
||||
case "Enter":
|
||||
|
@ -36,7 +39,8 @@
|
|||
inactiveSeedingTimeLimit: Number(origValues[2]),
|
||||
maxRatio: Number(origValues[3]),
|
||||
maxSeedingTime: Number(origValues[4]),
|
||||
maxInactiveSeedingTime: Number(origValues[5])
|
||||
maxInactiveSeedingTime: Number(origValues[5]),
|
||||
shareLimitAction: String(origValues[6])
|
||||
};
|
||||
|
||||
// select default when orig values not passed. using double equals to compare string and int
|
||||
|
@ -65,6 +69,8 @@
|
|||
document.getElementById("setInactiveMinutes").checked = true;
|
||||
document.getElementById("inactiveMinutes").value = values.inactiveSeedingTimeLimit;
|
||||
}
|
||||
|
||||
limitReachedActionsEl.value = values.shareLimitAction;
|
||||
}
|
||||
|
||||
shareLimitChanged();
|
||||
|
@ -81,6 +87,7 @@
|
|||
let ratioLimitValue = 0.00;
|
||||
let seedingTimeLimitValue = 0;
|
||||
let inactiveSeedingTimeLimitValue = 0;
|
||||
let shareLimitActionValue = "Default";
|
||||
|
||||
if (shareLimit === "default") {
|
||||
ratioLimitValue = seedingTimeLimitValue = inactiveSeedingTimeLimitValue = UseGlobalLimit;
|
||||
|
@ -92,6 +99,7 @@
|
|||
ratioLimitValue = document.getElementById("setRatio").checked ? document.getElementById("ratio").value : -1;
|
||||
seedingTimeLimitValue = document.getElementById("setTotalMinutes").checked ? document.getElementById("totalMinutes").value : -1;
|
||||
inactiveSeedingTimeLimitValue = document.getElementById("setInactiveMinutes").checked ? document.getElementById("inactiveMinutes").value : -1;
|
||||
shareLimitActionValue = limitReachedActionsEl.value;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
|
@ -103,7 +111,8 @@
|
|||
hashes: searchParams.get("hashes"),
|
||||
ratioLimit: ratioLimitValue,
|
||||
seedingTimeLimit: seedingTimeLimitValue,
|
||||
inactiveSeedingTimeLimit: inactiveSeedingTimeLimitValue
|
||||
inactiveSeedingTimeLimit: inactiveSeedingTimeLimitValue,
|
||||
shareLimitAction: shareLimitActionValue
|
||||
})
|
||||
})
|
||||
.then((response) => {
|
||||
|
@ -140,6 +149,7 @@
|
|||
document.getElementById("setRatio").disabled = !customShareLimit;
|
||||
document.getElementById("setTotalMinutes").disabled = !customShareLimit;
|
||||
document.getElementById("setInactiveMinutes").disabled = !customShareLimit;
|
||||
limitReachedActionsEl.disabled = !customShareLimit;
|
||||
|
||||
enableInputBoxes();
|
||||
|
||||
|
@ -182,6 +192,16 @@
|
|||
<label id="inactiveMinutesLabel" for="setInactiveMinutes">QBT_TR(inactive minutes)QBT_TR[CONTEXT=UpDownRatioDialog]</label>
|
||||
<input type="number" id="inactiveMinutes" value="0" step="1" min="0" class="shareLimitInput" aria-labelledby="inactiveMinutesLabel">
|
||||
</div>
|
||||
<div style="margin-left: 40px; margin-bottom: 5px;">
|
||||
<label id="actionListLabel" for="limitReachedActions">QBT_TR(Action when the limit is reached)QBT_TR[CONTEXT=UpDownRatioDialog]</label>
|
||||
<select id="limitReachedActions" aria-labelledby="actionListLabel">
|
||||
<option value="Default">QBT_TR(Default)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
||||
<option value="Stop">QBT_TR(Stop torrent)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
||||
<option value="Remove">QBT_TR(Remove torrent)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
||||
<option value="RemoveWithContent">QBT_TR(Remove torrent and its content)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
||||
<option value="EnableSuperSeeding">QBT_TR(Enable super seeding for torrent)QBT_TR[CONTEXT=UpDownRatioDialog]</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="text-align: center; padding-top: 10px;">
|
||||
<input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" id="save">
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue