Implement sync/torrent_peers request

This commit is contained in:
buinsky 2015-11-12 22:19:44 +03:00
parent aea6c38b33
commit 00c765be1b
10 changed files with 266 additions and 151 deletions

View file

@ -82,6 +82,7 @@ QMap<QString, QMap<QString, WebApplication::Action> > WebApplication::initialize
ADD_ACTION(query, propertiesWebSeeds);
ADD_ACTION(query, propertiesFiles);
ADD_ACTION(sync, maindata);
ADD_ACTION(sync, torrent_peers);
ADD_ACTION(command, shutdown);
ADD_ACTION(command, download);
ADD_ACTION(command, upload);
@ -277,6 +278,19 @@ void WebApplication::action_sync_maindata()
session()->syncMainDataLastAcceptedResponse), Http::CONTENT_TYPE_JSON);
}
// GET param:
// - hash (string): torrent hash
// - rid (int): last response id
void WebApplication::action_sync_torrent_peers()
{
CHECK_URI(0);
print(btjson::getSyncTorrentPeersData(request().gets["rid"].toInt(),
request().gets["hash"],
session()->syncTorrentPeersLastResponse,
session()->syncTorrentPeersLastAcceptedResponse), Http::CONTENT_TYPE_JSON);
}
void WebApplication::action_version_api()
{
CHECK_URI(0);