mirror of
https://gitlab.com/spaceti-app/integrations/acs/colnod-connector.git
synced 2026-07-12 13:00:41 +02:00
77 lines
1.7 KiB
C++
77 lines
1.7 KiB
C++
#ifndef REQUESTMANAGER_H
|
|
#define REQUESTMANAGER_H
|
|
|
|
#include <QObject>
|
|
#include <QNetworkReply>
|
|
#include <QNetworkAccessManager>
|
|
#include <QNetworkRequest>
|
|
#include <QJsonDocument>
|
|
#include <QJsonObject>
|
|
#include <qcoreapplication.h>
|
|
#include <qnetworkreply.h>
|
|
#include <QByteArray>
|
|
#include <QJsonDocument>
|
|
#include <QJsonObject>
|
|
#include <QJsonParseError>
|
|
#include <QFile>
|
|
#include <QString>
|
|
#include <QMultiMap>
|
|
#include <QPointer>
|
|
#include <QDir>
|
|
#include <QSslError>
|
|
|
|
|
|
#include "databasemanager.h"
|
|
#include "token.h"
|
|
#include "subject.h"
|
|
|
|
class RequestManager : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
RequestManager();
|
|
void getSubjects();
|
|
void login(QString endpoint, QString username, QString password);
|
|
void getRequest(QString endpoint);
|
|
void loadSubjectsFromColnodToDB();
|
|
|
|
|
|
|
|
const QJsonDocument &getConfig() const {return config;}
|
|
const QString &getResponse() const {return jsonResponse;}
|
|
QString getToken(){return token;}
|
|
|
|
private:
|
|
|
|
QString getFromJson(QString json, const QString &member);
|
|
QString encryptedPassword(QString password);
|
|
QString getLoginHeader(QString username, QString hash);
|
|
void prepareAuthHeader();
|
|
|
|
private slots:
|
|
void onSSLError(QNetworkReply *reply, const QList<QSslError> &errors);
|
|
|
|
signals:
|
|
void successLogin();
|
|
void responseReady();
|
|
|
|
|
|
private:
|
|
QNetworkAccessManager* manager;
|
|
QJsonDocument config;
|
|
QString authHeader;
|
|
//QString host = "https://192.168.1.3:8443";
|
|
QString host = "http://localhost:8080";
|
|
|
|
QString password = "spaceti1";
|
|
QString user = "spaceti";
|
|
QString token;
|
|
QString jsonResponse;
|
|
bool loginStatus;
|
|
|
|
|
|
};
|
|
|
|
#endif // REQUESTMANAGER_H
|