Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/ps/ModIo.cpp
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | struct DownloadCallbackData | ||||
FILE* fp; | FILE* fp; | ||||
MD5 md5; | MD5 md5; | ||||
crypto_generichash_state* hash_state; | crypto_generichash_state* hash_state; | ||||
}; | }; | ||||
ModIo::ModIo() | ModIo::ModIo() | ||||
: m_GamesRequest("/games"), m_CallbackData(nullptr) | : m_GamesRequest("/games"), m_CallbackData(nullptr) | ||||
{ | { | ||||
// Get config values from the sytem namespace, or below (default). | // Get config values from the default namespace. | ||||
// This can be overridden on the command line. | // This can be overridden on the command line. | ||||
// | // | ||||
// We do this so a malicious mod cannot change the base url and | // We do this so a malicious mod cannot change the base url and | ||||
// get the user to make connections to someone else's endpoint. | // get the user to make connections to someone else's endpoint. | ||||
// If another user of the engine wants to provide different values | // If another user of the engine wants to provide different values | ||||
// here, while still using the same engine version, they can just | // here, while still using the same engine version, they can just | ||||
// provide some shortcut/script that sets these using command line | // provide some shortcut/script that sets these using command line | ||||
// parameters. | // parameters. | ||||
std::string pk_str; | std::string pk_str; | ||||
g_ConfigDB.GetValue(CFG_SYSTEM, "modio.public_key", pk_str); | g_ConfigDB.GetValue(CFG_DEFAULT, "modio.public_key", pk_str); | ||||
g_ConfigDB.GetValue(CFG_SYSTEM, "modio.v1.baseurl", m_BaseUrl); | g_ConfigDB.GetValue(CFG_DEFAULT, "modio.v1.baseurl", m_BaseUrl); | ||||
{ | { | ||||
std::string api_key; | std::string api_key; | ||||
g_ConfigDB.GetValue(CFG_SYSTEM, "modio.v1.api_key", api_key); | g_ConfigDB.GetValue(CFG_DEFAULT, "modio.v1.api_key", api_key); | ||||
m_ApiKey = "api_key=" + api_key; | m_ApiKey = "api_key=" + api_key; | ||||
} | } | ||||
{ | { | ||||
std::string nameid; | std::string nameid; | ||||
g_ConfigDB.GetValue(CFG_SYSTEM, "modio.v1.name_id", nameid); | g_ConfigDB.GetValue(CFG_DEFAULT, "modio.v1.name_id", nameid); | ||||
m_IdQuery = "name_id="+nameid; | m_IdQuery = "name_id="+nameid; | ||||
} | } | ||||
m_CurlMulti = curl_multi_init(); | m_CurlMulti = curl_multi_init(); | ||||
ENSURE(m_CurlMulti); | ENSURE(m_CurlMulti); | ||||
m_Curl = curl_easy_init(); | m_Curl = curl_easy_init(); | ||||
ENSURE(m_Curl); | ENSURE(m_Curl); | ||||
▲ Show 20 Lines • Show All 736 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator