mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-03 21:41:19 +12:00
Minor tweaks and code clean up (#357)
This commit is contained in:
parent
b07e9efba4
commit
2b9edced81
8 changed files with 105 additions and 130 deletions
|
@ -498,23 +498,27 @@ namespace iosu
|
|||
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, task_header_callback);
|
||||
curl_easy_setopt(curl, CURLOPT_HEADERDATA, &(*it));
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 0x3C);
|
||||
if (GetNetworkConfig().disablesslver.GetValue() && ActiveSettings::GetNetworkService() == NetworkService::Custom || ActiveSettings::GetNetworkService() == NetworkService::Pretendo){ //Remove Pretendo Function once SSL is in the Service
|
||||
if (GetNetworkConfig().disablesslver.GetValue() && ActiveSettings::GetNetworkService() == NetworkService::Custom || ActiveSettings::GetNetworkService() == NetworkService::Pretendo) // remove Pretendo Function once SSL is in the Service
|
||||
{
|
||||
curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,0L);
|
||||
} else {
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_CTX_FUNCTION, task_sslctx_function);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_CTX_DATA, &it->task_settings);
|
||||
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_0);
|
||||
}
|
||||
else
|
||||
{
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_CTX_FUNCTION, task_sslctx_function);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_CTX_DATA, &it->task_settings);
|
||||
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_0);
|
||||
}
|
||||
|
||||
char url[512];
|
||||
std::string requestUrl;
|
||||
if(it->task_settings.taskType == kRawDlTaskSetting)
|
||||
{
|
||||
char serviceToken[TaskSetting::kServiceTokenLen];
|
||||
strncpy(serviceToken, (char*)&it->task_settings.settings[TaskSetting::kServiceToken], TaskSetting::kServiceTokenLen);
|
||||
list_headerParam = append_header_param(list_headerParam, "X-Nintendo-ServiceToken: {}", serviceToken);
|
||||
|
||||
char url[TaskSetting::kURLLen + 1]{};
|
||||
strncpy(url, (char*)&it->task_settings.settings[TaskSetting::kURL], TaskSetting::kURLLen);
|
||||
forceLogDebug_printf("\tserviceToken: %s", serviceToken);
|
||||
requestUrl.assign(url);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -566,26 +570,25 @@ namespace iosu
|
|||
|
||||
char boss_code[0x20];
|
||||
strncpy(boss_code, (char*)&it->task_settings.settings[TaskSetting::kBossCode], TaskSetting::kBossCodeLen);
|
||||
|
||||
switch (ActiveSettings::GetNetworkService())
|
||||
{
|
||||
case NetworkService::Nintendo:
|
||||
sprintf(url, NintendoURLs::BOSSURL.append("/%s/%s/%s?c=%s&l=%s").c_str(), "1", boss_code, it->task_id, countryCode, languageCode);
|
||||
break;
|
||||
case NetworkService::Pretendo:
|
||||
sprintf(url, PretendoURLs::BOSSURL.append("/%s/%s/%s?c=%s&l=%s").c_str(), "1", boss_code, it->task_id, countryCode, languageCode);
|
||||
requestUrl = PretendoURLs::BOSSURL;
|
||||
break;
|
||||
case NetworkService::Custom:
|
||||
sprintf(url, GetNetworkConfig().urls.BOSS.GetValue().append("/%s/%s/%s?c=%s&l=%s").c_str(), "1", boss_code, it->task_id, countryCode, languageCode);
|
||||
requestUrl = GetNetworkConfig().urls.BOSS.GetValue();
|
||||
break;
|
||||
case NetworkService::Nintendo:
|
||||
default:
|
||||
sprintf(url, NintendoURLs::BOSSURL.append("/%s/%s/%s?c=%s&l=%s").c_str(), "1", boss_code, it->task_id, countryCode, languageCode);
|
||||
requestUrl = NintendoURLs::BOSSURL;
|
||||
break;
|
||||
}
|
||||
requestUrl.append(fmt::format(fmt::runtime("/{}/{}/{}?c={}&l={}"), "1", boss_code, it->task_id, countryCode, languageCode));
|
||||
}
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list_headerParam);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||
forceLogDebug_printf("task_run url %s", url);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, requestUrl.c_str());
|
||||
|
||||
int curl_result = curl_easy_perform(curl);
|
||||
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &it->http_status_code);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue