mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 02:27:09 -07:00
parent
41a38428fc
commit
f8a304abdc
28 changed files with 256 additions and 69 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue