mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 06:28:03 -06:00
WebAPI: Add setComment endpoint
No UI implementation as of now. Closes #19598. PR #23031.
This commit is contained in:
@@ -1591,6 +1591,19 @@ void TorrentsController::renameAction()
|
||||
setResult(QString());
|
||||
}
|
||||
|
||||
void TorrentsController::setCommentAction()
|
||||
{
|
||||
requireParams({u"hashes"_s, u"comment"_s});
|
||||
|
||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||
const QString comment = params()[u"comment"_s].trimmed();
|
||||
|
||||
applyToTorrents(hashes, [&comment](BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
torrent->setComment(comment);
|
||||
});
|
||||
}
|
||||
|
||||
void TorrentsController::setAutoManagementAction()
|
||||
{
|
||||
requireParams({u"hashes"_s, u"enable"_s});
|
||||
|
||||
@@ -71,6 +71,7 @@ private slots:
|
||||
void recheckAction();
|
||||
void reannounceAction();
|
||||
void renameAction();
|
||||
void setCommentAction();
|
||||
void setCategoryAction();
|
||||
void createCategoryAction();
|
||||
void editCategoryAction();
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
#include "base/utils/version.h"
|
||||
#include "api/isessionmanager.h"
|
||||
|
||||
inline const Utils::Version<3, 2> API_VERSION {2, 12, 0};
|
||||
inline const Utils::Version<3, 2> API_VERSION {2, 12, 1};
|
||||
|
||||
class APIController;
|
||||
class AuthController;
|
||||
@@ -200,6 +200,7 @@ private:
|
||||
{{u"torrents"_s, u"renameFolder"_s}, Http::METHOD_POST},
|
||||
{{u"torrents"_s, u"setAutoManagement"_s}, Http::METHOD_POST},
|
||||
{{u"torrents"_s, u"setCategory"_s}, Http::METHOD_POST},
|
||||
{{u"torrents"_s, u"setComment"_s}, Http::METHOD_POST},
|
||||
{{u"torrents"_s, u"setDownloadLimit"_s}, Http::METHOD_POST},
|
||||
{{u"torrents"_s, u"setDownloadPath"_s}, Http::METHOD_POST},
|
||||
{{u"torrents"_s, u"setForceStart"_s}, Http::METHOD_POST},
|
||||
|
||||
Reference in New Issue
Block a user