40 unsigned char pk[crypto_sign_PUBLICKEYBYTES] = {};
47 unsigned char sig[crypto_sign_BYTES] = {};
153 const std::vector<ModIoModData>&
GetMods()
const
163 static size_t ReceiveCallback(
void* buffer,
size_t size,
size_t nmemb,
void* userp);
164 static size_t DownloadCallback(
void* buffer,
size_t size,
size_t nmemb,
void* userp);
165 static int DownloadProgressCallback(
void* clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
167 CURLMcode
SetupRequest(
const std::string& url,
bool fileDownload);
DownloadProgressStatus
Definition: ModIo.h:57
ModIo * g_ModIo
Definition: ModIo.cpp:49
mod.io API interfacing code.
Definition: ModIo.h:129
std::string m_ResponseData
Definition: ModIo.h:194
std::string m_ApiKey
Definition: ModIo.h:187
void DeleteDownloadedFile()
Definition: ModIo.cpp:522
std::vector< ModIoModData > m_ModData
Definition: ModIo.h:204
const DownloadProgressData & GetDownloadProgress() const
Definition: ModIo.h:157
bool ParseGameId(const ScriptInterface &scriptInterface, std::string &err)
Definition: ModIo.cpp:503
bool AdvanceRequest(const ScriptInterface &scriptInterface)
Advance the current async request and perform final steps if the download is complete.
Definition: ModIo.cpp:389
std::string m_IdQuery
Definition: ModIo.h:188
CURLMcode SetupRequest(const std::string &url, bool fileDownload)
Definition: ModIo.cpp:202
int m_DownloadModID
Definition: ModIo.h:197
static bool ParseGameIdResponse(const ScriptInterface &scriptInterface, const std::string &responseData, int &id, std::string &err)
Parses the current content of m_ResponseData to extract m_GameId.
Definition: ModIo.cpp:593
std::string m_GameId
Definition: ModIo.h:184
void TearDownRequest()
Definition: ModIo.cpp:238
DownloadProgressData m_DownloadProgressData
Definition: ModIo.h:200
bool VerifyDownloadedFile(std::string &err)
Definition: ModIo.cpp:529
void StartDownloadMod(u32 idx)
Definition: ModIo.cpp:304
friend class TestModIo
Definition: ModIo.h:206
void StartGetGameId()
Definition: ModIo.cpp:250
PKStruct m_pk
Definition: ModIo.h:202
~ModIo()
Definition: ModIo.cpp:143
const std::vector< ModIoModData > & GetMods() const
Definition: ModIo.h:153
void StartListMods()
Definition: ModIo.cpp:274
CURL * m_Curl
Definition: ModIo.h:190
curl_slist * m_Headers
Definition: ModIo.h:192
ModIo()
Definition: ModIo.cpp:80
static size_t ReceiveCallback(void *buffer, size_t size, size_t nmemb, void *userp)
Definition: ModIo.cpp:158
std::string m_GamesRequest
Definition: ModIo.h:183
static int DownloadProgressCallback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
Definition: ModIo.cpp:189
bool ParseMods(const ScriptInterface &scriptInterface, std::string &err)
Definition: ModIo.cpp:515
char m_ErrorBuffer[CURL_ERROR_SIZE]
Definition: ModIo.h:193
DownloadCallbackData * m_CallbackData
Definition: ModIo.h:199
void CancelRequest()
Cancel the current async request and clean things up.
Definition: ModIo.cpp:365
std::string m_BaseUrl
Definition: ModIo.h:182
OsPath m_DownloadFilePath
Definition: ModIo.h:198
static bool ParseModsResponse(const ScriptInterface &scriptInterface, const std::string &responseData, std::vector< ModIoModData > &modData, const PKStruct &pk, std::string &err)
Parses the current content of m_ResponseData into m_ModData.
Definition: ModIo.cpp:662
static bool ParseSignature(const std::vector< std::string > &minisigs, SigStruct &sig, const PKStruct &pk, std::string &err)
Parse signatures to find one that matches the public key, and has a valid global signature.
Definition: ModIo.cpp:790
static size_t DownloadCallback(void *buffer, size_t size, size_t nmemb, void *userp)
Definition: ModIo.cpp:167
CURLM * m_CurlMulti
Definition: ModIo.h:191
Abstraction around a SpiderMonkey JS::Realm.
Definition: ScriptInterface.h:72
std::string error
Definition: ModIo.h:76
DownloadProgressStatus status
Definition: ModIo.h:74
double progress
Definition: ModIo.h:75
std::map< std::string, std::string > properties
Definition: ModIo.h:52
std::vector< std::string > dependencies
Definition: ModIo.h:53
SigStruct sig
Definition: ModIo.h:54
unsigned char keynum[8]
Definition: ModIo.h:39
unsigned char sig_alg[2]
Definition: ModIo.h:38
unsigned char pk[crypto_sign_PUBLICKEYBYTES]
Definition: ModIo.h:40
unsigned char sig_alg[2]
Definition: ModIo.h:45
unsigned char keynum[8]
Definition: ModIo.h:46
unsigned char sig[crypto_sign_BYTES]
Definition: ModIo.h:47
uint32_t u32
Definition: types.h:39