mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Fix Legacy Web API to be fully available
This commit is contained in:
parent
1c2d9c1fe4
commit
34456a7459
@ -280,7 +280,6 @@ void WebApplication::doProcessRequest()
|
|||||||
{"query/preferences", {"app", "preferences"}},
|
{"query/preferences", {"app", "preferences"}},
|
||||||
{"command/setPreferences", {"app", "setPreferences"}},
|
{"command/setPreferences", {"app", "setPreferences"}},
|
||||||
{"command/getSavePath", {"app", "defaultSavePath"}},
|
{"command/getSavePath", {"app", "defaultSavePath"}},
|
||||||
{"version/qbittorrent", {"app", "version"}},
|
|
||||||
|
|
||||||
{"query/getLog", {"log", "main"}},
|
{"query/getLog", {"log", "main"}},
|
||||||
{"query/getPeerLog", {"log", "peers"}},
|
{"query/getPeerLog", {"log", "peers"}},
|
||||||
@ -343,7 +342,8 @@ void WebApplication::doProcessRequest()
|
|||||||
(*params)["deleteFiles"] = "true";
|
(*params)["deleteFiles"] = "true";
|
||||||
|
|
||||||
const QString hash {match.captured(QLatin1String("hash"))};
|
const QString hash {match.captured(QLatin1String("hash"))};
|
||||||
(*params)[QLatin1String("hash")] = hash;
|
if (!hash.isEmpty())
|
||||||
|
(*params)[QLatin1String("hash")] = hash;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -354,12 +354,17 @@ void WebApplication::doProcessRequest()
|
|||||||
APIController *controller = m_apiControllers.value(scope);
|
APIController *controller = m_apiControllers.value(scope);
|
||||||
if (!controller) {
|
if (!controller) {
|
||||||
if (request().path == QLatin1String("/version/api")) {
|
if (request().path == QLatin1String("/version/api")) {
|
||||||
print(QString(COMPAT_API_VERSION), Http::CONTENT_TYPE_TXT);
|
print(QString::number(COMPAT_API_VERSION), Http::CONTENT_TYPE_TXT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request().path == QLatin1String("/version/api_min")) {
|
if (request().path == QLatin1String("/version/api_min")) {
|
||||||
print(QString(COMPAT_API_VERSION_MIN), Http::CONTENT_TYPE_TXT);
|
print(QString::number(COMPAT_API_VERSION_MIN), Http::CONTENT_TYPE_TXT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request().path == QLatin1String("/version/qbittorrent")) {
|
||||||
|
print(QString(QBT_VERSION), Http::CONTENT_TYPE_TXT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ private:
|
|||||||
Http::Environment m_env;
|
Http::Environment m_env;
|
||||||
|
|
||||||
const QRegularExpression m_apiPathPattern {(QLatin1String("^/api/v2/(?<scope>[A-Za-z_][A-Za-z_0-9]*)/(?<action>[A-Za-z_][A-Za-z_0-9]*)$"))};
|
const QRegularExpression m_apiPathPattern {(QLatin1String("^/api/v2/(?<scope>[A-Za-z_][A-Za-z_0-9]*)/(?<action>[A-Za-z_][A-Za-z_0-9]*)$"))};
|
||||||
const QRegularExpression m_apiLegacyPathPattern {QLatin1String("^/(?<action>((sync|control|query)/[A-Za-z_][A-Za-z_0-9]*|login|logout))(/(?<hash>[^/]+))?$")};
|
const QRegularExpression m_apiLegacyPathPattern {QLatin1String("^/(?<action>((sync|command|query)/[A-Za-z_][A-Za-z_0-9]*|login|logout))(/(?<hash>[^/]+))?$")};
|
||||||
|
|
||||||
QHash<QString, APIController *> m_apiControllers;
|
QHash<QString, APIController *> m_apiControllers;
|
||||||
QSet<QString> m_publicAPIs;
|
QSet<QString> m_publicAPIs;
|
||||||
|
Loading…
Reference in New Issue
Block a user