Browse Source

Web API: rename 'json' scope to 'query'

adaptive-webui-19844
buinsky 10 years ago
parent
commit
b30ec46048
  1. 24
      src/webui/requesthandler.cpp
  2. 12
      src/webui/requesthandler.h
  3. 2
      src/webui/www/public/preferences_content.html
  4. 2
      src/webui/www/public/scripts/prop-files.js
  5. 2
      src/webui/www/public/scripts/prop-general.js
  6. 2
      src/webui/www/public/scripts/prop-trackers.js

24
src/webui/requesthandler.cpp

@ -77,12 +77,12 @@ QMap<QString, QMap<QString, RequestHandler::Action> > RequestHandler::initialize
ADD_ACTION(public, logout); ADD_ACTION(public, logout);
ADD_ACTION(public, theme); ADD_ACTION(public, theme);
ADD_ACTION(public, images); ADD_ACTION(public, images);
ADD_ACTION(json, torrents); ADD_ACTION(query, torrents);
ADD_ACTION(json, preferences); ADD_ACTION(query, preferences);
ADD_ACTION(json, transferInfo); ADD_ACTION(query, transferInfo);
ADD_ACTION(json, propertiesGeneral); ADD_ACTION(query, propertiesGeneral);
ADD_ACTION(json, propertiesTrackers); ADD_ACTION(query, propertiesTrackers);
ADD_ACTION(json, propertiesFiles); ADD_ACTION(query, propertiesFiles);
ADD_ACTION(sync, maindata); ADD_ACTION(sync, maindata);
ADD_ACTION(command, shutdown); ADD_ACTION(command, shutdown);
ADD_ACTION(command, download); ADD_ACTION(command, download);
@ -222,7 +222,7 @@ void RequestHandler::action_public_images()
// - reverse (bool): enable reverse sorting // - reverse (bool): enable reverse sorting
// - limit (int): set limit number of torrents returned (if greater than 0, otherwise - unlimited) // - limit (int): set limit number of torrents returned (if greater than 0, otherwise - unlimited)
// - 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_query_torrents()
{ {
CHECK_URI(0); CHECK_URI(0);
const QStringMap& gets = request().gets; const QStringMap& gets = request().gets;
@ -233,31 +233,31 @@ void RequestHandler::action_json_torrents()
), CONTENT_TYPE_JS); ), CONTENT_TYPE_JS);
} }
void RequestHandler::action_json_preferences() void RequestHandler::action_query_preferences()
{ {
CHECK_URI(0); CHECK_URI(0);
print(prefjson::getPreferences(), CONTENT_TYPE_JS); print(prefjson::getPreferences(), CONTENT_TYPE_JS);
} }
void RequestHandler::action_json_transferInfo() void RequestHandler::action_query_transferInfo()
{ {
CHECK_URI(0); CHECK_URI(0);
print(btjson::getTransferInfo(), CONTENT_TYPE_JS); print(btjson::getTransferInfo(), CONTENT_TYPE_JS);
} }
void RequestHandler::action_json_propertiesGeneral() void RequestHandler::action_query_propertiesGeneral()
{ {
CHECK_URI(1); CHECK_URI(1);
print(btjson::getPropertiesForTorrent(args_.front()), CONTENT_TYPE_JS); print(btjson::getPropertiesForTorrent(args_.front()), CONTENT_TYPE_JS);
} }
void RequestHandler::action_json_propertiesTrackers() void RequestHandler::action_query_propertiesTrackers()
{ {
CHECK_URI(1); CHECK_URI(1);
print(btjson::getTrackersForTorrent(args_.front()), CONTENT_TYPE_JS); print(btjson::getTrackersForTorrent(args_.front()), CONTENT_TYPE_JS);
} }
void RequestHandler::action_json_propertiesFiles() void RequestHandler::action_query_propertiesFiles()
{ {
CHECK_URI(1); CHECK_URI(1);
print(btjson::getFilesForTorrent(args_.front()), CONTENT_TYPE_JS); print(btjson::getFilesForTorrent(args_.front()), CONTENT_TYPE_JS);

12
src/webui/requesthandler.h

@ -50,12 +50,12 @@ private:
void action_public_logout(); void action_public_logout();
void action_public_theme(); void action_public_theme();
void action_public_images(); void action_public_images();
void action_json_torrents(); void action_query_torrents();
void action_json_preferences(); void action_query_preferences();
void action_json_transferInfo(); void action_query_transferInfo();
void action_json_propertiesGeneral(); void action_query_propertiesGeneral();
void action_json_propertiesTrackers(); void action_query_propertiesTrackers();
void action_json_propertiesFiles(); void action_query_propertiesFiles();
void action_sync_maindata(); void action_sync_maindata();
void action_command_shutdown(); void action_command_shutdown();
void action_command_download(); void action_command_download();

2
src/webui/www/public/preferences_content.html

@ -642,7 +642,7 @@ time_padding = function(val) {
} }
loadPreferences = function() { loadPreferences = function() {
var url = 'json/preferences'; var url = 'query/preferences';
var request = new Request.JSON({ var request = new Request.JSON({
url: url, url: url,
method: 'get', method: 'get',

2
src/webui/www/public/scripts/prop-files.js

@ -289,7 +289,7 @@ var loadTorrentFilesData = function() {
fTable.removeAllRows(); fTable.removeAllRows();
current_hash = new_hash; current_hash = new_hash;
} }
var url = 'json/propertiesFiles/' + current_hash; var url = 'query/propertiesFiles/' + current_hash;
var request = new Request.JSON({ var request = new Request.JSON({
url: url, url: url,
noCache: true, noCache: true,

2
src/webui/www/public/scripts/prop-general.js

@ -29,7 +29,7 @@ var loadTorrentData = function() {
} }
// Display hash // Display hash
$('torrent_hash').set('html', current_hash); $('torrent_hash').set('html', current_hash);
var url = 'json/propertiesGeneral/' + current_hash; var url = 'query/propertiesGeneral/' + current_hash;
var request = new Request.JSON({ var request = new Request.JSON({
url: url, url: url,
noCache: true, noCache: true,

2
src/webui/www/public/scripts/prop-trackers.js

@ -69,7 +69,7 @@ var loadTrackersData = function() {
tTable.removeAllRows(); tTable.removeAllRows();
current_hash = new_hash; current_hash = new_hash;
} }
var url = 'json/propertiesTrackers/' + current_hash; var url = 'query/propertiesTrackers/' + current_hash;
var request = new Request.JSON({ var request = new Request.JSON({
url: url, url: url,
noCache: true, noCache: true,

Loading…
Cancel
Save