Notify activation when skipping or using serial #4932
This commit is contained in:
parent
4d20a3ce91
commit
a4c799c285
|
@ -71,6 +71,12 @@ QString CoreInterface::checkSubscription()
|
||||||
return run(args);
|
return run(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CoreInterface::notifyActivation(const QString& input)
|
||||||
|
{
|
||||||
|
QStringList args("--notify-activation");
|
||||||
|
return run(args, input);
|
||||||
|
}
|
||||||
|
|
||||||
QString CoreInterface::run(const QStringList& args, const QString& input)
|
QString CoreInterface::run(const QStringList& args, const QString& input)
|
||||||
{
|
{
|
||||||
QString program(
|
QString program(
|
||||||
|
|
|
@ -31,5 +31,6 @@ public:
|
||||||
QString getSubscriptionFilename();
|
QString getSubscriptionFilename();
|
||||||
QString activateSerial(const QString& serial);
|
QString activateSerial(const QString& serial);
|
||||||
QString checkSubscription();
|
QString checkSubscription();
|
||||||
|
QString notifyActivation(const QString& input);
|
||||||
QString run(const QStringList& args, const QString& input = "");
|
QString run(const QStringList& args, const QString& input = "");
|
||||||
};
|
};
|
||||||
|
|
|
@ -216,6 +216,17 @@ void SetupWizard::accept()
|
||||||
if (m_pRadioButtonSubscription->isChecked())
|
if (m_pRadioButtonSubscription->isChecked())
|
||||||
{
|
{
|
||||||
appConfig.setSerialKey(m_pLineEditSerialKey->text());
|
appConfig.setSerialKey(m_pLineEditSerialKey->text());
|
||||||
|
|
||||||
|
QString info("serial:" + hash(getFirstMacAddress()) + "\n");
|
||||||
|
CoreInterface coreInterface;
|
||||||
|
coreInterface.notifyActivation(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pRadioButtonSkip->isChecked())
|
||||||
|
{
|
||||||
|
QString info("skip:" + hash(getFirstMacAddress()) + "\n");
|
||||||
|
CoreInterface coreInterface;
|
||||||
|
coreInterface.notifyActivation(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_MainWindow.setEdition(m_Edition);
|
m_MainWindow.setEdition(m_Edition);
|
||||||
|
|
|
@ -94,6 +94,6 @@ QString WebClient::request(
|
||||||
{
|
{
|
||||||
QStringList args("--login-auth");
|
QStringList args("--login-auth");
|
||||||
// hash password in case it contains interesting chars.
|
// hash password in case it contains interesting chars.
|
||||||
QString credentials(email + ":" + hash(password) + "\n");
|
QString credentials(email + ":" + hash(password) + ":" + hash(getFirstMacAddress()) + "\n");
|
||||||
return m_CoreInterface.run(args, credentials);
|
return m_CoreInterface.run(args, credentials);
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,6 +211,10 @@ ArgParser::parseToolArgs(ToolArgs& args, int argc, const char* const* argv)
|
||||||
args.m_checkSubscription = true;
|
args.m_checkSubscription = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (isArg(i, argc, argv, NULL, "--notify-activation", 0)) {
|
||||||
|
args.m_notifyActivation = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,9 @@ ToolApp::run(int argc, char** argv)
|
||||||
return kExitSubscription;
|
return kExitSubscription;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (m_args.m_notifyActivation) {
|
||||||
|
notifyActivation();
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
throw XSynergy("Nothing to do");
|
throw XSynergy("Nothing to do");
|
||||||
}
|
}
|
||||||
|
@ -149,14 +152,17 @@ ToolApp::loginAuth()
|
||||||
String credentials;
|
String credentials;
|
||||||
std::cin >> credentials;
|
std::cin >> credentials;
|
||||||
|
|
||||||
size_t separator = credentials.find(':');
|
size_t separator1 = credentials.find(':');
|
||||||
String email = credentials.substr(0, separator);
|
size_t separator2 = credentials.find(':', separator1 + 1);
|
||||||
String password = credentials.substr(separator + 1, credentials.length());
|
String email = credentials.substr(0, separator1);
|
||||||
|
String password = credentials.substr(separator1 + 1, separator2 - separator1 - 1);
|
||||||
|
String macHash = credentials.substr(separator2 + 1, credentials.length() - separator2 - 1);
|
||||||
|
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << JSON_URL << "auth/";
|
ss << JSON_URL << "auth/";
|
||||||
ss << "?email=" << ARCH->internet().urlEncode(email);
|
ss << "?email=" << ARCH->internet().urlEncode(email);
|
||||||
ss << "&password=" << password;
|
ss << "&password=" << password;
|
||||||
|
ss << "&mac=" << macHash;
|
||||||
ss << "&os=" << ARCH->internet().urlEncode(ARCH->getOSName());
|
ss << "&os=" << ARCH->internet().urlEncode(ARCH->getOSName());
|
||||||
ss << "&arch=" << ARCH->internet().urlEncode(ARCH->getPlatformName());
|
ss << "&arch=" << ARCH->internet().urlEncode(ARCH->getPlatformName());
|
||||||
|
|
||||||
|
@ -180,3 +186,23 @@ ToolApp::getPluginList()
|
||||||
|
|
||||||
std::cout << ARCH->internet().get(ss.str()) << std::endl;
|
std::cout << ARCH->internet().get(ss.str()) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ToolApp::notifyActivation()
|
||||||
|
{
|
||||||
|
String info;
|
||||||
|
std::cin >> info;
|
||||||
|
|
||||||
|
size_t separator = info.find(':');
|
||||||
|
String action = info.substr(0, separator);
|
||||||
|
String macHash = info.substr(separator + 1, info.length());
|
||||||
|
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << JSON_URL << "notify/";
|
||||||
|
ss << "?action=" << action;
|
||||||
|
ss << "&mac=" << macHash;
|
||||||
|
ss << "&os=" << ARCH->internet().urlEncode(ARCH->getOSName());
|
||||||
|
ss << "&arch=" << ARCH->internet().urlEncode(ARCH->getPlatformName());
|
||||||
|
|
||||||
|
std::cout << ARCH->internet().get(ss.str()) << std::endl;
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void loginAuth();
|
void loginAuth();
|
||||||
void getPluginList();
|
void getPluginList();
|
||||||
|
void notifyActivation();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ToolArgs m_args;
|
ToolArgs m_args;
|
||||||
|
|
|
@ -27,6 +27,7 @@ ToolArgs::ToolArgs() :
|
||||||
m_getArch(false),
|
m_getArch(false),
|
||||||
m_getSubscriptionFilename(false),
|
m_getSubscriptionFilename(false),
|
||||||
m_checkSubscription(false),
|
m_checkSubscription(false),
|
||||||
|
m_notifyActivation(false),
|
||||||
m_subscriptionSerial()
|
m_subscriptionSerial()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,5 +33,6 @@ public:
|
||||||
bool m_getArch;
|
bool m_getArch;
|
||||||
bool m_getSubscriptionFilename;
|
bool m_getSubscriptionFilename;
|
||||||
bool m_checkSubscription;
|
bool m_checkSubscription;
|
||||||
|
bool m_notifyActivation;
|
||||||
String m_subscriptionSerial;
|
String m_subscriptionSerial;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue