Implement base classes for application components

PR #17219.
This commit is contained in:
Vladimir Golovnev 2022-06-25 15:46:55 +03:00 committed by GitHub
parent 41a38428fc
commit f8a304abdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 256 additions and 69 deletions

View file

@ -116,10 +116,11 @@ namespace
}
}
WebApplication::WebApplication(QObject *parent)
WebApplication::WebApplication(IApplication *app, QObject *parent)
: QObject(parent)
, ApplicationComponent(app)
, m_cacheID {QString::number(Utils::Random::rand(), 36)}
, m_authController {new AuthController(this, this)}
, m_authController {new AuthController(this, app, this)}
{
declarePublicAPI(u"auth/login"_qs);
@ -600,7 +601,7 @@ void WebApplication::sessionStart()
return false;
});
m_currentSession = new WebSession(generateSid());
m_currentSession = new WebSession(generateSid(), app());
m_currentSession->registerAPIController<AppController>(u"app"_qs);
m_currentSession->registerAPIController<LogController>(u"log"_qs);
m_currentSession->registerAPIController<RSSController>(u"rss"_qs);
@ -753,8 +754,9 @@ QHostAddress WebApplication::resolveClientAddress() const
// WebSession
WebSession::WebSession(const QString &sid)
: m_sid {sid}
WebSession::WebSession(const QString &sid, IApplication *app)
: ApplicationComponent(app)
, m_sid {sid}
{
updateTimestamp();
}