2020-10-07 10:36:04 +00:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
2022-02-10 10:26:41 +00:00
|
|
|
// SPDX-FileCopyrightText: 2020-2022 The Monero Project
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
#ifndef FEATHER_NETWORKING_H
|
|
|
|
#define FEATHER_NETWORKING_H
|
|
|
|
|
2022-03-04 10:05:20 +00:00
|
|
|
#include <QRegularExpression>
|
2020-10-07 10:36:04 +00:00
|
|
|
#include <QtNetwork>
|
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
#include <QNetworkReply>
|
|
|
|
|
2021-07-06 19:36:27 +00:00
|
|
|
#include "utils/Utils.h"
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
class UtilsNetworking : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit UtilsNetworking(QNetworkAccessManager *networkAccessManager, QObject *parent = nullptr);
|
|
|
|
|
2021-05-02 18:22:38 +00:00
|
|
|
QNetworkReply* get(const QString &url);
|
2020-10-07 10:36:04 +00:00
|
|
|
QNetworkReply* getJson(const QString &url);
|
|
|
|
QNetworkReply* postJson(const QString &url, const QJsonObject &data);
|
|
|
|
void setUserAgent(const QString &userAgent);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString m_userAgent = "Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0";
|
|
|
|
QNetworkAccessManager *m_networkAccessManager;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //FEATHER_NETWORKING_H
|