mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 07:27:22 -06:00
committed by
GitHub
parent
41a38428fc
commit
f8a304abdc
@@ -39,6 +39,7 @@
|
||||
#include <QSet>
|
||||
#include <QTranslator>
|
||||
|
||||
#include "base/applicationcomponent.h"
|
||||
#include "base/global.h"
|
||||
#include "base/http/irequesthandler.h"
|
||||
#include "base/http/responsebuilder.h"
|
||||
@@ -54,10 +55,10 @@ class APIController;
|
||||
class AuthController;
|
||||
class WebApplication;
|
||||
|
||||
class WebSession final : public QObject, public ISession
|
||||
class WebSession final : public QObject, public ApplicationComponent, public ISession
|
||||
{
|
||||
public:
|
||||
explicit WebSession(const QString &sid);
|
||||
explicit WebSession(const QString &sid, IApplication *app);
|
||||
|
||||
QString id() const override;
|
||||
|
||||
@@ -68,7 +69,7 @@ public:
|
||||
void registerAPIController(const QString &scope)
|
||||
{
|
||||
static_assert(std::is_base_of_v<APIController, T>, "Class should be derived from APIController.");
|
||||
m_apiControllers[scope] = new T(this);
|
||||
m_apiControllers[scope] = new T(app(), this);
|
||||
}
|
||||
|
||||
APIController *getAPIController(const QString &scope) const;
|
||||
@@ -80,14 +81,15 @@ private:
|
||||
};
|
||||
|
||||
class WebApplication final
|
||||
: public QObject, public Http::IRequestHandler, public ISessionManager
|
||||
: public QObject, public ApplicationComponent
|
||||
, public Http::IRequestHandler, public ISessionManager
|
||||
, private Http::ResponseBuilder
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(WebApplication)
|
||||
|
||||
public:
|
||||
explicit WebApplication(QObject *parent = nullptr);
|
||||
explicit WebApplication(IApplication *app, QObject *parent = nullptr);
|
||||
~WebApplication() override;
|
||||
|
||||
Http::Response processRequest(const Http::Request &request, const Http::Environment &env) override;
|
||||
|
||||
Reference in New Issue
Block a user