mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-22 02:01:08 +07:00
806b1d75af
- Removed outdated config management routes and consolidated Xray control endpoints. - Updated response structures to ensure consistent error handling across API calls.
32 lines
703 B
C++
32 lines
703 B
C++
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QScopedPointer>
|
|
#include <QHttpServer>
|
|
#include <QHttpServerRequest>
|
|
#include <QHttpServerResponse>
|
|
#include <QTcpServer>
|
|
#include <QWeakPointer>
|
|
#include "iproxyservice.h"
|
|
|
|
class HttpApi : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit HttpApi(QWeakPointer<IProxyService> service, QObject* parent = nullptr);
|
|
~HttpApi();
|
|
|
|
bool start(quint16 port);
|
|
void stop();
|
|
|
|
private:
|
|
void setupRoutes();
|
|
|
|
QHttpServerResponse handlePostUp();
|
|
QHttpServerResponse handlePostDown();
|
|
QHttpServerResponse handleGetPing() const;
|
|
|
|
QHttpServer m_server;
|
|
QScopedPointer<QTcpServer> m_tcpServer;
|
|
QWeakPointer<IProxyService> m_service;
|
|
};
|