mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 01:03:08 -07:00
Add new webUI API. Closes #6457.
Now getting piece information for a specific torrent is possible via: * Returns an array of states (integers) of pieces in order. Defined as: "0=not downloaded", "1=downloading", "2=downloaded". GET /query/getPieceStates/<torrent_hash> * Returns an array of hashes (strings) of pieces in order: GET /query/getPieceHashes/<torrent_hash>
This commit is contained in:
parent
47960b2592
commit
3933790bda
6 changed files with 88 additions and 1 deletions
|
@ -49,7 +49,7 @@
|
|||
#include "websessiondata.h"
|
||||
#include "webapplication.h"
|
||||
|
||||
static const int API_VERSION = 13;
|
||||
static const int API_VERSION = 14;
|
||||
static const int API_VERSION_MIN = 13;
|
||||
|
||||
const QString WWW_FOLDER = ":/www/public/";
|
||||
|
@ -83,6 +83,8 @@ QMap<QString, QMap<QString, WebApplication::Action> > WebApplication::initialize
|
|||
ADD_ACTION(query, propertiesFiles);
|
||||
ADD_ACTION(query, getLog);
|
||||
ADD_ACTION(query, getPeerLog);
|
||||
ADD_ACTION(query, getPieceHashes);
|
||||
ADD_ACTION(query, getPieceStates);
|
||||
ADD_ACTION(sync, maindata);
|
||||
ADD_ACTION(sync, torrent_peers);
|
||||
ADD_ACTION(command, shutdown);
|
||||
|
@ -310,6 +312,18 @@ void WebApplication::action_query_getPeerLog()
|
|||
print(btjson::getPeerLog(lastKnownId), Http::CONTENT_TYPE_JSON);
|
||||
}
|
||||
|
||||
void WebApplication::action_query_getPieceHashes()
|
||||
{
|
||||
CHECK_URI(1);
|
||||
print(btjson::getPieceHashesForTorrent(args_.front()), Http::CONTENT_TYPE_JSON);
|
||||
}
|
||||
|
||||
void WebApplication::action_query_getPieceStates()
|
||||
{
|
||||
CHECK_URI(1);
|
||||
print(btjson::getPieceStatesForTorrent(args_.front()), Http::CONTENT_TYPE_JSON);
|
||||
}
|
||||
|
||||
// GET param:
|
||||
// - rid (int): last response id
|
||||
void WebApplication::action_sync_maindata()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue