mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #1750
ada0e23a
updates: fix user/auto url split (moneromooo-monero)14d0e002
wallet2_api: add updates check api (moneromooo-monero)
This commit is contained in:
commit
f50704ec01
3 changed files with 32 additions and 1 deletions
|
@ -97,7 +97,7 @@ namespace tools
|
||||||
|
|
||||||
std::string get_update_url(const std::string &software, const std::string &subdir, const std::string &buildtag, const std::string &version, bool user)
|
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 = user ? "https://downloads.getmonero.org/" : "http://updates.getmonero.org/";
|
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
|
||||||
|
|
|
@ -33,11 +33,16 @@
|
||||||
#include "wallet.h"
|
#include "wallet.h"
|
||||||
#include "common_defines.h"
|
#include "common_defines.h"
|
||||||
#include "common/dns_utils.h"
|
#include "common/dns_utils.h"
|
||||||
|
#include "common/util.h"
|
||||||
|
#include "common/updates.h"
|
||||||
|
#include "version.h"
|
||||||
#include "net/http_client.h"
|
#include "net/http_client.h"
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
|
|
||||||
|
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||||
|
#define MONERO_DEFAULT_LOG_CATEGORY "WalletAPI"
|
||||||
|
|
||||||
namespace epee {
|
namespace epee {
|
||||||
unsigned int g_test_dbg_lock_sleep = 0;
|
unsigned int g_test_dbg_lock_sleep = 0;
|
||||||
|
@ -443,6 +448,29 @@ std::string WalletManagerImpl::resolveOpenAlias(const std::string &address, bool
|
||||||
return addresses.front();
|
return addresses.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::tuple<bool, std::string, std::string, std::string, std::string> WalletManager::checkUpdates(const std::string &software, const std::string &subdir)
|
||||||
|
{
|
||||||
|
#ifdef BUILD_TAG
|
||||||
|
static const char buildtag[] = BOOST_PP_STRINGIZE(BUILD_TAG);
|
||||||
|
#else
|
||||||
|
static const char buildtag[] = "source";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
std::string version, hash;
|
||||||
|
MDEBUG("Checking for a new " << software << " version for " << buildtag);
|
||||||
|
if (!tools::check_updates(software, buildtag, version, hash))
|
||||||
|
return std::make_tuple(false, "", "", "", "");
|
||||||
|
|
||||||
|
if (tools::vercmp(version.c_str(), MONERO_VERSION) > 0)
|
||||||
|
{
|
||||||
|
std::string user_url = tools::get_update_url(software, subdir, buildtag, version, true);
|
||||||
|
std::string auto_url = tools::get_update_url(software, subdir, buildtag, version, false);
|
||||||
|
MGINFO("Version " << version << " of " << software << " for " << buildtag << " is available: " << user_url << ", SHA256 hash " << hash);
|
||||||
|
return std::make_tuple(true, version, hash, user_url, auto_url);
|
||||||
|
}
|
||||||
|
return std::make_tuple(false, "", "", "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////// WalletManagerFactory implementation //////////////////////
|
///////////////////// WalletManagerFactory implementation //////////////////////
|
||||||
WalletManager *WalletManagerFactory::getWalletManager()
|
WalletManager *WalletManagerFactory::getWalletManager()
|
||||||
|
|
|
@ -703,6 +703,9 @@ struct WalletManager
|
||||||
|
|
||||||
//! resolves an OpenAlias address to a monero address
|
//! resolves an OpenAlias address to a monero address
|
||||||
virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const = 0;
|
virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const = 0;
|
||||||
|
|
||||||
|
//! checks for an update and returns version, hash and url
|
||||||
|
static std::tuple<bool, std::string, std::string, std::string, std::string> checkUpdates(const std::string &software, const std::string &subdir);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue