Fix online for NA console logins (#147)

This is just a quick fix. In the future we can look into avoiding hardcoded firmware version numbers. On the console it gets read from some system file
This commit is contained in:
Exzap 2022-09-02 09:14:55 +02:00 committed by GitHub
parent d3a7b3b5a6
commit b1844a8753
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,7 +61,7 @@ namespace NAPI
return true;
}
void _ACTSetCommonHeaderParameters(CurlRequestHelper& req)
void _ACTSetCommonHeaderParameters(CurlRequestHelper& req, AuthInfo& authInfo)
{
req.addHeaderField("X-Nintendo-Platform-ID", "1");
req.addHeaderField("X-Nintendo-Device-Type", "2");
@ -71,6 +71,9 @@ namespace NAPI
req.addHeaderField("Accept", "*/*");
if(authInfo.region == CafeConsoleRegion::USA)
req.addHeaderField("X-Nintendo-System-Version", "0270");
else
req.addHeaderField("X-Nintendo-System-Version", "0260");
}
@ -143,7 +146,7 @@ namespace NAPI
CurlRequestHelper req;
req.initate(fmt::format("{}/v1/api/oauth20/access_token/generate", LaunchSettings::GetActURLPrefix()), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT);
_ACTSetCommonHeaderParameters(req);
_ACTSetCommonHeaderParameters(req, authInfo);
_ACTSetDeviceParameters(req, authInfo);
_ACTSetRegionAndCountryParameters(req, authInfo);
req.addHeaderField("X-Nintendo-Device-Cert", authInfo.deviceCertBase64);
@ -229,7 +232,7 @@ namespace NAPI
req.initate(fmt::format("{}/v1/api/people/@me/profile", LaunchSettings::GetActURLPrefix()), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT);
_ACTSetCommonHeaderParameters(req);
_ACTSetCommonHeaderParameters(req, authInfo);
_ACTSetDeviceParameters(req, authInfo);
// get oauth2 token
@ -295,7 +298,7 @@ namespace NAPI
// do request
CurlRequestHelper req;
req.initate(fmt::format("{}/v1/api/provider/nex_token/@me?game_server_id={:08X}", LaunchSettings::GetActURLPrefix(), serverId), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT);
_ACTSetCommonHeaderParameters(req);
_ACTSetCommonHeaderParameters(req, authInfo);
_ACTSetDeviceParameters(req, authInfo);
_ACTSetRegionAndCountryParameters(req, authInfo);
req.addHeaderField("X-Nintendo-FPD-Version", "0000");
@ -448,7 +451,7 @@ namespace NAPI
// do request
CurlRequestHelper req;
req.initate(fmt::format("{}/v1/api/provider/service_token/@me?client_id={}", LaunchSettings::GetActURLPrefix(), clientId), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT);
_ACTSetCommonHeaderParameters(req);
_ACTSetCommonHeaderParameters(req, authInfo);
_ACTSetDeviceParameters(req, authInfo);
_ACTSetRegionAndCountryParameters(req, authInfo);
req.addHeaderField("X-Nintendo-FPD-Version", "0000");
@ -519,7 +522,7 @@ namespace NAPI
// do request
CurlRequestHelper req;
req.initate(fmt::format("{}/v1/api/admin/mapped_ids?input_type=user_id&output_type=pid&input={}", LaunchSettings::GetActURLPrefix(), nnid), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT);
_ACTSetCommonHeaderParameters(req);
_ACTSetCommonHeaderParameters(req, authInfo);
_ACTSetDeviceParameters(req, authInfo);
_ACTSetRegionAndCountryParameters(req, authInfo);
req.addHeaderField("X-Nintendo-FPD-Version", "0000");