WebAPI: Support persisting WebUI client preferences

This provides a mechanism for persisting WebUI client preferences that are distinct from the broader qBittorrent preferences. These preferences apply exclusively to the WebUI.

PR #23088.
This commit is contained in:
Thomas (Tom) Piccirello
2025-09-12 07:47:32 -07:00
committed by GitHub
parent 94ef038f3a
commit 69b2d7a53e
8 changed files with 339 additions and 0 deletions

View File

@@ -60,6 +60,7 @@
#include "api/apierror.h"
#include "api/appcontroller.h"
#include "api/authcontroller.h"
#include "api/clientdatacontroller.h"
#include "api/logcontroller.h"
#include "api/rsscontroller.h"
#include "api/searchcontroller.h"
@@ -67,6 +68,7 @@
#include "api/torrentcreatorcontroller.h"
#include "api/torrentscontroller.h"
#include "api/transfercontroller.h"
#include "clientdatastorage.h"
const int MAX_ALLOWED_FILESIZE = 10 * 1024 * 1024;
const QString DEFAULT_SESSION_COOKIE_NAME = u"SID"_s;
@@ -158,6 +160,7 @@ WebApplication::WebApplication(IApplication *app, QObject *parent)
, m_cacheID {QString::number(Utils::Random::rand(), 36)}
, m_authController {new AuthController(this, app, this)}
, m_torrentCreationManager {new BitTorrent::TorrentCreationManager(app, this)}
, m_clientDataStorage {new ClientDataStorage(this)}
{
declarePublicAPI(u"auth/login"_s);
@@ -749,6 +752,7 @@ void WebApplication::sessionStart()
m_sessions[m_currentSession->id()] = m_currentSession;
m_currentSession->registerAPIController(u"app"_s, new AppController(app(), m_currentSession));
m_currentSession->registerAPIController(u"clientdata"_s, new ClientDataController(m_clientDataStorage, app(), m_currentSession));
m_currentSession->registerAPIController(u"log"_s, new LogController(app(), m_currentSession));
m_currentSession->registerAPIController(u"torrentcreator"_s, new TorrentCreatorController(m_torrentCreationManager, app(), m_currentSession));
m_currentSession->registerAPIController(u"rss"_s, new RSSController(app(), m_currentSession));