mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-13 00:33:09 -07:00
parent
1cb6173ad1
commit
0c48b70e5b
13 changed files with 215 additions and 17 deletions
|
@ -2,6 +2,7 @@ add_library(qbt_webui STATIC
|
||||||
# headers
|
# headers
|
||||||
api/apicontroller.h
|
api/apicontroller.h
|
||||||
api/apierror.h
|
api/apierror.h
|
||||||
|
api/apistatus.h
|
||||||
api/appcontroller.h
|
api/appcontroller.h
|
||||||
api/authcontroller.h
|
api/authcontroller.h
|
||||||
api/isessionmanager.h
|
api/isessionmanager.h
|
||||||
|
|
|
@ -42,6 +42,7 @@ void APIResult::clear()
|
||||||
data.clear();
|
data.clear();
|
||||||
mimeType.clear();
|
mimeType.clear();
|
||||||
filename.clear();
|
filename.clear();
|
||||||
|
status = APIStatus::Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
APIController::APIController(IApplication *app, QObject *parent)
|
APIController::APIController(IApplication *app, QObject *parent)
|
||||||
|
@ -105,3 +106,8 @@ void APIController::setResult(const QByteArray &result, const QString &mimeType,
|
||||||
m_result.mimeType = mimeType;
|
m_result.mimeType = mimeType;
|
||||||
m_result.filename = filename;
|
m_result.filename = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void APIController::setStatus(const APIStatus status)
|
||||||
|
{
|
||||||
|
m_result.status = status;
|
||||||
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
#include "base/applicationcomponent.h"
|
#include "base/applicationcomponent.h"
|
||||||
|
#include "apistatus.h"
|
||||||
|
|
||||||
using DataMap = QHash<QString, QByteArray>;
|
using DataMap = QHash<QString, QByteArray>;
|
||||||
using StringMap = QHash<QString, QString>;
|
using StringMap = QHash<QString, QString>;
|
||||||
|
@ -43,6 +44,7 @@ struct APIResult
|
||||||
QVariant data;
|
QVariant data;
|
||||||
QString mimeType;
|
QString mimeType;
|
||||||
QString filename;
|
QString filename;
|
||||||
|
APIStatus status = APIStatus::Ok;
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
};
|
};
|
||||||
|
@ -67,6 +69,8 @@ protected:
|
||||||
void setResult(const QJsonObject &result);
|
void setResult(const QJsonObject &result);
|
||||||
void setResult(const QByteArray &result, const QString &mimeType = {}, const QString &filename = {});
|
void setResult(const QByteArray &result, const QString &mimeType = {}, const QString &filename = {});
|
||||||
|
|
||||||
|
void setStatus(APIStatus status);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StringMap m_params;
|
StringMap m_params;
|
||||||
DataMap m_data;
|
DataMap m_data;
|
||||||
|
|
35
src/webui/api/apistatus.h
Normal file
35
src/webui/api/apistatus.h
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* Bittorrent Client using Qt and libtorrent.
|
||||||
|
* Copyright (C) 2024 Thomas Piccirello <thomas@piccirello.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* In addition, as a special exception, the copyright holders give permission to
|
||||||
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||||
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||||
|
* and distribute the linked executables. You must obey the GNU General Public
|
||||||
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||||
|
* modify file(s), you may extend this exception to your version of the file(s),
|
||||||
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||||
|
* exception statement from your version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
enum class APIStatus
|
||||||
|
{
|
||||||
|
Ok,
|
||||||
|
Async
|
||||||
|
};
|
|
@ -123,6 +123,7 @@ void AppController::shutdownAction()
|
||||||
{
|
{
|
||||||
QCoreApplication::exit();
|
QCoreApplication::exit();
|
||||||
});
|
});
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppController::preferencesAction()
|
void AppController::preferencesAction()
|
||||||
|
@ -1167,6 +1168,8 @@ void AppController::setPreferencesAction()
|
||||||
|
|
||||||
// Save preferences
|
// Save preferences
|
||||||
pref->apply();
|
pref->apply();
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppController::defaultSavePathAction()
|
void AppController::defaultSavePathAction()
|
||||||
|
@ -1177,9 +1180,9 @@ void AppController::defaultSavePathAction()
|
||||||
void AppController::sendTestEmailAction()
|
void AppController::sendTestEmailAction()
|
||||||
{
|
{
|
||||||
app()->sendTestEmail();
|
app()->sendTestEmail();
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AppController::getDirectoryContentAction()
|
void AppController::getDirectoryContentAction()
|
||||||
{
|
{
|
||||||
requireParams({u"dirPath"_s});
|
requireParams({u"dirPath"_s});
|
||||||
|
@ -1269,6 +1272,8 @@ void AppController::setCookiesAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
Net::DownloadManager::instance()->setAllCookies(cookies);
|
Net::DownloadManager::instance()->setAllCookies(cookies);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppController::networkInterfaceListAction()
|
void AppController::networkInterfaceListAction()
|
||||||
|
|
|
@ -46,11 +46,13 @@ AuthController::AuthController(ISessionManager *sessionManager, IApplication *ap
|
||||||
void AuthController::setUsername(const QString &username)
|
void AuthController::setUsername(const QString &username)
|
||||||
{
|
{
|
||||||
m_username = username;
|
m_username = username;
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuthController::setPasswordHash(const QByteArray &passwordHash)
|
void AuthController::setPasswordHash(const QByteArray &passwordHash)
|
||||||
{
|
{
|
||||||
m_passwordHash = passwordHash;
|
m_passwordHash = passwordHash;
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuthController::loginAction()
|
void AuthController::loginAction()
|
||||||
|
@ -96,9 +98,10 @@ void AuthController::loginAction()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuthController::logoutAction() const
|
void AuthController::logoutAction()
|
||||||
{
|
{
|
||||||
m_sessionManager->sessionEnd();
|
m_sessionManager->sessionEnd();
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AuthController::isBanned() const
|
bool AuthController::isBanned() const
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void loginAction();
|
void loginAction();
|
||||||
void logoutAction() const;
|
void logoutAction();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isBanned() const;
|
bool isBanned() const;
|
||||||
|
|
|
@ -53,6 +53,8 @@ void RSSController::addFolderAction()
|
||||||
const nonstd::expected<RSS::Folder *, QString> result = RSS::Session::instance()->addFolder(path);
|
const nonstd::expected<RSS::Folder *, QString> result = RSS::Session::instance()->addFolder(path);
|
||||||
if (!result)
|
if (!result)
|
||||||
throw APIError(APIErrorType::Conflict, result.error());
|
throw APIError(APIErrorType::Conflict, result.error());
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSSController::addFeedAction()
|
void RSSController::addFeedAction()
|
||||||
|
@ -65,6 +67,8 @@ void RSSController::addFeedAction()
|
||||||
const nonstd::expected<RSS::Feed *, QString> result = RSS::Session::instance()->addFeed(url, (path.isEmpty() ? url : path), std::chrono::seconds(refreshInterval));
|
const nonstd::expected<RSS::Feed *, QString> result = RSS::Session::instance()->addFeed(url, (path.isEmpty() ? url : path), std::chrono::seconds(refreshInterval));
|
||||||
if (!result)
|
if (!result)
|
||||||
throw APIError(APIErrorType::Conflict, result.error());
|
throw APIError(APIErrorType::Conflict, result.error());
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSSController::setFeedURLAction()
|
void RSSController::setFeedURLAction()
|
||||||
|
@ -76,6 +80,8 @@ void RSSController::setFeedURLAction()
|
||||||
const nonstd::expected<void, QString> result = RSS::Session::instance()->setFeedURL(path, url);
|
const nonstd::expected<void, QString> result = RSS::Session::instance()->setFeedURL(path, url);
|
||||||
if (!result)
|
if (!result)
|
||||||
throw APIError(APIErrorType::Conflict, result.error());
|
throw APIError(APIErrorType::Conflict, result.error());
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSSController::setFeedRefreshIntervalAction()
|
void RSSController::setFeedRefreshIntervalAction()
|
||||||
|
@ -103,6 +109,8 @@ void RSSController::removeItemAction()
|
||||||
const nonstd::expected<void, QString> result = RSS::Session::instance()->removeItem(path);
|
const nonstd::expected<void, QString> result = RSS::Session::instance()->removeItem(path);
|
||||||
if (!result)
|
if (!result)
|
||||||
throw APIError(APIErrorType::Conflict, result.error());
|
throw APIError(APIErrorType::Conflict, result.error());
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSSController::moveItemAction()
|
void RSSController::moveItemAction()
|
||||||
|
@ -114,6 +122,8 @@ void RSSController::moveItemAction()
|
||||||
const nonstd::expected<void, QString> result = RSS::Session::instance()->moveItem(itemPath, destPath);
|
const nonstd::expected<void, QString> result = RSS::Session::instance()->moveItem(itemPath, destPath);
|
||||||
if (!result)
|
if (!result)
|
||||||
throw APIError(APIErrorType::Conflict, result.error());
|
throw APIError(APIErrorType::Conflict, result.error());
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSSController::itemsAction()
|
void RSSController::itemsAction()
|
||||||
|
@ -148,6 +158,8 @@ void RSSController::markAsReadAction()
|
||||||
{
|
{
|
||||||
item->markAsRead();
|
item->markAsRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSSController::refreshItemAction()
|
void RSSController::refreshItemAction()
|
||||||
|
@ -158,6 +170,8 @@ void RSSController::refreshItemAction()
|
||||||
RSS::Item *item = RSS::Session::instance()->itemByPath(itemPath);
|
RSS::Item *item = RSS::Session::instance()->itemByPath(itemPath);
|
||||||
if (item)
|
if (item)
|
||||||
item->refresh();
|
item->refresh();
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSSController::setRuleAction()
|
void RSSController::setRuleAction()
|
||||||
|
@ -169,6 +183,8 @@ void RSSController::setRuleAction()
|
||||||
|
|
||||||
const auto jsonObj = QJsonDocument::fromJson(ruleDef).object();
|
const auto jsonObj = QJsonDocument::fromJson(ruleDef).object();
|
||||||
RSS::AutoDownloader::instance()->setRule(RSS::AutoDownloadRule::fromJsonObject(jsonObj, ruleName));
|
RSS::AutoDownloader::instance()->setRule(RSS::AutoDownloadRule::fromJsonObject(jsonObj, ruleName));
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSSController::renameRuleAction()
|
void RSSController::renameRuleAction()
|
||||||
|
@ -179,6 +195,8 @@ void RSSController::renameRuleAction()
|
||||||
const QString newRuleName {params()[u"newRuleName"_s]};
|
const QString newRuleName {params()[u"newRuleName"_s]};
|
||||||
|
|
||||||
RSS::AutoDownloader::instance()->renameRule(ruleName, newRuleName);
|
RSS::AutoDownloader::instance()->renameRule(ruleName, newRuleName);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSSController::removeRuleAction()
|
void RSSController::removeRuleAction()
|
||||||
|
@ -187,6 +205,8 @@ void RSSController::removeRuleAction()
|
||||||
|
|
||||||
const QString ruleName {params()[u"ruleName"_s]};
|
const QString ruleName {params()[u"ruleName"_s]};
|
||||||
RSS::AutoDownloader::instance()->removeRule(ruleName);
|
RSS::AutoDownloader::instance()->removeRule(ruleName);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSSController::rulesAction()
|
void RSSController::rulesAction()
|
||||||
|
|
|
@ -142,6 +142,8 @@ void SearchController::stopAction()
|
||||||
searchHandler->cancelSearch();
|
searchHandler->cancelSearch();
|
||||||
m_activeSearches.remove(id);
|
m_activeSearches.remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchController::statusAction()
|
void SearchController::statusAction()
|
||||||
|
@ -215,6 +217,8 @@ void SearchController::deleteAction()
|
||||||
searchHandler->cancelSearch();
|
searchHandler->cancelSearch();
|
||||||
m_activeSearches.remove(id);
|
m_activeSearches.remove(id);
|
||||||
m_searchHandlers.erase(iter);
|
m_searchHandlers.erase(iter);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchController::downloadTorrentAction()
|
void SearchController::downloadTorrentAction()
|
||||||
|
@ -238,6 +242,8 @@ void SearchController::downloadTorrentAction()
|
||||||
downloadHandler->deleteLater();
|
downloadHandler->deleteLater();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchController::pluginsAction()
|
void SearchController::pluginsAction()
|
||||||
|
@ -253,6 +259,8 @@ void SearchController::installPluginAction()
|
||||||
const QStringList sources = params()[u"sources"_s].split(u'|');
|
const QStringList sources = params()[u"sources"_s].split(u'|');
|
||||||
for (const QString &source : sources)
|
for (const QString &source : sources)
|
||||||
SearchPluginManager::instance()->installPlugin(source);
|
SearchPluginManager::instance()->installPlugin(source);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchController::uninstallPluginAction()
|
void SearchController::uninstallPluginAction()
|
||||||
|
@ -262,6 +270,8 @@ void SearchController::uninstallPluginAction()
|
||||||
const QStringList names = params()[u"names"_s].split(u'|');
|
const QStringList names = params()[u"names"_s].split(u'|');
|
||||||
for (const QString &name : names)
|
for (const QString &name : names)
|
||||||
SearchPluginManager::instance()->uninstallPlugin(name.trimmed());
|
SearchPluginManager::instance()->uninstallPlugin(name.trimmed());
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchController::enablePluginAction()
|
void SearchController::enablePluginAction()
|
||||||
|
@ -273,6 +283,8 @@ void SearchController::enablePluginAction()
|
||||||
|
|
||||||
for (const QString &name : names)
|
for (const QString &name : names)
|
||||||
SearchPluginManager::instance()->enablePlugin(name.trimmed(), enable);
|
SearchPluginManager::instance()->enablePlugin(name.trimmed(), enable);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchController::updatePluginsAction()
|
void SearchController::updatePluginsAction()
|
||||||
|
@ -282,6 +294,8 @@ void SearchController::updatePluginsAction()
|
||||||
connect(pluginManager, &SearchPluginManager::checkForUpdatesFinished, this, &SearchController::checkForUpdatesFinished);
|
connect(pluginManager, &SearchPluginManager::checkForUpdatesFinished, this, &SearchController::checkForUpdatesFinished);
|
||||||
connect(pluginManager, &SearchPluginManager::checkForUpdatesFailed, this, &SearchController::checkForUpdatesFailed);
|
connect(pluginManager, &SearchPluginManager::checkForUpdatesFailed, this, &SearchController::checkForUpdatesFailed);
|
||||||
pluginManager->checkForUpdates();
|
pluginManager->checkForUpdates();
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchController::checkForUpdatesFinished(const QHash<QString, PluginVersion> &updateInfo)
|
void SearchController::checkForUpdatesFinished(const QHash<QString, PluginVersion> &updateInfo)
|
||||||
|
@ -300,6 +314,8 @@ void SearchController::checkForUpdatesFinished(const QHash<QString, PluginVersio
|
||||||
LogMsg(tr("Updating plugin %1").arg(pluginName), Log::INFO);
|
LogMsg(tr("Updating plugin %1").arg(pluginName), Log::INFO);
|
||||||
pluginManager->updatePlugin(pluginName);
|
pluginManager->updatePlugin(pluginName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchController::checkForUpdatesFailed(const QString &reason)
|
void SearchController::checkForUpdatesFailed(const QString &reason)
|
||||||
|
|
|
@ -256,4 +256,6 @@ void TorrentCreatorController::deleteTaskAction()
|
||||||
|
|
||||||
if (!m_torrentCreationManager->deleteTask(id))
|
if (!m_torrentCreationManager->deleteTask(id))
|
||||||
throw APIError(APIErrorType::NotFound);
|
throw APIError(APIErrorType::NotFound);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -670,6 +670,8 @@ void TorrentsController::addWebSeedsAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
torrent->addUrlSeeds(urls);
|
torrent->addUrlSeeds(urls);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::editWebSeedAction()
|
void TorrentsController::editWebSeedAction()
|
||||||
|
@ -702,6 +704,8 @@ void TorrentsController::editWebSeedAction()
|
||||||
torrent->removeUrlSeeds({origUrl});
|
torrent->removeUrlSeeds({origUrl});
|
||||||
torrent->addUrlSeeds({newUrl});
|
torrent->addUrlSeeds({newUrl});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::removeWebSeedsAction()
|
void TorrentsController::removeWebSeedsAction()
|
||||||
|
@ -725,6 +729,8 @@ void TorrentsController::removeWebSeedsAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
torrent->removeUrlSeeds(urls);
|
torrent->removeUrlSeeds(urls);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the files in a torrent in JSON format.
|
// Returns the files in a torrent in JSON format.
|
||||||
|
@ -939,6 +945,8 @@ void TorrentsController::addTrackersAction()
|
||||||
|
|
||||||
const QList<BitTorrent::TrackerEntry> entries = BitTorrent::parseTrackerEntries(params()[u"urls"_s]);
|
const QList<BitTorrent::TrackerEntry> entries = BitTorrent::parseTrackerEntries(params()[u"urls"_s]);
|
||||||
torrent->addTrackers(entries);
|
torrent->addTrackers(entries);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::editTrackerAction()
|
void TorrentsController::editTrackerAction()
|
||||||
|
@ -992,6 +1000,8 @@ void TorrentsController::editTrackerAction()
|
||||||
|
|
||||||
if (!torrent->isStopped())
|
if (!torrent->isStopped())
|
||||||
torrent->forceReannounce();
|
torrent->forceReannounce();
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::removeTrackersAction()
|
void TorrentsController::removeTrackersAction()
|
||||||
|
@ -1026,6 +1036,8 @@ void TorrentsController::removeTrackersAction()
|
||||||
|
|
||||||
for (BitTorrent::Torrent *const torrent : asConst(torrents))
|
for (BitTorrent::Torrent *const torrent : asConst(torrents))
|
||||||
torrent->removeTrackers(urls);
|
torrent->removeTrackers(urls);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::addPeersAction()
|
void TorrentsController::addPeersAction()
|
||||||
|
@ -1072,6 +1084,8 @@ void TorrentsController::stopAction()
|
||||||
|
|
||||||
const QStringList hashes = params()[u"hashes"_s].split(u'|');
|
const QStringList hashes = params()[u"hashes"_s].split(u'|');
|
||||||
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->stop(); });
|
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->stop(); });
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::startAction()
|
void TorrentsController::startAction()
|
||||||
|
@ -1080,6 +1094,8 @@ void TorrentsController::startAction()
|
||||||
|
|
||||||
const QStringList idStrings = params()[u"hashes"_s].split(u'|');
|
const QStringList idStrings = params()[u"hashes"_s].split(u'|');
|
||||||
applyToTorrents(idStrings, [](BitTorrent::Torrent *const torrent) { torrent->start(); });
|
applyToTorrents(idStrings, [](BitTorrent::Torrent *const torrent) { torrent->start(); });
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::filePrioAction()
|
void TorrentsController::filePrioAction()
|
||||||
|
@ -1121,6 +1137,8 @@ void TorrentsController::filePrioAction()
|
||||||
|
|
||||||
if (priorityChanged)
|
if (priorityChanged)
|
||||||
torrent->prioritizeFiles(priorities);
|
torrent->prioritizeFiles(priorities);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::uploadLimitAction()
|
void TorrentsController::uploadLimitAction()
|
||||||
|
@ -1169,6 +1187,8 @@ void TorrentsController::setUploadLimitAction()
|
||||||
|
|
||||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||||
applyToTorrents(hashes, [limit](BitTorrent::Torrent *const torrent) { torrent->setUploadLimit(limit); });
|
applyToTorrents(hashes, [limit](BitTorrent::Torrent *const torrent) { torrent->setUploadLimit(limit); });
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::setDownloadLimitAction()
|
void TorrentsController::setDownloadLimitAction()
|
||||||
|
@ -1181,6 +1201,8 @@ void TorrentsController::setDownloadLimitAction()
|
||||||
|
|
||||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||||
applyToTorrents(hashes, [limit](BitTorrent::Torrent *const torrent) { torrent->setDownloadLimit(limit); });
|
applyToTorrents(hashes, [limit](BitTorrent::Torrent *const torrent) { torrent->setDownloadLimit(limit); });
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::setShareLimitsAction()
|
void TorrentsController::setShareLimitsAction()
|
||||||
|
@ -1198,6 +1220,8 @@ void TorrentsController::setShareLimitsAction()
|
||||||
torrent->setSeedingTimeLimit(seedingTimeLimit);
|
torrent->setSeedingTimeLimit(seedingTimeLimit);
|
||||||
torrent->setInactiveSeedingTimeLimit(inactiveSeedingTimeLimit);
|
torrent->setInactiveSeedingTimeLimit(inactiveSeedingTimeLimit);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::toggleSequentialDownloadAction()
|
void TorrentsController::toggleSequentialDownloadAction()
|
||||||
|
@ -1206,6 +1230,8 @@ void TorrentsController::toggleSequentialDownloadAction()
|
||||||
|
|
||||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||||
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->toggleSequentialDownload(); });
|
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->toggleSequentialDownload(); });
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::toggleFirstLastPiecePrioAction()
|
void TorrentsController::toggleFirstLastPiecePrioAction()
|
||||||
|
@ -1214,6 +1240,8 @@ void TorrentsController::toggleFirstLastPiecePrioAction()
|
||||||
|
|
||||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||||
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->toggleFirstLastPiecePriority(); });
|
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->toggleFirstLastPiecePriority(); });
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::setSuperSeedingAction()
|
void TorrentsController::setSuperSeedingAction()
|
||||||
|
@ -1223,6 +1251,8 @@ void TorrentsController::setSuperSeedingAction()
|
||||||
const bool value {parseBool(params()[u"value"_s]).value_or(false)};
|
const bool value {parseBool(params()[u"value"_s]).value_or(false)};
|
||||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||||
applyToTorrents(hashes, [value](BitTorrent::Torrent *const torrent) { torrent->setSuperSeeding(value); });
|
applyToTorrents(hashes, [value](BitTorrent::Torrent *const torrent) { torrent->setSuperSeeding(value); });
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::setForceStartAction()
|
void TorrentsController::setForceStartAction()
|
||||||
|
@ -1235,6 +1265,8 @@ void TorrentsController::setForceStartAction()
|
||||||
{
|
{
|
||||||
torrent->start(value ? BitTorrent::TorrentOperatingMode::Forced : BitTorrent::TorrentOperatingMode::AutoManaged);
|
torrent->start(value ? BitTorrent::TorrentOperatingMode::Forced : BitTorrent::TorrentOperatingMode::AutoManaged);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::deleteAction()
|
void TorrentsController::deleteAction()
|
||||||
|
@ -1248,6 +1280,8 @@ void TorrentsController::deleteAction()
|
||||||
{
|
{
|
||||||
BitTorrent::Session::instance()->removeTorrent(torrent->id(), deleteOption);
|
BitTorrent::Session::instance()->removeTorrent(torrent->id(), deleteOption);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::increasePrioAction()
|
void TorrentsController::increasePrioAction()
|
||||||
|
@ -1259,6 +1293,8 @@ void TorrentsController::increasePrioAction()
|
||||||
|
|
||||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||||
BitTorrent::Session::instance()->increaseTorrentsQueuePos(toTorrentIDs(hashes));
|
BitTorrent::Session::instance()->increaseTorrentsQueuePos(toTorrentIDs(hashes));
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::decreasePrioAction()
|
void TorrentsController::decreasePrioAction()
|
||||||
|
@ -1270,6 +1306,8 @@ void TorrentsController::decreasePrioAction()
|
||||||
|
|
||||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||||
BitTorrent::Session::instance()->decreaseTorrentsQueuePos(toTorrentIDs(hashes));
|
BitTorrent::Session::instance()->decreaseTorrentsQueuePos(toTorrentIDs(hashes));
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::topPrioAction()
|
void TorrentsController::topPrioAction()
|
||||||
|
@ -1281,6 +1319,8 @@ void TorrentsController::topPrioAction()
|
||||||
|
|
||||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||||
BitTorrent::Session::instance()->topTorrentsQueuePos(toTorrentIDs(hashes));
|
BitTorrent::Session::instance()->topTorrentsQueuePos(toTorrentIDs(hashes));
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::bottomPrioAction()
|
void TorrentsController::bottomPrioAction()
|
||||||
|
@ -1292,6 +1332,8 @@ void TorrentsController::bottomPrioAction()
|
||||||
|
|
||||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||||
BitTorrent::Session::instance()->bottomTorrentsQueuePos(toTorrentIDs(hashes));
|
BitTorrent::Session::instance()->bottomTorrentsQueuePos(toTorrentIDs(hashes));
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::setLocationAction()
|
void TorrentsController::setLocationAction()
|
||||||
|
@ -1315,6 +1357,8 @@ void TorrentsController::setLocationAction()
|
||||||
torrent->setAutoTMMEnabled(false);
|
torrent->setAutoTMMEnabled(false);
|
||||||
torrent->setSavePath(newLocation);
|
torrent->setSavePath(newLocation);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::setSavePathAction()
|
void TorrentsController::setSavePathAction()
|
||||||
|
@ -1340,6 +1384,8 @@ void TorrentsController::setSavePathAction()
|
||||||
if (!torrent->isAutoTMMEnabled())
|
if (!torrent->isAutoTMMEnabled())
|
||||||
torrent->setSavePath(newPath);
|
torrent->setSavePath(newPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::setDownloadPathAction()
|
void TorrentsController::setDownloadPathAction()
|
||||||
|
@ -1365,6 +1411,8 @@ void TorrentsController::setDownloadPathAction()
|
||||||
if (!torrent->isAutoTMMEnabled())
|
if (!torrent->isAutoTMMEnabled())
|
||||||
torrent->setDownloadPath(newPath);
|
torrent->setDownloadPath(newPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::renameAction()
|
void TorrentsController::renameAction()
|
||||||
|
@ -1383,6 +1431,8 @@ void TorrentsController::renameAction()
|
||||||
|
|
||||||
name.replace(QRegularExpression(u"\r?\n|\r"_s), u" "_s);
|
name.replace(QRegularExpression(u"\r?\n|\r"_s), u" "_s);
|
||||||
torrent->setName(name);
|
torrent->setName(name);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::setAutoManagementAction()
|
void TorrentsController::setAutoManagementAction()
|
||||||
|
@ -1396,6 +1446,8 @@ void TorrentsController::setAutoManagementAction()
|
||||||
{
|
{
|
||||||
torrent->setAutoTMMEnabled(isEnabled);
|
torrent->setAutoTMMEnabled(isEnabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::recheckAction()
|
void TorrentsController::recheckAction()
|
||||||
|
@ -1404,6 +1456,8 @@ void TorrentsController::recheckAction()
|
||||||
|
|
||||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||||
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->forceRecheck(); });
|
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->forceRecheck(); });
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::reannounceAction()
|
void TorrentsController::reannounceAction()
|
||||||
|
@ -1412,6 +1466,8 @@ void TorrentsController::reannounceAction()
|
||||||
|
|
||||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||||
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->forceReannounce(); });
|
applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { torrent->forceReannounce(); });
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::setCategoryAction()
|
void TorrentsController::setCategoryAction()
|
||||||
|
@ -1426,6 +1482,8 @@ void TorrentsController::setCategoryAction()
|
||||||
if (!torrent->setCategory(category))
|
if (!torrent->setCategory(category))
|
||||||
throw APIError(APIErrorType::Conflict, tr("Incorrect category name"));
|
throw APIError(APIErrorType::Conflict, tr("Incorrect category name"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::createCategoryAction()
|
void TorrentsController::createCategoryAction()
|
||||||
|
@ -1451,6 +1509,8 @@ void TorrentsController::createCategoryAction()
|
||||||
|
|
||||||
if (!BitTorrent::Session::instance()->addCategory(category, categoryOptions))
|
if (!BitTorrent::Session::instance()->addCategory(category, categoryOptions))
|
||||||
throw APIError(APIErrorType::Conflict, tr("Unable to create category"));
|
throw APIError(APIErrorType::Conflict, tr("Unable to create category"));
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::editCategoryAction()
|
void TorrentsController::editCategoryAction()
|
||||||
|
@ -1473,6 +1533,8 @@ void TorrentsController::editCategoryAction()
|
||||||
|
|
||||||
if (!BitTorrent::Session::instance()->editCategory(category, categoryOptions))
|
if (!BitTorrent::Session::instance()->editCategory(category, categoryOptions))
|
||||||
throw APIError(APIErrorType::Conflict, tr("Unable to edit category"));
|
throw APIError(APIErrorType::Conflict, tr("Unable to edit category"));
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::removeCategoriesAction()
|
void TorrentsController::removeCategoriesAction()
|
||||||
|
@ -1482,6 +1544,8 @@ void TorrentsController::removeCategoriesAction()
|
||||||
const QStringList categories {params()[u"categories"_s].split(u'\n')};
|
const QStringList categories {params()[u"categories"_s].split(u'\n')};
|
||||||
for (const QString &category : categories)
|
for (const QString &category : categories)
|
||||||
BitTorrent::Session::instance()->removeCategory(category);
|
BitTorrent::Session::instance()->removeCategory(category);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::categoriesAction()
|
void TorrentsController::categoriesAction()
|
||||||
|
@ -1517,6 +1581,8 @@ void TorrentsController::addTagsAction()
|
||||||
torrent->addTag(Tag(tagStr));
|
torrent->addTag(Tag(tagStr));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::setTagsAction()
|
void TorrentsController::setTagsAction()
|
||||||
|
@ -1562,6 +1628,8 @@ void TorrentsController::removeTagsAction()
|
||||||
torrent->removeAllTags();
|
torrent->removeAllTags();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::createTagsAction()
|
void TorrentsController::createTagsAction()
|
||||||
|
@ -1572,6 +1640,8 @@ void TorrentsController::createTagsAction()
|
||||||
|
|
||||||
for (const QString &tagStr : tags)
|
for (const QString &tagStr : tags)
|
||||||
BitTorrent::Session::instance()->addTag(Tag(tagStr));
|
BitTorrent::Session::instance()->addTag(Tag(tagStr));
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::deleteTagsAction()
|
void TorrentsController::deleteTagsAction()
|
||||||
|
@ -1581,6 +1651,8 @@ void TorrentsController::deleteTagsAction()
|
||||||
const QStringList tags {params()[u"tags"_s].split(u',', Qt::SkipEmptyParts)};
|
const QStringList tags {params()[u"tags"_s].split(u',', Qt::SkipEmptyParts)};
|
||||||
for (const QString &tagStr : tags)
|
for (const QString &tagStr : tags)
|
||||||
BitTorrent::Session::instance()->removeTag(Tag(tagStr));
|
BitTorrent::Session::instance()->removeTag(Tag(tagStr));
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::tagsAction()
|
void TorrentsController::tagsAction()
|
||||||
|
@ -1611,6 +1683,8 @@ void TorrentsController::renameFileAction()
|
||||||
{
|
{
|
||||||
throw APIError(APIErrorType::Conflict, error.message());
|
throw APIError(APIErrorType::Conflict, error.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::renameFolderAction()
|
void TorrentsController::renameFolderAction()
|
||||||
|
@ -1633,6 +1707,8 @@ void TorrentsController::renameFolderAction()
|
||||||
{
|
{
|
||||||
throw APIError(APIErrorType::Conflict, error.message());
|
throw APIError(APIErrorType::Conflict, error.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentsController::exportAction()
|
void TorrentsController::exportAction()
|
||||||
|
@ -1689,4 +1765,6 @@ void TorrentsController::setSSLParametersAction()
|
||||||
throw APIError(APIErrorType::BadData);
|
throw APIError(APIErrorType::BadData);
|
||||||
|
|
||||||
torrent->setSSLParameters(sslParams);
|
torrent->setSSLParameters(sslParams);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,8 @@ void TransferController::setUploadLimitAction()
|
||||||
if (limit == 0) limit = -1;
|
if (limit == 0) limit = -1;
|
||||||
|
|
||||||
BitTorrent::Session::instance()->setUploadSpeedLimit(limit);
|
BitTorrent::Session::instance()->setUploadSpeedLimit(limit);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferController::setDownloadLimitAction()
|
void TransferController::setDownloadLimitAction()
|
||||||
|
@ -113,12 +115,16 @@ void TransferController::setDownloadLimitAction()
|
||||||
if (limit == 0) limit = -1;
|
if (limit == 0) limit = -1;
|
||||||
|
|
||||||
BitTorrent::Session::instance()->setDownloadSpeedLimit(limit);
|
BitTorrent::Session::instance()->setDownloadSpeedLimit(limit);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferController::toggleSpeedLimitsModeAction()
|
void TransferController::toggleSpeedLimitsModeAction()
|
||||||
{
|
{
|
||||||
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
BitTorrent::Session *const session = BitTorrent::Session::instance();
|
||||||
session->setAltGlobalSpeedLimitEnabled(!session->isAltGlobalSpeedLimitEnabled());
|
session->setAltGlobalSpeedLimitEnabled(!session->isAltGlobalSpeedLimitEnabled());
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferController::speedLimitsModeAction()
|
void TransferController::speedLimitsModeAction()
|
||||||
|
@ -136,6 +142,8 @@ void TransferController::setSpeedLimitsModeAction()
|
||||||
|
|
||||||
// Any non-zero values are considered as alternative mode
|
// Any non-zero values are considered as alternative mode
|
||||||
BitTorrent::Session::instance()->setAltGlobalSpeedLimitEnabled(mode != 0);
|
BitTorrent::Session::instance()->setAltGlobalSpeedLimitEnabled(mode != 0);
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferController::banPeersAction()
|
void TransferController::banPeersAction()
|
||||||
|
@ -149,4 +157,6 @@ void TransferController::banPeersAction()
|
||||||
if (!addr.ip.isNull())
|
if (!addr.ip.isNull())
|
||||||
BitTorrent::Session::instance()->banIP(addr.ip.toString());
|
BitTorrent::Session::instance()->banIP(addr.ip.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setResult(QString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,6 +361,12 @@ void WebApplication::doProcessRequest()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const APIResult result = controller->run(action, m_params, data);
|
const APIResult result = controller->run(action, m_params, data);
|
||||||
|
if (result.data.isNull())
|
||||||
|
{
|
||||||
|
status(204);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
switch (result.data.userType())
|
switch (result.data.userType())
|
||||||
{
|
{
|
||||||
case QMetaType::QJsonDocument:
|
case QMetaType::QJsonDocument:
|
||||||
|
@ -381,6 +387,18 @@ void WebApplication::doProcessRequest()
|
||||||
print(result.data.toString(), Http::CONTENT_TYPE_TXT);
|
print(result.data.toString(), Http::CONTENT_TYPE_TXT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (result.status)
|
||||||
|
{
|
||||||
|
case APIStatus::Async:
|
||||||
|
status(202);
|
||||||
|
break;
|
||||||
|
case APIStatus::Ok:
|
||||||
|
default:
|
||||||
|
status(200);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (const APIError &error)
|
catch (const APIError &error)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue