txtcord/utils/discordrequests.cpp

16 lines
1.3 KiB
C++
Raw Normal View History

2024-08-15 12:23:36 -04:00
#include "discordrequests.h"
DiscordRequests::DiscordRequests() {}
QNetworkRequest DiscordRequests::buildRequest(QString endpoint, bool authenticated, bool json) {
2024-08-16 01:25:48 -04:00
QNetworkRequest request(QUrl("https://discord.com/api/v9/" + endpoint));
2024-08-15 12:23:36 -04:00
// set superprops/agent on Windows Chrome 122 to avoid raising flags
request.setRawHeader("X-Super-Properties", "eyJvcyI6IldpbmRvd3MiLCJicm93c2VyIjoiQ2hyb21lIiwiZGV2aWNlIjoiIiwic3lzdGVtX2xvY2FsZSI6ImVuLUdCIiwiYnJvd3Nlcl91c2VyX2FnZW50IjoiTW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzEyMi4wLjAuMCBTYWZhcmkvNTM3LjM2IiwiYnJvd3Nlcl92ZXJzaW9uIjoiMTIyLjAuMC4wIiwib3NfdmVyc2lvbiI6IjEwIiwicmVmZXJyZXIiOiIiLCJyZWZlcnJpbmdfZG9tYWluIjoiIiwicmVmZXJyZXJfY3VycmVudCI6IiIsInJlZmVycmluZ19kb21haW5fY3VycmVudCI6IiIsInJlbGVhc2VfY2hhbm5lbCI6InN0YWJsZSIsImNsaWVudF9idWlsZF9udW1iZXIiOjMxODM2MSwiY2xpZW50X2V2ZW50X3NvdXJjZSI6bnVsbH0=");
request.setRawHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36");
// love ripping off headers from my own session :blobcatcozy:
request.setRawHeader("X-Discord-Locale", "en-GB");
request.setRawHeader("X-Discord-Timezone", "America/New_York");
if(json) request.setRawHeader("Content-Type", "application/json");
return request;
}