This commit is contained in:
DavidXanatos 2023-07-09 11:43:45 +02:00
parent b98d1cb831
commit 62f5a0ab05
3 changed files with 11 additions and 20 deletions

View File

@ -2337,7 +2337,7 @@ void CSandMan::CheckSupport()
return;
static bool ReminderShown = false;
if (!ReminderShown && (g_CertInfo.expired || g_CertInfo.about_to_expire) && !theConf->GetBool("Options/NoSupportCheck", false))
if (!ReminderShown && (g_CertInfo.expired || (g_CertInfo.expirers_in_sec > 0 && g_CertInfo.expirers_in_sec < (60 * 60 * 24 * 30))) && !theConf->GetBool("Options/NoSupportCheck", false))
{
ReminderShown = true;
CSettingsWindow* pSettingsWindow = new CSettingsWindow(this);
@ -2629,14 +2629,13 @@ void CSandMan::UpdateCertState()
}
else
{
g_CertInfo.about_to_expire = g_CertInfo.expirers_in_sec > 0 && g_CertInfo.expirers_in_sec < (60 * 60 * 24 * 30);
if (g_CertInfo.outdated)
OnLogMessage(tr("The supporter certificate is not valid for this build, please get an updated certificate"));
// outdated always implicates it is no longer valid
else if (g_CertInfo.expired) // may be still valid for the current and older builds
OnLogMessage(tr("The supporter certificate has expired%1, please get an updated certificate")
.arg(!g_CertInfo.outdated ? tr(", but it remains valid for the current build") : ""));
else if (g_CertInfo.about_to_expire)
else if (g_CertInfo.expirers_in_sec > 0 && g_CertInfo.expirers_in_sec < (60 * 60 * 24 * 30))
OnLogMessage(tr("The supporter certificate will expire in %1 days, please get an updated certificate").arg(g_CertInfo.expirers_in_sec / (60 * 60 * 24)));
}

View File

@ -1045,16 +1045,16 @@ void CSettingsWindow::UpdateCert()
QString infoMsg = tr("This supporter certificate has expired, please <a href=\"sbie://update/cert\">get an updated certificate</a>.");
if (g_CertInfo.valid) {
if (g_CertInfo.grace_period)
infoMsg.append(tr("<br /><font color='red'>Plus features will be disabled in %1 days.</font>").arg(30 + g_CertInfo.expirers_in_sec / (60*60*24)));
infoMsg.append(tr("<br /><font color='red'>Plus features will be disabled in %1 days.</font>").arg((g_CertInfo.expirers_in_sec + 30*60*60*24) / (60*60*24)));
else if (!g_CertInfo.outdated) // must be an expiren medium or large cert on an old build
infoMsg.append(tr("<br /><font color='red'>For this build Plus features remain enabled.</font>"));
infoMsg.append(tr("<br /><font color='red'>For the current build Plus features remain enabled</font>, but you no longer have access to Sandboxie-Live services, including compatibility updates and the troubleshooting database."));
} else
infoMsg.append(tr("<br />Plus features are no longer enabled."));
ui.lblCertExp->setText(infoMsg);
ui.lblCertExp->setVisible(true);
}
else {
if (g_CertInfo.about_to_expire) {
if (g_CertInfo.expirers_in_sec > 0 && g_CertInfo.expirers_in_sec < (60 * 60 * 24 * 30)) {
ui.lblCertExp->setText(tr("This supporter certificate will <font color='red'>expire in %1 days</font>, please <a href=\"sbie://update/cert\">get an updated certificate</a>.").arg(g_CertInfo.expirers_in_sec / (60*60*24)));
ui.lblCertExp->setVisible(true);
}
@ -1479,10 +1479,12 @@ bool CSettingsWindow::ApplyCertificate(const QByteArray &Certificate, QWidget* w
theGUI->UpdateCertState();
if (g_CertInfo.expired || g_CertInfo.outdated) {
if(g_CertInfo.expired)
QMessageBox::information(widget, "Sandboxie-Plus", tr("This certificate is unfortunately expired."));
if(g_CertInfo.outdated)
QMessageBox::information(widget, "Sandboxie-Plus", tr("This certificate is unfortunately not valid for the current build, you need to get a new certificate or downgrade to an earlier build."));
else if(g_CertInfo.valid && !g_CertInfo.grace_period)
QMessageBox::information(widget, "Sandboxie-Plus", tr("Although this certificate has expired, for the currently installed version plus features remain enabled. However, you will no longer have access to Sandboxie-Live services, including compatibility updates and the online troubleshooting database."));
else
QMessageBox::information(widget, "Sandboxie-Plus", tr("This certificate is unfortunately outdated."));
QMessageBox::information(widget, "Sandboxie-Plus", tr("This certificate has unfortunately expired, you need to get a new certificate."));
}
else {
QMessageBox::information(widget, "Sandboxie-Plus", tr("Thank you for supporting the development of Sandboxie-Plus."));
@ -2021,13 +2023,6 @@ void CSettingsWindow::CertChanged()
void CSettingsWindow::LoadCertificate(QString CertPath)
{
#ifdef _DEBUG
if (GetKeyState(VK_CONTROL) & 0x8000) {
g_Certificate.clear();
return;
}
#endif
if (theAPI && theAPI->IsConnected())
CertPath = theAPI->GetSbiePath() + "\\Certificate.dat";

View File

@ -207,10 +207,7 @@ union SCertInfo {
reservd_3 : 8,
reservd_4 : 7,
insider : 1;
qint32
expirers_in_sec : 30,
unused_1 : 1, // skim a couple high bits to use as flags flag, 0x3fffffff -> is 34 years count down is enough
about_to_expire : 1;
qint32 expirers_in_sec;
};
};
extern SCertInfo g_CertInfo;