Fix: offline activation key, reset grace period on activation, update checker, remove OpenBoard from preferences.ui
This commit is contained in:
parent
5c9555eec1
commit
17529615d1
1
release.json
Normal file
1
release.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"tag_name":"v1.0.0","target_commitish":"main","name":"SaiCore v1.0.0","body":"SaiCore v1.0.0 — отечественное ПО для интерактивных панелей и досок.\n\nВозможности:\n- Рисование, презентации, запись уроков\n- Работа с документами PDF\n- Кроссплатформенность: Astra Linux, Debian, Ubuntu\n- Проприетарная лицензия EULA\n- Пробный период 30 дней\n- Система лицензирования с grace period 7 дней\n\nПравообладатель: ООО «КАРУМА»","draft":false,"prerelease":false}
|
||||||
@ -3227,9 +3227,9 @@ hr { height: 1px; border-width: 0; }
|
|||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Cantarell'; font-size:10pt;"><br /></p>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Cantarell'; font-size:10pt;"><br /></p>
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">SaiCore — программное обеспечение для интерактивных панелей. © 2026 SaiCore. Все права защищены.</span></p>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">SaiCore — программное обеспечение для интерактивных панелей. © 2026 SaiCore. Все права защищены.</span></p>
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Cantarell'; font-size:10pt;"><br /></p>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Cantarell'; font-size:10pt;"><br /></p>
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">SaiCore основано на OpenBoard. OpenBoard является производным от Open-Sankoré. Open-Sankoré © 2010-2015 GIP ENA. Все права защищены.</span></p>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">SaiCore разработано ООО «КАРУМА». Все права защищены.</span></p>
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Cantarell'; font-size:10pt;"><br /></p>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Cantarell'; font-size:10pt;"><br /></p>
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">SaiCore — свободное программное обеспечение: вы можете распространять и изменять его на условиях GNU General Public License версии 3, опубликованной Free Software Foundation. Исходный код доступен на </span><a href="https://saicore.ru"><span style=" font-family:'Cantarell'; font-size:10pt; text-decoration: underline; color:#0000ff;">saicore.ru</span></a><span style=" font-family:'Cantarell'; font-size:10pt;">.</span></p>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">SaiCore — проприетарное программное обеспечение ООО «КАРУМА». Использование без лицензионного ключа допускается только в течение пробного периода (30 дней). Подробнее: </span><a href="https://saicore.ru"><span style=" font-family:'Cantarell'; font-size:10pt; text-decoration: underline; color:#0000ff;">saicore.ru</span></a><span style=" font-family:'Cantarell'; font-size:10pt;">.</span></p>
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Cantarell'; font-size:10pt;"><br /></p>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Cantarell'; font-size:10pt;"><br /></p>
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">Контактная информация:</span></p>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:10pt;">Контактная информация:</span></p>
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://saicore.ru"><span style=" font-family:'Cantarell'; font-size:10pt; text-decoration: underline; color:#0000ff;">saicore.ru</span></a></p></td></tr></table></body></html></string>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://saicore.ru"><span style=" font-family:'Cantarell'; font-size:10pt; text-decoration: underline; color:#0000ff;">saicore.ru</span></a></p></td></tr></table></body></html></string>
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
UBLicenseManager* UBLicenseManager::sInstance = nullptr;
|
UBLicenseManager* UBLicenseManager::sInstance = nullptr;
|
||||||
|
|
||||||
const QString LICENSE_SERVER_URL = "https://license.saicore.ru/api/activate";
|
const QString LICENSE_SERVER_URL = "https://license.saicore.ru/api/activate";
|
||||||
|
const QString UPDATE_CHECK_URL = "https://license.saicore.ru/api/check_update";
|
||||||
const int TRIAL_DURATION_DAYS = 30;
|
const int TRIAL_DURATION_DAYS = 30;
|
||||||
const int GRACE_PERIOD_DAYS = 7;
|
const int GRACE_PERIOD_DAYS = 7;
|
||||||
|
|
||||||
@ -311,6 +312,8 @@ bool UBLicenseManager::activateLicense(const QString& key)
|
|||||||
json["product"] = "SaiCore";
|
json["product"] = "SaiCore";
|
||||||
json["version"] = "1.0.0";
|
json["version"] = "1.0.0";
|
||||||
|
|
||||||
|
mPendingActivationKey = key.trimmed().toUpper();
|
||||||
|
|
||||||
QNetworkReply* reply = mNetworkManager->post(request, QJsonDocument(json).toJson(QJsonDocument::Compact));
|
QNetworkReply* reply = mNetworkManager->post(request, QJsonDocument(json).toJson(QJsonDocument::Compact));
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply]() { onActivationReply(reply); });
|
connect(reply, &QNetworkReply::finished, this, [this, reply]() { onActivationReply(reply); });
|
||||||
|
|
||||||
@ -323,10 +326,11 @@ void UBLicenseManager::onActivationReply(QNetworkReply* reply)
|
|||||||
|
|
||||||
if (reply->error() != QNetworkReply::NoError)
|
if (reply->error() != QNetworkReply::NoError)
|
||||||
{
|
{
|
||||||
if (validateLicenseOffline(mLicenseKey))
|
if (validateLicenseOffline(mPendingActivationKey))
|
||||||
{
|
{
|
||||||
mLicenseKey = reply->property("key").toString();
|
mLicenseKey = mPendingActivationKey;
|
||||||
mLicenseExpiry = QDateTime::currentDateTime().addYears(1);
|
mLicenseExpiry = QDateTime::currentDateTime().addYears(1);
|
||||||
|
mGracePeriodStart = QDateTime();
|
||||||
mState = LicenseActive;
|
mState = LicenseActive;
|
||||||
saveState();
|
saveState();
|
||||||
emit licenseStateChanged(mState);
|
emit licenseStateChanged(mState);
|
||||||
@ -354,6 +358,7 @@ void UBLicenseManager::onActivationReply(QNetworkReply* reply)
|
|||||||
|
|
||||||
mLicenseKey = obj.value("license_key").toString();
|
mLicenseKey = obj.value("license_key").toString();
|
||||||
mLicenseExpiry = expiry;
|
mLicenseExpiry = expiry;
|
||||||
|
mGracePeriodStart = QDateTime();
|
||||||
mState = LicenseActive;
|
mState = LicenseActive;
|
||||||
saveState();
|
saveState();
|
||||||
emit licenseStateChanged(mState);
|
emit licenseStateChanged(mState);
|
||||||
@ -389,3 +394,48 @@ void UBLicenseManager::deactivateLicense()
|
|||||||
saveState();
|
saveState();
|
||||||
emit licenseStateChanged(mState);
|
emit licenseStateChanged(mState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UBLicenseManager::checkForUpdates()
|
||||||
|
{
|
||||||
|
QNetworkRequest request;
|
||||||
|
request.setUrl(QUrl(UPDATE_CHECK_URL));
|
||||||
|
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
request.setRawHeader("User-Agent", "SaiCore/1.0.0");
|
||||||
|
|
||||||
|
QJsonObject json;
|
||||||
|
json["version"] = "1.0.0";
|
||||||
|
json["platform"] = QSysInfo::productType();
|
||||||
|
|
||||||
|
QNetworkReply* reply = mNetworkManager->post(request, QJsonDocument(json).toJson(QJsonDocument::Compact));
|
||||||
|
connect(reply, &QNetworkReply::finished, this, [this, reply]() { onUpdateCheckReply(reply); });
|
||||||
|
}
|
||||||
|
|
||||||
|
void UBLicenseManager::onUpdateCheckReply(QNetworkReply* reply)
|
||||||
|
{
|
||||||
|
reply->deleteLater();
|
||||||
|
|
||||||
|
if (reply->error() != QNetworkReply::NoError)
|
||||||
|
{
|
||||||
|
qWarning() << "Update check failed:" << reply->errorString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray data = reply->readAll();
|
||||||
|
QJsonDocument doc = QJsonDocument::fromJson(data);
|
||||||
|
QJsonObject obj = doc.object();
|
||||||
|
|
||||||
|
bool hasUpdate = obj.value("update_available").toBool(false);
|
||||||
|
if (hasUpdate)
|
||||||
|
{
|
||||||
|
QString version = obj.value("latest_version").toString();
|
||||||
|
QString downloadUrl = obj.value("download_url").toString();
|
||||||
|
QString changelog = obj.value("changelog").toString();
|
||||||
|
|
||||||
|
qInfo() << "Update available:" << version;
|
||||||
|
emit updateAvailable(version, downloadUrl, changelog);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug() << "SaiCore is up to date";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -59,6 +59,7 @@ public:
|
|||||||
bool activateLicense(const QString& key);
|
bool activateLicense(const QString& key);
|
||||||
bool validateLicenseFormat(const QString& key) const;
|
bool validateLicenseFormat(const QString& key) const;
|
||||||
bool validateLicenseOffline(const QString& key) const;
|
bool validateLicenseOffline(const QString& key) const;
|
||||||
|
void checkForUpdates();
|
||||||
|
|
||||||
void startTrial();
|
void startTrial();
|
||||||
void deactivateLicense();
|
void deactivateLicense();
|
||||||
@ -68,9 +69,11 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void licenseStateChanged(LicenseState newState);
|
void licenseStateChanged(LicenseState newState);
|
||||||
void activationResult(bool success, const QString& message);
|
void activationResult(bool success, const QString& message);
|
||||||
|
void updateAvailable(const QString& version, const QString& downloadUrl, const QString& changelog);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onActivationReply(QNetworkReply* reply);
|
void onActivationReply(QNetworkReply* reply);
|
||||||
|
void onUpdateCheckReply(QNetworkReply* reply);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UBLicenseManager(QObject* parent = nullptr);
|
UBLicenseManager(QObject* parent = nullptr);
|
||||||
@ -84,6 +87,7 @@ private:
|
|||||||
QDateTime mTrialStart;
|
QDateTime mTrialStart;
|
||||||
QDateTime mLicenseExpiry;
|
QDateTime mLicenseExpiry;
|
||||||
QDateTime mGracePeriodStart;
|
QDateTime mGracePeriodStart;
|
||||||
|
QString mPendingActivationKey;
|
||||||
QNetworkAccessManager* mNetworkManager;
|
QNetworkAccessManager* mNetworkManager;
|
||||||
static const int GRACE_PERIOD_DAYS = 7;
|
static const int GRACE_PERIOD_DAYS = 7;
|
||||||
|
|
||||||
|
|||||||
@ -222,6 +222,13 @@ int main(int argc, char *argv[])
|
|||||||
<< "days remaining. License required.";
|
<< "days remaining. License required.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QObject::connect(licenseManager, &UBLicenseManager::updateAvailable,
|
||||||
|
[](const QString& version, const QString& url, const QString& changelog) {
|
||||||
|
qDebug() << "Update available:" << version << url;
|
||||||
|
});
|
||||||
|
|
||||||
|
licenseManager->checkForUpdates();
|
||||||
|
|
||||||
qDebug() << "file name argument" << fileToOpen;
|
qDebug() << "file name argument" << fileToOpen;
|
||||||
result = app.exec(fileToOpen);
|
result = app.exec(fileToOpen);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user