mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
5e559627be
* Push progress TODO: rework RESET, probably to main.cpp again * resetPassword rework * enable administration restriction * add short cmd for userdata * Js apis * Refactor JsonCB class * Add userToken Auth * Feat: Close connection if ext clients when def pw is set * Feat: Protect db against pw/token tests * WebUi PW Support (#9) * Initial WebUi Password Support * Small changes * Initial WebUi Password Support * Small changes * Basic WebUi Token support * added "removeStorage", added uiLock, updated login page * Small improvments * Small change * Fix: prevent downgrade of authorization * Add translation for localAdminAuth * Feat: Show always save button in led layout * Revert "Feat: Show always save button in led layout" This reverts commit caad1dfcdee311bb6496839752b2a2df3f0fd98b. * Feat: Password change link in notification * Fix: body padding modal overlap * Feat: Add instance index to response on switch * prevent schema error Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com> * Feat: add pw save * Feat: callout settings/pw replaced with notification
64 lines
1.4 KiB
C++
64 lines
1.4 KiB
C++
#ifndef QTHTTPCLIENTWRAPPER_H
|
|
#define QTHTTPCLIENTWRAPPER_H
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
|
|
class QTcpSocket;
|
|
|
|
class QtHttpRequest;
|
|
class QtHttpReply;
|
|
class QtHttpServer;
|
|
class WebSocketClient;
|
|
class WebJsonRpc;
|
|
|
|
class QtHttpClientWrapper : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit QtHttpClientWrapper (QTcpSocket * sock, const bool& localConnection, QtHttpServer * parent);
|
|
|
|
static const char SPACE = ' ';
|
|
static const char COLON = ':';
|
|
static const QByteArray & CRLF;
|
|
|
|
enum ParsingStatus {
|
|
ParsingError = -1,
|
|
AwaitingRequest = 0,
|
|
AwaitingHeaders = 1,
|
|
AwaitingContent = 2,
|
|
RequestParsed = 3
|
|
};
|
|
|
|
QString getGuid (void);
|
|
/// @brief Wrapper for sendReplyToClient(), handles m_parsingStatus and signal connect
|
|
void sendToClientWithReply (QtHttpReply * reply);
|
|
|
|
///
|
|
/// @brief close a connection with FORBIDDEN header (used from JsonAPI over HTTP)
|
|
///
|
|
void closeConnection();
|
|
|
|
private slots:
|
|
void onClientDataReceived (void);
|
|
|
|
protected:
|
|
ParsingStatus sendReplyToClient (QtHttpReply * reply);
|
|
|
|
protected slots:
|
|
void onReplySendHeadersRequested (void);
|
|
void onReplySendDataRequested (void);
|
|
|
|
private:
|
|
QString m_guid;
|
|
ParsingStatus m_parsingStatus;
|
|
QTcpSocket * m_sockClient;
|
|
QtHttpRequest * m_currentRequest;
|
|
QtHttpServer * m_serverHandle;
|
|
const bool m_localConnection;
|
|
WebSocketClient * m_websocketClient;
|
|
WebJsonRpc * m_webJsonRpc;
|
|
};
|
|
|
|
#endif // QTHTTPCLIENTWRAPPER_H
|