mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Config: Port AutoUpdate settings to new config system.
This commit is contained in:
@ -3,16 +3,17 @@
|
||||
|
||||
#include "UICommon/AutoUpdate.h"
|
||||
|
||||
#include <picojson.h>
|
||||
#include <string>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <picojson.h>
|
||||
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/HttpRequest.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Version.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
@ -149,22 +150,20 @@ static std::string GetPlatformID()
|
||||
#endif
|
||||
}
|
||||
|
||||
void AutoUpdateChecker::CheckForUpdate()
|
||||
void AutoUpdateChecker::CheckForUpdate(std::string_view update_track,
|
||||
std::string_view hash_override)
|
||||
{
|
||||
// Don't bother checking if updates are not supported or not enabled.
|
||||
if (!SystemSupportsAutoUpdates() || SConfig::GetInstance().m_auto_update_track.empty())
|
||||
if (!SystemSupportsAutoUpdates() || update_track.empty())
|
||||
return;
|
||||
|
||||
#ifdef OS_SUPPORTS_UPDATER
|
||||
CleanupFromPreviousUpdate();
|
||||
#endif
|
||||
|
||||
std::string version_hash = SConfig::GetInstance().m_auto_update_hash_override.empty() ?
|
||||
Common::scm_rev_git_str :
|
||||
SConfig::GetInstance().m_auto_update_hash_override;
|
||||
std::string url = "https://dolphin-emu.org/update/check/v1/" +
|
||||
SConfig::GetInstance().m_auto_update_track + "/" + version_hash + "/" +
|
||||
GetPlatformID();
|
||||
std::string_view version_hash = hash_override.empty() ? Common::scm_rev_git_str : hash_override;
|
||||
std::string url = fmt::format("https://dolphin-emu.org/update/check/v1/{}/{}/{}", update_track,
|
||||
version_hash, GetPlatformID());
|
||||
|
||||
Common::HttpRequest req{std::chrono::seconds{10}};
|
||||
auto resp = req.Get(url);
|
||||
|
Reference in New Issue
Block a user