|
|
@ -100,6 +100,8 @@ QMap<QString, QMap<QString, RequestHandler::Action> > RequestHandler::initialize |
|
|
|
ADD_ACTION(command, getTorrentDlLimit); |
|
|
|
ADD_ACTION(command, getTorrentDlLimit); |
|
|
|
ADD_ACTION(command, setTorrentUpLimit); |
|
|
|
ADD_ACTION(command, setTorrentUpLimit); |
|
|
|
ADD_ACTION(command, setTorrentDlLimit); |
|
|
|
ADD_ACTION(command, setTorrentDlLimit); |
|
|
|
|
|
|
|
ADD_ACTION(command, alternativeSpeedLimitsEnabled); |
|
|
|
|
|
|
|
ADD_ACTION(command, toggleAlternativeSpeedLimits); |
|
|
|
ADD_ACTION(command, toggleSequentialDownload); |
|
|
|
ADD_ACTION(command, toggleSequentialDownload); |
|
|
|
ADD_ACTION(command, toggleFirstLastPiecePrio); |
|
|
|
ADD_ACTION(command, toggleFirstLastPiecePrio); |
|
|
|
ADD_ACTION(command, delete); |
|
|
|
ADD_ACTION(command, delete); |
|
|
@ -116,6 +118,25 @@ QMap<QString, QMap<QString, RequestHandler::Action> > RequestHandler::initialize |
|
|
|
return actions; |
|
|
|
return actions; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define CHECK_URI() \ |
|
|
|
|
|
|
|
if (!args_.isEmpty()) { \ |
|
|
|
|
|
|
|
status(404, "Not Found"); \ |
|
|
|
|
|
|
|
return; \ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#define CHECK_PARAMETERS(PARAMETERS) \ |
|
|
|
|
|
|
|
QStringList parameters; \ |
|
|
|
|
|
|
|
parameters << PARAMETERS; \ |
|
|
|
|
|
|
|
if (parameters.size() != request().posts.size()) { \ |
|
|
|
|
|
|
|
status(400, "Bad Request"); \ |
|
|
|
|
|
|
|
return; \ |
|
|
|
|
|
|
|
} \ |
|
|
|
|
|
|
|
foreach (QString key, request().posts.keys()) { \ |
|
|
|
|
|
|
|
if (!parameters.contains(key, Qt::CaseInsensitive)) { \ |
|
|
|
|
|
|
|
status(400, "Bad Request"); \ |
|
|
|
|
|
|
|
return; \ |
|
|
|
|
|
|
|
} \ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_public_index() |
|
|
|
void RequestHandler::action_public_index() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QString path; |
|
|
|
QString path; |
|
|
@ -163,6 +184,7 @@ void RequestHandler::action_public_login() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_public_logout() |
|
|
|
void RequestHandler::action_public_logout() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
sessionEnd(); |
|
|
|
sessionEnd(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -200,6 +222,7 @@ void RequestHandler::action_public_images() |
|
|
|
// - offset (int): set offset (if less than 0 - offset from end)
|
|
|
|
// - offset (int): set offset (if less than 0 - offset from end)
|
|
|
|
void RequestHandler::action_json_torrents() |
|
|
|
void RequestHandler::action_json_torrents() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
const QStringMap& gets = request().gets; |
|
|
|
const QStringMap& gets = request().gets; |
|
|
|
|
|
|
|
|
|
|
|
print(btjson::getTorrents( |
|
|
|
print(btjson::getTorrents( |
|
|
@ -210,41 +233,49 @@ void RequestHandler::action_json_torrents() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_json_preferences() |
|
|
|
void RequestHandler::action_json_preferences() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
print(prefjson::getPreferences(), CONTENT_TYPE_JS); |
|
|
|
print(prefjson::getPreferences(), CONTENT_TYPE_JS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_json_transferInfo() |
|
|
|
void RequestHandler::action_json_transferInfo() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
print(btjson::getTransferInfo(), CONTENT_TYPE_JS); |
|
|
|
print(btjson::getTransferInfo(), CONTENT_TYPE_JS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_json_propertiesGeneral() |
|
|
|
void RequestHandler::action_json_propertiesGeneral() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
print(btjson::getPropertiesForTorrent(args_.front()), CONTENT_TYPE_JS); |
|
|
|
print(btjson::getPropertiesForTorrent(args_.front()), CONTENT_TYPE_JS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_json_propertiesTrackers() |
|
|
|
void RequestHandler::action_json_propertiesTrackers() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
print(btjson::getTrackersForTorrent(args_.front()), CONTENT_TYPE_JS); |
|
|
|
print(btjson::getTrackersForTorrent(args_.front()), CONTENT_TYPE_JS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_json_propertiesFiles() |
|
|
|
void RequestHandler::action_json_propertiesFiles() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
print(btjson::getFilesForTorrent(args_.front()), CONTENT_TYPE_JS); |
|
|
|
print(btjson::getFilesForTorrent(args_.front()), CONTENT_TYPE_JS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_version_api() |
|
|
|
void RequestHandler::action_version_api() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
print(QString::number(API_VERSION), CONTENT_TYPE_TXT); |
|
|
|
print(QString::number(API_VERSION), CONTENT_TYPE_TXT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_version_api_min() |
|
|
|
void RequestHandler::action_version_api_min() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
print(QString::number(API_VERSION_MIN), CONTENT_TYPE_TXT); |
|
|
|
print(QString::number(API_VERSION_MIN), CONTENT_TYPE_TXT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_version_qbittorrent() |
|
|
|
void RequestHandler::action_version_qbittorrent() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
print(QString(VERSION), CONTENT_TYPE_TXT); |
|
|
|
print(QString(VERSION), CONTENT_TYPE_TXT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -255,11 +286,14 @@ void RequestHandler::action_command_shutdown() |
|
|
|
// need to reply to the Web UI before
|
|
|
|
// need to reply to the Web UI before
|
|
|
|
// actually shutting down.
|
|
|
|
// actually shutting down.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
QTimer::singleShot(0, qApp, SLOT(quit())); |
|
|
|
QTimer::singleShot(0, qApp, SLOT(quit())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_download() |
|
|
|
void RequestHandler::action_command_download() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("urls"); |
|
|
|
QString urls = request().posts["urls"]; |
|
|
|
QString urls = request().posts["urls"]; |
|
|
|
QStringList list = urls.split('\n'); |
|
|
|
QStringList list = urls.split('\n'); |
|
|
|
|
|
|
|
|
|
|
@ -284,6 +318,7 @@ void RequestHandler::action_command_download() |
|
|
|
void RequestHandler::action_command_upload() |
|
|
|
void RequestHandler::action_command_upload() |
|
|
|
{ |
|
|
|
{ |
|
|
|
qDebug() << Q_FUNC_INFO; |
|
|
|
qDebug() << Q_FUNC_INFO; |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
|
|
|
|
foreach(const UploadedFile& torrent, request().files) { |
|
|
|
foreach(const UploadedFile& torrent, request().files) { |
|
|
|
QString filePath = saveTmpFile(torrent.data); |
|
|
|
QString filePath = saveTmpFile(torrent.data); |
|
|
@ -307,6 +342,8 @@ void RequestHandler::action_command_upload() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_addTrackers() |
|
|
|
void RequestHandler::action_command_addTrackers() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hash" << "urls"); |
|
|
|
QString hash = request().posts["hash"]; |
|
|
|
QString hash = request().posts["hash"]; |
|
|
|
|
|
|
|
|
|
|
|
if (!hash.isEmpty()) { |
|
|
|
if (!hash.isEmpty()) { |
|
|
@ -326,31 +363,41 @@ void RequestHandler::action_command_addTrackers() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_resumeAll() |
|
|
|
void RequestHandler::action_command_resumeAll() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
QBtSession::instance()->resumeAllTorrents(); |
|
|
|
QBtSession::instance()->resumeAllTorrents(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_pauseAll() |
|
|
|
void RequestHandler::action_command_pauseAll() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
QBtSession::instance()->pauseAllTorrents(); |
|
|
|
QBtSession::instance()->pauseAllTorrents(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_resume() |
|
|
|
void RequestHandler::action_command_resume() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hash"); |
|
|
|
QBtSession::instance()->resumeTorrent(request().posts["hash"]); |
|
|
|
QBtSession::instance()->resumeTorrent(request().posts["hash"]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_pause() |
|
|
|
void RequestHandler::action_command_pause() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hash"); |
|
|
|
QBtSession::instance()->pauseTorrent(request().posts["hash"]); |
|
|
|
QBtSession::instance()->pauseTorrent(request().posts["hash"]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_setPreferences() |
|
|
|
void RequestHandler::action_command_setPreferences() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("json"); |
|
|
|
prefjson::setPreferences(request().posts["json"]); |
|
|
|
prefjson::setPreferences(request().posts["json"]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_setFilePrio() |
|
|
|
void RequestHandler::action_command_setFilePrio() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hash" << "id" << "priority"); |
|
|
|
QString hash = request().posts["hash"]; |
|
|
|
QString hash = request().posts["hash"]; |
|
|
|
int file_id = request().posts["id"].toInt(); |
|
|
|
int file_id = request().posts["id"].toInt(); |
|
|
|
int priority = request().posts["priority"].toInt(); |
|
|
|
int priority = request().posts["priority"].toInt(); |
|
|
@ -362,34 +409,48 @@ void RequestHandler::action_command_setFilePrio() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_getGlobalUpLimit() |
|
|
|
void RequestHandler::action_command_getGlobalUpLimit() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
print(QByteArray::number(QBtSession::instance()->getSession()->settings().upload_rate_limit)); |
|
|
|
print(QByteArray::number(QBtSession::instance()->getSession()->settings().upload_rate_limit)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_getGlobalDlLimit() |
|
|
|
void RequestHandler::action_command_getGlobalDlLimit() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
print(QByteArray::number(QBtSession::instance()->getSession()->settings().download_rate_limit)); |
|
|
|
print(QByteArray::number(QBtSession::instance()->getSession()->settings().download_rate_limit)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_setGlobalUpLimit() |
|
|
|
void RequestHandler::action_command_setGlobalUpLimit() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("limit"); |
|
|
|
qlonglong limit = request().posts["limit"].toLongLong(); |
|
|
|
qlonglong limit = request().posts["limit"].toLongLong(); |
|
|
|
if (limit == 0) limit = -1; |
|
|
|
if (limit == 0) limit = -1; |
|
|
|
|
|
|
|
|
|
|
|
QBtSession::instance()->setUploadRateLimit(limit); |
|
|
|
QBtSession::instance()->setUploadRateLimit(limit); |
|
|
|
Preferences::instance()->setGlobalUploadLimit(limit / 1024.); |
|
|
|
if (Preferences::instance()->isAltBandwidthEnabled()) |
|
|
|
|
|
|
|
Preferences::instance()->setAltGlobalUploadLimit(limit / 1024.); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
Preferences::instance()->setGlobalUploadLimit(limit / 1024.); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_setGlobalDlLimit() |
|
|
|
void RequestHandler::action_command_setGlobalDlLimit() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("limit"); |
|
|
|
qlonglong limit = request().posts["limit"].toLongLong(); |
|
|
|
qlonglong limit = request().posts["limit"].toLongLong(); |
|
|
|
if (limit == 0) limit = -1; |
|
|
|
if (limit == 0) limit = -1; |
|
|
|
|
|
|
|
|
|
|
|
QBtSession::instance()->setDownloadRateLimit(limit); |
|
|
|
QBtSession::instance()->setDownloadRateLimit(limit); |
|
|
|
Preferences::instance()->setGlobalDownloadLimit(limit / 1024.); |
|
|
|
if (Preferences::instance()->isAltBandwidthEnabled()) |
|
|
|
|
|
|
|
Preferences::instance()->setAltGlobalDownloadLimit(limit / 1024.); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
Preferences::instance()->setGlobalDownloadLimit(limit / 1024.); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_getTorrentUpLimit() |
|
|
|
void RequestHandler::action_command_getTorrentUpLimit() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hash"); |
|
|
|
QString hash = request().posts["hash"]; |
|
|
|
QString hash = request().posts["hash"]; |
|
|
|
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); |
|
|
|
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); |
|
|
|
|
|
|
|
|
|
|
@ -399,6 +460,8 @@ void RequestHandler::action_command_getTorrentUpLimit() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_getTorrentDlLimit() |
|
|
|
void RequestHandler::action_command_getTorrentDlLimit() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hash"); |
|
|
|
QString hash = request().posts["hash"]; |
|
|
|
QString hash = request().posts["hash"]; |
|
|
|
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); |
|
|
|
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); |
|
|
|
|
|
|
|
|
|
|
@ -408,6 +471,8 @@ void RequestHandler::action_command_getTorrentDlLimit() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_setTorrentUpLimit() |
|
|
|
void RequestHandler::action_command_setTorrentUpLimit() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hash" << "limit"); |
|
|
|
QString hash = request().posts["hash"]; |
|
|
|
QString hash = request().posts["hash"]; |
|
|
|
qlonglong limit = request().posts["limit"].toLongLong(); |
|
|
|
qlonglong limit = request().posts["limit"].toLongLong(); |
|
|
|
if (limit == 0) limit = -1; |
|
|
|
if (limit == 0) limit = -1; |
|
|
@ -419,6 +484,8 @@ void RequestHandler::action_command_setTorrentUpLimit() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_setTorrentDlLimit() |
|
|
|
void RequestHandler::action_command_setTorrentDlLimit() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hash" << "limit"); |
|
|
|
QString hash = request().posts["hash"]; |
|
|
|
QString hash = request().posts["hash"]; |
|
|
|
qlonglong limit = request().posts["limit"].toLongLong(); |
|
|
|
qlonglong limit = request().posts["limit"].toLongLong(); |
|
|
|
if (limit == 0) limit = -1; |
|
|
|
if (limit == 0) limit = -1; |
|
|
@ -428,8 +495,22 @@ void RequestHandler::action_command_setTorrentDlLimit() |
|
|
|
h.set_download_limit(limit); |
|
|
|
h.set_download_limit(limit); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_toggleAlternativeSpeedLimits() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
QBtSession::instance()->useAlternativeSpeedsLimit(!Preferences::instance()->isAltBandwidthEnabled()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_alternativeSpeedLimitsEnabled() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
print(QByteArray::number(Preferences::instance()->isAltBandwidthEnabled())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_toggleSequentialDownload() |
|
|
|
void RequestHandler::action_command_toggleSequentialDownload() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|
try { |
|
|
|
try { |
|
|
@ -442,6 +523,8 @@ void RequestHandler::action_command_toggleSequentialDownload() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_toggleFirstLastPiecePrio() |
|
|
|
void RequestHandler::action_command_toggleFirstLastPiecePrio() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|
try { |
|
|
|
try { |
|
|
@ -454,6 +537,8 @@ void RequestHandler::action_command_toggleFirstLastPiecePrio() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_delete() |
|
|
|
void RequestHandler::action_command_delete() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
foreach (const QString &hash, hashes) |
|
|
|
foreach (const QString &hash, hashes) |
|
|
|
QBtSession::instance()->deleteTorrent(hash, false); |
|
|
|
QBtSession::instance()->deleteTorrent(hash, false); |
|
|
@ -461,6 +546,8 @@ void RequestHandler::action_command_delete() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_deletePerm() |
|
|
|
void RequestHandler::action_command_deletePerm() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
foreach (const QString &hash, hashes) |
|
|
|
foreach (const QString &hash, hashes) |
|
|
|
QBtSession::instance()->deleteTorrent(hash, true); |
|
|
|
QBtSession::instance()->deleteTorrent(hash, true); |
|
|
@ -468,6 +555,8 @@ void RequestHandler::action_command_deletePerm() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_increasePrio() |
|
|
|
void RequestHandler::action_command_increasePrio() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
|
|
|
|
|
|
|
|
std::priority_queue<QPair<int, QTorrentHandle>, |
|
|
|
std::priority_queue<QPair<int, QTorrentHandle>, |
|
|
@ -499,6 +588,8 @@ void RequestHandler::action_command_increasePrio() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_decreasePrio() |
|
|
|
void RequestHandler::action_command_decreasePrio() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
|
|
|
|
|
|
|
|
std::priority_queue<QPair<int, QTorrentHandle>, |
|
|
|
std::priority_queue<QPair<int, QTorrentHandle>, |
|
|
@ -531,6 +622,8 @@ void RequestHandler::action_command_decreasePrio() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_topPrio() |
|
|
|
void RequestHandler::action_command_topPrio() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
foreach (const QString &hash, request().posts["hashes"].split("|")) { |
|
|
|
foreach (const QString &hash, request().posts["hashes"].split("|")) { |
|
|
|
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); |
|
|
|
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); |
|
|
|
if (h.is_valid()) h.queue_position_top(); |
|
|
|
if (h.is_valid()) h.queue_position_top(); |
|
|
@ -539,6 +632,8 @@ void RequestHandler::action_command_topPrio() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_bottomPrio() |
|
|
|
void RequestHandler::action_command_bottomPrio() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
foreach (const QString &hash, request().posts["hashes"].split("|")) { |
|
|
|
foreach (const QString &hash, request().posts["hashes"].split("|")) { |
|
|
|
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); |
|
|
|
QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); |
|
|
|
if (h.is_valid()) h.queue_position_bottom(); |
|
|
|
if (h.is_valid()) h.queue_position_bottom(); |
|
|
@ -547,6 +642,8 @@ void RequestHandler::action_command_bottomPrio() |
|
|
|
|
|
|
|
|
|
|
|
void RequestHandler::action_command_recheck() |
|
|
|
void RequestHandler::action_command_recheck() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hash"); |
|
|
|
QBtSession::instance()->recheckTorrent(request().posts["hash"]); |
|
|
|
QBtSession::instance()->recheckTorrent(request().posts["hash"]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|