Skip to content

Commit e425933

Browse files
Updates for new staging API response
1 parent 72e24fc commit e425933

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

src/elgato-cloud-data.cpp

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -344,29 +344,34 @@ void ElgatoCloud::_ProcessLogin(nlohmann::json &loginData, bool loadData)
344344
obs_log(LOG_INFO, "Some other issue occurred");
345345
connectionError = true;
346346
}
347-
if (mainWindowOpen && window) {
348-
QMetaObject::invokeMethod(
349-
QCoreApplication::instance()->thread(),
350-
[this, loadData]() {
351-
window->setLoggedIn();
352-
if (loadData) {
353-
LoadPurchasedProducts();
354-
}
355-
});
356-
}
357-
_LoadUserData();
347+
_LoadUserData(loadData);
358348
}
359349

360-
void ElgatoCloud::_LoadUserData()
350+
void ElgatoCloud::_LoadUserData(bool loadData)
361351
{
362-
auto api = MarketplaceApi::getInstance();
363-
std::string api_url = api->gatewayUrl();
364-
api_url += "/user";
365-
auto userResponse = fetch_string_from_get(api_url, _accessToken);
366-
auto userData = nlohmann::json::parse(userResponse);
367-
api->setUserDetails(userData);
368-
369-
blog(LOG_INFO, "User Response:\n%s", userResponse.c_str());
352+
try {
353+
auto api = MarketplaceApi::getInstance();
354+
std::string api_url = api->gatewayUrl();
355+
api_url += "/user";
356+
auto userResponse = fetch_string_from_get(api_url, _accessToken);
357+
auto userData = nlohmann::json::parse(userResponse);
358+
api->setUserDetails(userData);
359+
blog(LOG_INFO, "User Response:\n%s", userResponse.c_str());
360+
if (mainWindowOpen && window) {
361+
QMetaObject::invokeMethod(
362+
QCoreApplication::instance()->thread(),
363+
[this, loadData]() {
364+
window->setLoggedIn();
365+
if (loadData) {
366+
LoadPurchasedProducts();
367+
}
368+
});
369+
}
370+
}
371+
catch (...) {
372+
obs_log(LOG_INFO, "Invalid response from server");
373+
connectionError = true;
374+
}
370375
}
371376

372377
void ElgatoCloud::_SaveState()

src/elgato-cloud-data.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class ElgatoCloud {
7171
void _SaveState();
7272
void _GetSavedState();
7373
void _TokenRefresh(bool loadData);
74-
void _LoadUserData();
74+
void _LoadUserData(bool loadData = false);
7575

7676
obs_module_t *_modulePtr = nullptr;
7777
//translateFunc _translate = nullptr;

src/elgato-product.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ ElgatoProduct::ElgatoProduct(nlohmann::json &productData)
5757
_thumbnailReady = false;
5858

5959
name = productData["name"];
60-
thumbnailUrl = productData["thumbnail"];
60+
thumbnailUrl = productData["thumbnail_cdn"];
6161
variantId = productData["variants"][0]["id"];
6262

6363
auto found = thumbnailUrl.find_last_of("/");

0 commit comments

Comments
 (0)