Add COMIC_VINE_USER_AGENT to YACReaderLibrary.ini to be able to customize the user agent

This commit is contained in:
luisangelsm
2025-12-10 10:42:45 +01:00
parent 620140cf12
commit 79eb19a192
10 changed files with 44 additions and 20 deletions

View File

@ -12,8 +12,8 @@
#define PREVIOUS_VERSION "6.0.0"
HttpWorker::HttpWorker(const QString &urlString)
: QThread(), url(urlString), _error(false), _timeout(false)
HttpWorker::HttpWorker(const QString &urlString, const QString &userAgent)
: QThread(), url(urlString), userAgent(userAgent), _error(false), _timeout(false)
{
}
@ -50,7 +50,7 @@ void HttpWorker::run()
auto request = QNetworkRequest(url);
request.setHeader(QNetworkRequest::UserAgentHeader,
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/122.0 Safari/537.36");
userAgent);
QNetworkReply *reply = manager.get(request);

View File

@ -4,13 +4,12 @@
#include <QByteArray>
#include <QThread>
#include <QUrl>
#include "yacreader_global.h"
class HttpWorker : public QThread
{
Q_OBJECT
public:
HttpWorker(const QString &urlString);
HttpWorker(const QString &urlString, const QString &userAgent);
public slots:
void get();
QByteArray getResult();
@ -20,6 +19,7 @@ public slots:
private:
void run();
QUrl url;
QString userAgent;
int httpGetId;
QByteArray result;
bool _error;

View File

@ -9,7 +9,7 @@
class QLibrary;
#define VERSION "9.16.1"
#define VERSION "9.16.2"
// Used to check if the database needs to be updated, the version is stored in the database.
// This value is only incremented when the database structure changes.

View File

@ -68,6 +68,7 @@
#define COMIC_VINE_API_KEY "COMIC_VINE_API_KEY"
#define COMIC_VINE_BASE_URL "COMIC_VINE_BASE_URL"
#define COMIC_VINE_USER_AGENT "COMIC_VINE_USER_AGENT"
#define USE_BACKGROUND_IMAGE_IN_GRID_VIEW "USE_BACKGROUND_IMAGE_IN_GRID_VIEW"
#define OPACITY_BACKGROUND_IMAGE_IN_GRID_VIEW "OPACITY_BACKGROUND_IMAGE_IN_GRID_VIEW"