license: Implemented new license format
* Implemented new format splitting user, version, and usage period into separate lines * Refactored all classes: License, LicenseGenerator, LicenseChecker * Removed redundant license check hash from ApplicationSettings, don't generate, store and check it anymore * Moved license checking and encoding logic to LicenseChecker * Moved default for license generation to main.cpp * Refactored license checking logic in whole app, removed involved message types * Added LicenseCheckerTestSuite for checking all legacy and current license types * Generate new license type lifelong
This commit is contained in:
@@ -53,20 +53,6 @@ bool ApplicationSettings::load(const FilePath& filePath, bool readOnly)
|
||||
"network/coati_port",
|
||||
"network/sourcetrail_port"
|
||||
));
|
||||
migrator.addMigration(3, std::make_shared<SettingsMigrationLambda>(
|
||||
[](const SettingsMigration* migration, Settings* settings)
|
||||
{
|
||||
License license;
|
||||
bool isLoaded = license.loadFromEncodedString(
|
||||
migration->getValueFromSettings<std::string>(settings, "user/license/license", ""), AppPath::getAppPath().str());
|
||||
if (isLoaded && license.isValid() && license.isNonCommercialLicenseType())
|
||||
{
|
||||
migration->removeValuesInSettings(settings, "user/license/license");
|
||||
migration->removeValuesInSettings(settings, "user/license/check");
|
||||
migration->setValueInSettings(settings, "user/license/non_commercial_use", true);
|
||||
}
|
||||
}
|
||||
));
|
||||
migrator.addMigration(4, std::make_shared<SettingsMigrationLambda>(
|
||||
[](const SettingsMigration* migration, Settings* settings)
|
||||
{
|
||||
@@ -680,16 +666,6 @@ void ApplicationSettings::setLicenseString(const std::string& licenseString)
|
||||
setValue<std::string>("user/license/license", licenseString);
|
||||
}
|
||||
|
||||
std::string ApplicationSettings::getLicenseCheck() const
|
||||
{
|
||||
return getValue<std::string>("user/license/check", "");
|
||||
}
|
||||
|
||||
void ApplicationSettings::setLicenseCheck(const std::string& hash)
|
||||
{
|
||||
setValue<std::string>("user/license/check", hash);
|
||||
}
|
||||
|
||||
bool ApplicationSettings::getNonCommercialUse() const
|
||||
{
|
||||
return getValue<bool>("user/license/non_commercial_use", false);
|
||||
|
||||
@@ -191,9 +191,6 @@ public:
|
||||
std::string getLicenseString() const;
|
||||
void setLicenseString(const std::string& licenseString);
|
||||
|
||||
std::string getLicenseCheck() const;
|
||||
void setLicenseCheck(const std::string& hash);
|
||||
|
||||
bool getNonCommercialUse() const;
|
||||
void setNonCommercialUse(bool nonCommercialUse);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user