|
|
@ -223,43 +223,43 @@ void WebApplication::action_query_torrents() |
|
|
|
print(btjson::getTorrents( |
|
|
|
print(btjson::getTorrents( |
|
|
|
gets["filter"], gets["label"], gets["sort"], gets["reverse"] == "true", |
|
|
|
gets["filter"], gets["label"], gets["sort"], gets["reverse"] == "true", |
|
|
|
gets["limit"].toInt(), gets["offset"].toInt() |
|
|
|
gets["limit"].toInt(), gets["offset"].toInt() |
|
|
|
), Http::CONTENT_TYPE_JS); |
|
|
|
), Http::CONTENT_TYPE_JSON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WebApplication::action_query_preferences() |
|
|
|
void WebApplication::action_query_preferences() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
print(prefjson::getPreferences(), Http::CONTENT_TYPE_JS); |
|
|
|
print(prefjson::getPreferences(), Http::CONTENT_TYPE_JSON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WebApplication::action_query_transferInfo() |
|
|
|
void WebApplication::action_query_transferInfo() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
print(btjson::getTransferInfo(), Http::CONTENT_TYPE_JS); |
|
|
|
print(btjson::getTransferInfo(), Http::CONTENT_TYPE_JSON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WebApplication::action_query_propertiesGeneral() |
|
|
|
void WebApplication::action_query_propertiesGeneral() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(1); |
|
|
|
CHECK_URI(1); |
|
|
|
print(btjson::getPropertiesForTorrent(args_.front()), Http::CONTENT_TYPE_JS); |
|
|
|
print(btjson::getPropertiesForTorrent(args_.front()), Http::CONTENT_TYPE_JSON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WebApplication::action_query_propertiesTrackers() |
|
|
|
void WebApplication::action_query_propertiesTrackers() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(1); |
|
|
|
CHECK_URI(1); |
|
|
|
print(btjson::getTrackersForTorrent(args_.front()), Http::CONTENT_TYPE_JS); |
|
|
|
print(btjson::getTrackersForTorrent(args_.front()), Http::CONTENT_TYPE_JSON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WebApplication::action_query_propertiesWebSeeds() |
|
|
|
void WebApplication::action_query_propertiesWebSeeds() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(1); |
|
|
|
CHECK_URI(1); |
|
|
|
print(btjson::getWebSeedsForTorrent(args_.front()), Http::CONTENT_TYPE_JS); |
|
|
|
print(btjson::getWebSeedsForTorrent(args_.front()), Http::CONTENT_TYPE_JSON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WebApplication::action_query_propertiesFiles() |
|
|
|
void WebApplication::action_query_propertiesFiles() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(1); |
|
|
|
CHECK_URI(1); |
|
|
|
print(btjson::getFilesForTorrent(args_.front()), Http::CONTENT_TYPE_JS); |
|
|
|
print(btjson::getFilesForTorrent(args_.front()), Http::CONTENT_TYPE_JSON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// GET param:
|
|
|
|
// GET param:
|
|
|
@ -267,7 +267,9 @@ void WebApplication::action_query_propertiesFiles() |
|
|
|
void WebApplication::action_sync_maindata() |
|
|
|
void WebApplication::action_sync_maindata() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
print(btjson::getSyncMainData(request().gets["rid"].toInt(), session()->syncMainDataLastResponse, session()->syncMainDataLastAcceptedResponse)); |
|
|
|
print(btjson::getSyncMainData(request().gets["rid"].toInt(), |
|
|
|
|
|
|
|
session()->syncMainDataLastResponse, |
|
|
|
|
|
|
|
session()->syncMainDataLastAcceptedResponse), Http::CONTENT_TYPE_JSON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WebApplication::action_version_api() |
|
|
|
void WebApplication::action_version_api() |
|
|
@ -426,13 +428,13 @@ void WebApplication::action_command_setFilePrio() |
|
|
|
void WebApplication::action_command_getGlobalUpLimit() |
|
|
|
void WebApplication::action_command_getGlobalUpLimit() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
print(QByteArray::number(BitTorrent::Session::instance()->uploadRateLimit())); |
|
|
|
print(QByteArray::number(BitTorrent::Session::instance()->uploadRateLimit()), Http::CONTENT_TYPE_TXT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WebApplication::action_command_getGlobalDlLimit() |
|
|
|
void WebApplication::action_command_getGlobalDlLimit() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
print(QByteArray::number(BitTorrent::Session::instance()->downloadRateLimit())); |
|
|
|
print(QByteArray::number(BitTorrent::Session::instance()->downloadRateLimit()), Http::CONTENT_TYPE_TXT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WebApplication::action_command_setGlobalUpLimit() |
|
|
|
void WebApplication::action_command_setGlobalUpLimit() |
|
|
@ -468,7 +470,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_JS); |
|
|
|
print(btjson::getTorrentsRatesLimits(hashes, false), Http::CONTENT_TYPE_JSON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WebApplication::action_command_getTorrentsDlLimit() |
|
|
|
void WebApplication::action_command_getTorrentsDlLimit() |
|
|
@ -476,7 +478,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_JS); |
|
|
|
print(btjson::getTorrentsRatesLimits(hashes, true), Http::CONTENT_TYPE_JSON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WebApplication::action_command_setTorrentsUpLimit() |
|
|
|
void WebApplication::action_command_setTorrentsUpLimit() |
|
|
@ -522,7 +524,7 @@ void WebApplication::action_command_toggleAlternativeSpeedLimits() |
|
|
|
void WebApplication::action_command_alternativeSpeedLimitsEnabled() |
|
|
|
void WebApplication::action_command_alternativeSpeedLimitsEnabled() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CHECK_URI(0); |
|
|
|
CHECK_URI(0); |
|
|
|
print(QByteArray::number(Preferences::instance()->isAltBandwidthEnabled())); |
|
|
|
print(QByteArray::number(Preferences::instance()->isAltBandwidthEnabled()), Http::CONTENT_TYPE_TXT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WebApplication::action_command_toggleSequentialDownload() |
|
|
|
void WebApplication::action_command_toggleSequentialDownload() |
|
|
|