mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-06 02:32:44 +00:00
QuickConnect: init
This adds a page in the settings page that allows the user to enter a quick connect code to allow another device to log in.
This commit is contained in:
parent
13786f01c9
commit
a66434afa8
10 changed files with 242 additions and 3 deletions
|
@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#include <QSharedPointer>
|
||||
|
||||
#include "JellyfinQt/dto/clientcapabilitiesdto.h"
|
||||
#include "JellyfinQt/loader/http/quickconnect.h"
|
||||
#include "JellyfinQt/support/jsonconv.h"
|
||||
#include "JellyfinQt/viewmodel/settings.h"
|
||||
#include "JellyfinQt/websocket.h"
|
||||
|
@ -428,6 +429,26 @@ void ApiClient::authenticate(QString username, QString password, bool storeCrede
|
|||
setDefaultErrorHandler(rep);
|
||||
}
|
||||
|
||||
void ApiClient::submitQuickConnectCode(const QString &code) {
|
||||
using QQAuthorizeLoader = Loader::HTTP::AuthorizeLoader;
|
||||
Loader::AuthorizeParams params;
|
||||
params.setCode(code);
|
||||
|
||||
QQAuthorizeLoader *loader = new QQAuthorizeLoader(this);
|
||||
loader->setParameters(params);
|
||||
loader->load();
|
||||
|
||||
loader->connect(loader, &QQAuthorizeLoader::error, this, [this, loader](QString message) {
|
||||
qDebug() << "QQ error: " << message;
|
||||
emit this->quickConnectRejected();
|
||||
loader->deleteLater();
|
||||
});
|
||||
loader->connect(loader, &QQAuthorizeLoader::ready, this, [this, loader]() {
|
||||
emit this->quickConnectAccepted();
|
||||
loader->deleteLater();
|
||||
});
|
||||
}
|
||||
|
||||
void ApiClient::deleteSession() {
|
||||
QNetworkReply *rep = post("/Sessions/Logout");
|
||||
connect(rep, &QNetworkReply::finished, this, [rep, this] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue