#5707 Add support for upgrade notifications
This commit is contained in:
parent
9f1e91cc76
commit
2de06b9727
|
@ -62,6 +62,12 @@ QString CoreInterface::getSerialKeyFilePath()
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CoreInterface::notifyUpgrade (QString const& version,
|
||||||
|
QString const& serialKey) {
|
||||||
|
QStringList args("--notify-upgrade");
|
||||||
|
QString input(version + ":" + serialKey);
|
||||||
|
return run(args, input);
|
||||||
|
}
|
||||||
|
|
||||||
QString CoreInterface::notifyActivation(const QString& identity)
|
QString CoreInterface::notifyActivation(const QString& identity)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,5 +29,6 @@ public:
|
||||||
QString getArch();
|
QString getArch();
|
||||||
QString getSerialKeyFilePath();
|
QString getSerialKeyFilePath();
|
||||||
QString notifyActivation(const QString& identity);
|
QString notifyActivation(const QString& identity);
|
||||||
|
QString notifyUpgrade (QString const& version, QString const& serialKey);
|
||||||
QString run(const QStringList& args, const QString& input = "");
|
QString run(const QStringList& args, const QString& input = "");
|
||||||
};
|
};
|
||||||
|
|
|
@ -71,6 +71,11 @@ LicenseManager::setSerialKey(QString serialKeyString, bool acceptExpired)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LicenseManager::notifyUpdate(QString version) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Edition
|
Edition
|
||||||
LicenseManager::activeEdition() const
|
LicenseManager::activeEdition() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,7 @@ public:
|
||||||
QString activeEditionName() const;
|
QString activeEditionName() const;
|
||||||
SerialKey serialKey() const;
|
SerialKey serialKey() const;
|
||||||
void skipActivation();
|
void skipActivation();
|
||||||
|
void notifyUpdate(QString version);
|
||||||
static QString getEditionName(Edition edition, bool trial = false);
|
static QString getEditionName(Edition edition, bool trial = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -208,6 +208,10 @@ ArgParser::parseToolArgs(ToolArgs& args, int argc, const char* const* argv)
|
||||||
args.m_notifyActivation = true;
|
args.m_notifyActivation = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (isArg(i, argc, argv, NULL, "--notify-upgrade", 0)) {
|
||||||
|
args.m_notifyUpgrade = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*
|
/*
|
||||||
* synergy -- mouse and keyboard sharing utility
|
* synergy -- mouse and keyboard sharing utility
|
||||||
* Copyright (C) 2014-2016 Symless Ltd.
|
* Copyright (C) 2014-2016 Symless Ltd.
|
||||||
*
|
*
|
||||||
* This package is free software; you can redistribute it and/or
|
* This package is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
* found in the file LICENSE that should have accompanied this file.
|
||||||
*
|
*
|
||||||
* This package is distributed in the hope that it will be useful,
|
* This package is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
@ -80,6 +80,9 @@ ToolApp::run(int argc, char** argv)
|
||||||
else if (m_args.m_getArch) {
|
else if (m_args.m_getArch) {
|
||||||
std::cout << ARCH->getPlatformName() << std::endl;
|
std::cout << ARCH->getPlatformName() << std::endl;
|
||||||
}
|
}
|
||||||
|
else if (m_args.m_notifyUpgrade) {
|
||||||
|
notifyUpgrade();
|
||||||
|
}
|
||||||
else if (m_args.m_notifyActivation) {
|
else if (m_args.m_notifyActivation) {
|
||||||
notifyActivation();
|
notifyActivation();
|
||||||
}
|
}
|
||||||
|
@ -134,7 +137,29 @@ ToolApp::loginAuth()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
ToolApp::notifyUpgrade()
|
||||||
|
{
|
||||||
|
String data;
|
||||||
|
std::cin >> data;
|
||||||
|
|
||||||
|
std::vector<String> parts = synergy::string::splitString(data, ':');
|
||||||
|
size_t count = parts.size();
|
||||||
|
|
||||||
|
if (count == 2) {
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << JSON_URL << "notify/upgraded/";
|
||||||
|
ss << "?version=" << parts[0];
|
||||||
|
ss << "&serial=" << parts[1];
|
||||||
|
|
||||||
|
std::cout << ARCH->internet().get(ss.str()) << std::endl;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw XSynergy("Invalid upgrade data.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
ToolApp::notifyActivation()
|
ToolApp::notifyActivation()
|
||||||
{
|
{
|
||||||
String info;
|
String info;
|
||||||
|
|
|
@ -30,6 +30,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void loginAuth();
|
void loginAuth();
|
||||||
void notifyActivation();
|
void notifyActivation();
|
||||||
|
void notifyUpgrade();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ToolArgs m_args;
|
ToolArgs m_args;
|
||||||
|
|
|
@ -23,6 +23,7 @@ ToolArgs::ToolArgs() :
|
||||||
m_getInstalledDir(false),
|
m_getInstalledDir(false),
|
||||||
m_getProfileDir(false),
|
m_getProfileDir(false),
|
||||||
m_getArch(false),
|
m_getArch(false),
|
||||||
m_notifyActivation(false)
|
m_notifyActivation(false),
|
||||||
|
m_notifyUpgrade(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,4 +30,5 @@ public:
|
||||||
bool m_getProfileDir;
|
bool m_getProfileDir;
|
||||||
bool m_getArch;
|
bool m_getArch;
|
||||||
bool m_notifyActivation;
|
bool m_notifyActivation;
|
||||||
|
bool m_notifyUpgrade;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue