NOISSUE Use constants for user agents
Here lies yet another early-stage move to debrand the MultiMC codebase, as well as reducing the burden of updating strings across the codebase for a future MultiMC6.
This commit is contained in:
parent
df1d3dbae2
commit
20c393321c
@ -15,6 +15,7 @@
|
||||
|
||||
#include "Download.h"
|
||||
|
||||
#include "BuildConfig.h"
|
||||
#include <QFileInfo>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
@ -94,7 +95,7 @@ void Download::start()
|
||||
return;
|
||||
}
|
||||
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0");
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT);
|
||||
|
||||
QNetworkReply *rep = ENV.qnam().get(request);
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QFile>
|
||||
#include <BuildConfig.h>
|
||||
|
||||
PasteUpload::PasteUpload(QWidget *window, QString text, QString key) : m_window(window)
|
||||
{
|
||||
@ -34,7 +35,7 @@ bool PasteUpload::validateText()
|
||||
void PasteUpload::executeTask()
|
||||
{
|
||||
QNetworkRequest request(QUrl("https://api.paste.ee/v1/pastes"));
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)");
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT_UNCACHED);
|
||||
|
||||
request.setRawHeader("Content-Type", "application/json");
|
||||
request.setRawHeader("Content-Length", QByteArray::number(m_jsonContent.size()));
|
||||
|
@ -20,7 +20,7 @@ void ImgurAlbumCreation::start()
|
||||
{
|
||||
m_status = Job_InProgress;
|
||||
QNetworkRequest request(m_url);
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)");
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT_UNCACHED);
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
||||
request.setRawHeader("Authorization", "Client-ID 5b97b0713fba4a3");
|
||||
request.setRawHeader("Accept", "application/json");
|
||||
|
@ -23,7 +23,7 @@ void ImgurUpload::start()
|
||||
finished = false;
|
||||
m_status = Job_InProgress;
|
||||
QNetworkRequest request(m_url);
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)");
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT_UNCACHED);
|
||||
request.setRawHeader("Authorization", "Client-ID 5b97b0713fba4a3");
|
||||
request.setRawHeader("Accept", "application/json");
|
||||
|
||||
|
@ -31,6 +31,11 @@ public:
|
||||
/// URL for the updater's channel
|
||||
QString CHANLIST_URL;
|
||||
|
||||
/// User-Agent to use.
|
||||
QString USER_AGENT = "MultiMC/5.0";
|
||||
/// User-Agent to use for uncached requests.
|
||||
QString USER_AGENT_UNCACHED = "MultiMC/5.0 (Uncached)";
|
||||
|
||||
/// Google analytics ID
|
||||
QString ANALYTICS_ID;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user