3535#include " Common/Log.h"
3636#include " Common/File/Path.h"
3737#include " Common/Net/HTTPRequest.h"
38+ #include " Common/Net/HTTPClient.h"
3839#include " Common/System/OSD.h"
3940#include " Common/System/System.h"
4041#include " Common/System/NativeApp.h"
@@ -290,8 +291,9 @@ static void server_call_callback(const rc_api_request_t *request,
290291{
291292 // If post data is provided, we need to make a POST request, otherwise, a GET request will suffice.
292293 auto ac = GetI18NCategory (I18NCat::ACHIEVEMENTS );
294+ std::string url = http::RemoveHttpsIfNeeded (request->url );
293295 if (request->post_data ) {
294- std::shared_ptr<http::Request> download = g_DownloadManager.AsyncPostWithCallback (std::string (request-> url ) , std::string (request->post_data ), " application/x-www-form-urlencoded" , http::RequestFlags::ProgressBar | http::RequestFlags::ProgressBarDelayed,
296+ std::shared_ptr<http::Request> download = g_DownloadManager.AsyncPostWithCallback (url, std::string (request->post_data ), " application/x-www-form-urlencoded" , http::RequestFlags::ProgressBar | http::RequestFlags::ProgressBarDelayed,
295297 [callback, callback_data](http::Request &download) {
296298 std::string buffer;
297299 download.buffer ().TakeAll (&buffer);
@@ -302,7 +304,7 @@ static void server_call_callback(const rc_api_request_t *request,
302304 callback (&response, callback_data);
303305 }, ac->T (" Contacting RetroAchievements server..." ));
304306 } else {
305- std::shared_ptr<http::Request> download = g_DownloadManager.StartDownload (std::string (request-> url ) , Path (), http::RequestFlags::ProgressBar | http::RequestFlags::ProgressBarDelayed, nullptr ,
307+ std::shared_ptr<http::Request> download = g_DownloadManager.StartDownload (url, Path (), http::RequestFlags::ProgressBar | http::RequestFlags::ProgressBarDelayed, nullptr ,
306308 ac->T (" Contacting RetroAchievements server..." ),
307309 [callback, callback_data](http::Request &download) {
308310 std::string buffer;
@@ -918,6 +920,7 @@ bool HasAchievementsOrLeaderboards() {
918920}
919921
920922void DownloadImageIfMissing (std::string_view url) {
923+ // On Linux for example, we currently have no way of doing a HTTPS request.
921924 if (g_iconCache.MarkPending (url)) {
922925 INFO_LOG (Log::Achievements, " Downloading image: %.*s" , STR_VIEW (url));
923926 g_DownloadManager.StartDownload (url, Path (), http::RequestFlags::Default, nullptr , " " , [](http::Request &download) {
@@ -985,7 +988,8 @@ void identify_and_load_callback(int result, const char *error_message, rc_client
985988 // Successful! Show a message that we're active.
986989 const rc_client_game_t *gameInfo = rc_client_get_game_info (client);
987990
988- DownloadImageIfMissing (gameInfo->badge_url );
991+ std::string imageUrl = http::RemoveHttpsIfNeeded (gameInfo->badge_url );
992+ DownloadImageIfMissing (imageUrl);
989993
990994 GameRegion region = DetectGameRegionFromID (g_paramSFO.GetDiscID ());
991995 auto ga = GetI18NCategory (I18NCat::GAME );
@@ -997,7 +1001,7 @@ void identify_and_load_callback(int result, const char *error_message, rc_client
9971001 title += " )" ;
9981002 }
9991003 // TODO: Detect current subset.
1000- g_OSD.Show (OSDType::MESSAGE_INFO , title, GetGameAchievementSummary (0 ), gameInfo-> badge_url , 5 .0f );
1004+ g_OSD.Show (OSDType::MESSAGE_INFO , title, GetGameAchievementSummary (0 ), imageUrl , 5 .0f );
10011005 break ;
10021006 }
10031007 case RC_NO_GAME_LOADED :
0 commit comments