Merge pull request #1774
59013316
updates: remove testnet case (moneromooo-monero)822577eb
updates: we now have a user URL, and an automatic one (moneromooo-monero)9f17b1a3
updates: s/monerod/monero/ for the main download (moneromooo-monero)6a5dfb88
updates: add all update servers (moneromooo-monero)72d40f13
updates: use HTTP, not HTTPS (moneromooo-monero)
This commit is contained in:
commit
7de43154d3
3 changed files with 15 additions and 13 deletions
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
namespace tools
|
namespace tools
|
||||||
{
|
{
|
||||||
bool check_updates(const std::string &software, const std::string &buildtag, bool testnet, std::string &version, std::string &hash)
|
bool check_updates(const std::string &software, const std::string &buildtag, std::string &version, std::string &hash)
|
||||||
{
|
{
|
||||||
std::vector<std::string> records;
|
std::vector<std::string> records;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
@ -44,12 +44,13 @@ namespace tools
|
||||||
|
|
||||||
// All four MoneroPulse domains have DNSSEC on and valid
|
// All four MoneroPulse domains have DNSSEC on and valid
|
||||||
static const std::vector<std::string> dns_urls = {
|
static const std::vector<std::string> dns_urls = {
|
||||||
|
"updates.moneropulse.org",
|
||||||
|
"updates.moneropulse.net",
|
||||||
|
"updates.moneropulse.co",
|
||||||
|
"updates.moneropulse.se"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const std::vector<std::string> testnet_dns_urls = { "testver.moneropulse.net"
|
if (!tools::dns_utils::load_txt_records_from_dns(records, dns_urls))
|
||||||
};
|
|
||||||
|
|
||||||
if (!tools::dns_utils::load_txt_records_from_dns(records, testnet ? testnet_dns_urls : dns_urls))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (const auto& record : records)
|
for (const auto& record : records)
|
||||||
|
@ -94,9 +95,9 @@ namespace tools
|
||||||
return found;
|
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[] = "https://updates.getmonero.org/";
|
static const char *base = user ? "https://downloads.getmonero.org/" : "http://updates.getmonero.org/";
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static const char extension[] = ".zip";
|
static const char extension[] = ".zip";
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -32,6 +32,6 @@
|
||||||
|
|
||||||
namespace tools
|
namespace tools
|
||||||
{
|
{
|
||||||
bool check_updates(const std::string &software, const std::string &buildtag, bool bestnet, std::string &version, std::string &hash);
|
bool check_updates(const std::string &software, const std::string &buildtag, 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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1088,7 +1088,7 @@ namespace cryptonote
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::check_updates()
|
bool core::check_updates()
|
||||||
{
|
{
|
||||||
static const char software[] = "monerod";
|
static const char software[] = "monero";
|
||||||
static const char subdir[] = "cli"; // because it can never be simple
|
static const char subdir[] = "cli"; // because it can never be simple
|
||||||
#ifdef BUILD_TAG
|
#ifdef BUILD_TAG
|
||||||
static const char buildtag[] = BOOST_PP_STRINGIZE(BUILD_TAG);
|
static const char buildtag[] = BOOST_PP_STRINGIZE(BUILD_TAG);
|
||||||
|
@ -1101,18 +1101,19 @@ namespace cryptonote
|
||||||
|
|
||||||
std::string version, hash;
|
std::string version, hash;
|
||||||
MCDEBUG("updates", "Checking for a new " << software << " version for " << buildtag);
|
MCDEBUG("updates", "Checking for a new " << software << " version for " << buildtag);
|
||||||
if (!tools::check_updates(software, buildtag, m_testnet, version, hash))
|
if (!tools::check_updates(software, buildtag, version, hash))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (tools::vercmp(version.c_str(), MONERO_VERSION) <= 0)
|
if (tools::vercmp(version.c_str(), MONERO_VERSION) <= 0)
|
||||||
return true;
|
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);
|
MGINFO("Version " << version << " of " << software << " for " << buildtag << " is available: " << url << ", SHA256 hash " << hash);
|
||||||
|
|
||||||
if (check_updates_level == UPDATES_NOTIFY)
|
if (check_updates_level == UPDATES_NOTIFY)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
url = tools::get_update_url(software, subdir, buildtag, version, false);
|
||||||
std::string filename;
|
std::string filename;
|
||||||
const char *slash = strrchr(url.c_str(), '/');
|
const char *slash = strrchr(url.c_str(), '/');
|
||||||
if (slash)
|
if (slash)
|
||||||
|
@ -1141,7 +1142,7 @@ namespace cryptonote
|
||||||
MCERROR("updates", "Download from " << url << " does not match the expected hash");
|
MCERROR("updates", "Download from " << url << " does not match the expected hash");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MCINFO("updates", "New version downloaded to " << path);
|
MGINFO("New version downloaded to " << path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue