mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
wallet_api: checkUpdate - optional version and buildtag params
This commit is contained in:
parent
6c7d928f19
commit
09abca76ae
2 changed files with 19 additions and 7 deletions
|
@ -1291,7 +1291,11 @@ struct WalletManager
|
||||||
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
|
//! 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, std::string subdir);
|
static std::tuple<bool, std::string, std::string, std::string, std::string> checkUpdates(
|
||||||
|
const std::string &software,
|
||||||
|
std::string subdir,
|
||||||
|
const char *buildtag = nullptr,
|
||||||
|
const char *current_version = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -341,22 +341,30 @@ 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, std::string subdir)
|
std::tuple<bool, std::string, std::string, std::string, std::string> WalletManager::checkUpdates(
|
||||||
|
const std::string &software,
|
||||||
|
std::string subdir,
|
||||||
|
const char *buildtag/* = nullptr*/,
|
||||||
|
const char *current_version/* = nullptr*/)
|
||||||
{
|
{
|
||||||
|
if (buildtag == nullptr)
|
||||||
|
{
|
||||||
#ifdef BUILD_TAG
|
#ifdef BUILD_TAG
|
||||||
static const char buildtag[] = BOOST_PP_STRINGIZE(BUILD_TAG);
|
static const char buildtag_default[] = BOOST_PP_STRINGIZE(BUILD_TAG);
|
||||||
#else
|
#else
|
||||||
static const char buildtag[] = "source";
|
static const char buildtag_default[] = "source";
|
||||||
// Override the subdir string when built from source
|
// Override the subdir string when built from source
|
||||||
subdir = "source";
|
subdir = "source";
|
||||||
#endif
|
#endif
|
||||||
|
buildtag = buildtag_default;
|
||||||
|
}
|
||||||
|
|
||||||
std::string version, hash;
|
std::string version, hash;
|
||||||
MDEBUG("Checking for a new " << software << " version for " << buildtag);
|
MDEBUG("Checking for a new " << software << " version for " << buildtag);
|
||||||
if (!tools::check_updates(software, buildtag, version, hash))
|
if (!tools::check_updates(software, buildtag, version, hash))
|
||||||
return std::make_tuple(false, "", "", "", "");
|
return std::make_tuple(false, "", "", "", "");
|
||||||
|
|
||||||
if (tools::vercmp(version.c_str(), MONERO_VERSION) > 0)
|
if (tools::vercmp(version.c_str(), current_version != nullptr ? current_version : MONERO_VERSION) > 0)
|
||||||
{
|
{
|
||||||
std::string user_url = tools::get_update_url(software, subdir, buildtag, version, true);
|
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);
|
std::string auto_url = tools::get_update_url(software, subdir, buildtag, version, false);
|
||||||
|
|
Loading…
Reference in a new issue