|
|
@ -122,6 +122,7 @@ QMap<QString, QMap<QString, WebApplication::Action> > WebApplication::initialize |
|
|
|
ADD_ACTION(command, bottomPrio); |
|
|
|
ADD_ACTION(command, bottomPrio); |
|
|
|
ADD_ACTION(command, setLocation); |
|
|
|
ADD_ACTION(command, setLocation); |
|
|
|
ADD_ACTION(command, rename); |
|
|
|
ADD_ACTION(command, rename); |
|
|
|
|
|
|
|
ADD_ACTION(command, setAutoTMM); |
|
|
|
ADD_ACTION(command, recheck); |
|
|
|
ADD_ACTION(command, recheck); |
|
|
|
ADD_ACTION(command, setCategory); |
|
|
|
ADD_ACTION(command, setCategory); |
|
|
|
ADD_ACTION(command, addCategory); |
|
|
|
ADD_ACTION(command, addCategory); |
|
|
@ -595,7 +596,7 @@ void WebApplication::action_command_getTorrentsUpLimit() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split('|'); |
|
|
|
print(btjson::getTorrentsRatesLimits(hashes, false), Http::CONTENT_TYPE_JSON); |
|
|
|
print(btjson::getTorrentsRatesLimits(hashes, false), Http::CONTENT_TYPE_JSON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -603,7 +604,7 @@ void WebApplication::action_command_getTorrentsDlLimit() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split('|'); |
|
|
|
print(btjson::getTorrentsRatesLimits(hashes, true), Http::CONTENT_TYPE_JSON); |
|
|
|
print(btjson::getTorrentsRatesLimits(hashes, true), Http::CONTENT_TYPE_JSON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -616,7 +617,7 @@ void WebApplication::action_command_setTorrentsUpLimit() |
|
|
|
if (limit == 0) |
|
|
|
if (limit == 0) |
|
|
|
limit = -1; |
|
|
|
limit = -1; |
|
|
|
|
|
|
|
|
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split('|'); |
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); |
|
|
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); |
|
|
|
if (torrent) |
|
|
|
if (torrent) |
|
|
@ -633,7 +634,7 @@ void WebApplication::action_command_setTorrentsDlLimit() |
|
|
|
if (limit == 0) |
|
|
|
if (limit == 0) |
|
|
|
limit = -1; |
|
|
|
limit = -1; |
|
|
|
|
|
|
|
|
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split('|'); |
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); |
|
|
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); |
|
|
|
if (torrent) |
|
|
|
if (torrent) |
|
|
@ -659,7 +660,7 @@ void WebApplication::action_command_toggleSequentialDownload() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
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) { |
|
|
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); |
|
|
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); |
|
|
|
if (torrent) |
|
|
|
if (torrent) |
|
|
@ -671,7 +672,7 @@ void WebApplication::action_command_toggleFirstLastPiecePrio() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
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) { |
|
|
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); |
|
|
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); |
|
|
|
if (torrent) |
|
|
|
if (torrent) |
|
|
@ -684,7 +685,7 @@ void WebApplication::action_command_setSuperSeeding() |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_PARAMETERS("hashes" << "value"); |
|
|
|
CHECK_PARAMETERS("hashes" << "value"); |
|
|
|
bool value = request().posts["value"] == "true"; |
|
|
|
bool value = request().posts["value"] == "true"; |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split('|'); |
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); |
|
|
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); |
|
|
|
if (torrent) |
|
|
|
if (torrent) |
|
|
@ -697,7 +698,7 @@ void WebApplication::action_command_setForceStart() |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_PARAMETERS("hashes" << "value"); |
|
|
|
CHECK_PARAMETERS("hashes" << "value"); |
|
|
|
bool value = request().posts["value"] == "true"; |
|
|
|
bool value = request().posts["value"] == "true"; |
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split('|'); |
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); |
|
|
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); |
|
|
|
if (torrent) |
|
|
|
if (torrent) |
|
|
@ -709,7 +710,7 @@ void WebApplication::action_command_delete() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
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) |
|
|
|
BitTorrent::Session::instance()->deleteTorrent(hash, false); |
|
|
|
BitTorrent::Session::instance()->deleteTorrent(hash, false); |
|
|
|
} |
|
|
|
} |
|
|
@ -718,7 +719,7 @@ void WebApplication::action_command_deletePerm() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_PARAMETERS("hashes"); |
|
|
|
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) |
|
|
|
BitTorrent::Session::instance()->deleteTorrent(hash, true); |
|
|
|
BitTorrent::Session::instance()->deleteTorrent(hash, true); |
|
|
|
} |
|
|
|
} |
|
|
@ -733,7 +734,7 @@ void WebApplication::action_command_increasePrio() |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split('|'); |
|
|
|
BitTorrent::Session::instance()->increaseTorrentsPriority(hashes); |
|
|
|
BitTorrent::Session::instance()->increaseTorrentsPriority(hashes); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -747,7 +748,7 @@ void WebApplication::action_command_decreasePrio() |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split('|'); |
|
|
|
BitTorrent::Session::instance()->decreaseTorrentsPriority(hashes); |
|
|
|
BitTorrent::Session::instance()->decreaseTorrentsPriority(hashes); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -761,7 +762,7 @@ void WebApplication::action_command_topPrio() |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split('|'); |
|
|
|
BitTorrent::Session::instance()->topTorrentsPriority(hashes); |
|
|
|
BitTorrent::Session::instance()->topTorrentsPriority(hashes); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -775,7 +776,7 @@ void WebApplication::action_command_bottomPrio() |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split('|'); |
|
|
|
BitTorrent::Session::instance()->bottomTorrentsPriority(hashes); |
|
|
|
BitTorrent::Session::instance()->bottomTorrentsPriority(hashes); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -822,6 +823,21 @@ void WebApplication::action_command_rename() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void WebApplication::action_command_setAutoTMM() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CHECK_URI(0); |
|
|
|
|
|
|
|
CHECK_PARAMETERS("hashes" << "enable"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QStringList hashes = request().posts["hashes"].split('|'); |
|
|
|
|
|
|
|
QString enableStr = request().posts["enable"]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|
|
|
|
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); |
|
|
|
|
|
|
|
if (torrent) |
|
|
|
|
|
|
|
torrent->setAutoTMMEnabled(QString::compare(enableStr, "true", Qt::CaseInsensitive) == 0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WebApplication::action_command_recheck() |
|
|
|
void WebApplication::action_command_recheck() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
@ -837,7 +853,7 @@ void WebApplication::action_command_setCategory() |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_PARAMETERS("hashes" << "category"); |
|
|
|
CHECK_PARAMETERS("hashes" << "category"); |
|
|
|
|
|
|
|
|
|
|
|
QStringList hashes = request().posts["hashes"].split("|"); |
|
|
|
QStringList hashes = request().posts["hashes"].split('|'); |
|
|
|
QString category = request().posts["category"].trimmed(); |
|
|
|
QString category = request().posts["category"].trimmed(); |
|
|
|
|
|
|
|
|
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|
foreach (const QString &hash, hashes) { |
|
|
|