From 822577eb422276bb5ec01adfc9cf705bb7c22b46 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 22 Feb 2017 11:11:45 +0000 Subject: [PATCH] updates: we now have a user URL, and an automatic one So the user can use https, while the automatic does not have to --- src/common/updates.cpp | 4 ++-- src/common/updates.h | 2 +- src/cryptonote_core/cryptonote_core.cpp | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/common/updates.cpp b/src/common/updates.cpp index 6e2001441..3fa985e24 100644 --- a/src/common/updates.cpp +++ b/src/common/updates.cpp @@ -98,9 +98,9 @@ namespace tools return found; } - std::string get_update_url(const std::string &software, const std::string &subdir, const std::string &buildtag, const std::string &version) + std::string get_update_url(const std::string &software, const std::string &subdir, const std::string &buildtag, const std::string &version, bool user) { - static const char base[] = "http://updates.getmonero.org/"; + static const char *base = user ? "https://downloads.getmonero.org/" : "http://updates.getmonero.org/"; #ifdef _WIN32 static const char extension[] = ".zip"; #else diff --git a/src/common/updates.h b/src/common/updates.h index 1a70e06fd..d84b612df 100644 --- a/src/common/updates.h +++ b/src/common/updates.h @@ -33,5 +33,5 @@ namespace tools { bool check_updates(const std::string &software, const std::string &buildtag, bool bestnet, std::string &version, std::string &hash); - std::string get_update_url(const std::string &software, const std::string &subdir, const std::string &buildtag, const std::string &version); + std::string get_update_url(const std::string &software, const std::string &subdir, const std::string &buildtag, const std::string &version, bool user); } diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index a6b62f2ff..470c1feb3 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -1107,12 +1107,13 @@ namespace cryptonote if (tools::vercmp(version.c_str(), MONERO_VERSION) <= 0) return true; - std::string url = tools::get_update_url(software, subdir, buildtag, version); + std::string url = tools::get_update_url(software, subdir, buildtag, version, true); MGINFO("Version " << version << " of " << software << " for " << buildtag << " is available: " << url << ", SHA256 hash " << hash); if (check_updates_level == UPDATES_NOTIFY) return true; + url = tools::get_update_url(software, subdir, buildtag, version, false); std::string filename; const char *slash = strrchr(url.c_str(), '/'); if (slash)