mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Make use of QUrlQuery in NetworkRequests where it was hardcoded into url (#3039)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
e5fe0999ee
commit
ae9f92ded9
|
@ -7,6 +7,7 @@
|
|||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QThread>
|
||||
#include <QUrlQuery>
|
||||
|
||||
#include "common/NetworkRequest.hpp"
|
||||
#include "common/Outcome.hpp"
|
||||
|
@ -24,8 +25,11 @@ void TwitchBadges::loadTwitchBadges()
|
|||
{
|
||||
assert(this->loaded_ == false);
|
||||
|
||||
static QString url(
|
||||
"https://badges.twitch.tv/v1/badges/global/display?language=en");
|
||||
QUrl url("https://badges.twitch.tv/v1/badges/global/display");
|
||||
|
||||
QUrlQuery urlQuery;
|
||||
urlQuery.addQueryItem("language", "en");
|
||||
url.setQuery(urlQuery);
|
||||
|
||||
NetworkRequest(url)
|
||||
.onSuccess([this](auto result) -> Outcome {
|
||||
|
|
|
@ -755,11 +755,14 @@ void TwitchChannel::loadRecentMessages()
|
|||
return;
|
||||
}
|
||||
|
||||
auto baseURL = Env::get().recentMessagesApiUrl.arg(this->getName());
|
||||
|
||||
auto url = QString("%1?limit=%2")
|
||||
.arg(baseURL)
|
||||
.arg(getSettings()->twitchMessageHistoryLimit);
|
||||
QUrl url(Env::get().recentMessagesApiUrl.arg(this->getName()));
|
||||
QUrlQuery urlQuery(url);
|
||||
if (!urlQuery.hasQueryItem("limit"))
|
||||
{
|
||||
urlQuery.addQueryItem(
|
||||
"limit", QString::number(getSettings()->twitchMessageHistoryLimit));
|
||||
}
|
||||
url.setQuery(urlQuery);
|
||||
|
||||
auto weak = weakOf<Channel>(this);
|
||||
|
||||
|
|
Loading…
Reference in a new issue