mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-26 12:41:35 +03:00
#5707 Add support for upgrade notifications
This commit is contained in:
parent
9f1e91cc76
commit
2de06b9727
@ -62,6 +62,12 @@ QString CoreInterface::getSerialKeyFilePath()
|
||||
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)
|
||||
{
|
||||
|
@ -29,5 +29,6 @@ public:
|
||||
QString getArch();
|
||||
QString getSerialKeyFilePath();
|
||||
QString notifyActivation(const QString& identity);
|
||||
QString notifyUpgrade (QString const& version, QString const& serialKey);
|
||||
QString run(const QStringList& args, const QString& input = "");
|
||||
};
|
||||
|
@ -71,6 +71,11 @@ LicenseManager::setSerialKey(QString serialKeyString, bool acceptExpired)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
LicenseManager::notifyUpdate(QString version) {
|
||||
|
||||
}
|
||||
|
||||
Edition
|
||||
LicenseManager::activeEdition() const
|
||||
{
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
QString activeEditionName() const;
|
||||
SerialKey serialKey() const;
|
||||
void skipActivation();
|
||||
void notifyUpdate(QString version);
|
||||
static QString getEditionName(Edition edition, bool trial = false);
|
||||
|
||||
private:
|
||||
|
@ -208,6 +208,10 @@ ArgParser::parseToolArgs(ToolArgs& args, int argc, const char* const* argv)
|
||||
args.m_notifyActivation = true;
|
||||
return true;
|
||||
}
|
||||
else if (isArg(i, argc, argv, NULL, "--notify-upgrade", 0)) {
|
||||
args.m_notifyUpgrade = true;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
@ -80,6 +80,9 @@ ToolApp::run(int argc, char** argv)
|
||||
else if (m_args.m_getArch) {
|
||||
std::cout << ARCH->getPlatformName() << std::endl;
|
||||
}
|
||||
else if (m_args.m_notifyUpgrade) {
|
||||
notifyUpgrade();
|
||||
}
|
||||
else if (m_args.m_notifyActivation) {
|
||||
notifyActivation();
|
||||
}
|
||||
@ -134,6 +137,28 @@ ToolApp::loginAuth()
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
private:
|
||||
void loginAuth();
|
||||
void notifyActivation();
|
||||
void notifyUpgrade();
|
||||
|
||||
private:
|
||||
ToolArgs m_args;
|
||||
|
@ -23,6 +23,7 @@ ToolArgs::ToolArgs() :
|
||||
m_getInstalledDir(false),
|
||||
m_getProfileDir(false),
|
||||
m_getArch(false),
|
||||
m_notifyActivation(false)
|
||||
m_notifyActivation(false),
|
||||
m_notifyUpgrade(false)
|
||||
{
|
||||
}
|
||||
|
@ -30,4 +30,5 @@ public:
|
||||
bool m_getProfileDir;
|
||||
bool m_getArch;
|
||||
bool m_notifyActivation;
|
||||
bool m_notifyUpgrade;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user