Skip to content

Commit

Permalink
1.12.4
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidXanatos committed Dec 16, 2023
1 parent 841fba9 commit 20320d1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
28 changes: 15 additions & 13 deletions SandboxiePlus/SandMan/OnlineUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,27 @@ void COnlineUpdater::LoadState()

QString COnlineUpdater::GetOnNewUpdateOption() const
{
QString OnNewUpdate = theConf->GetString("Options/OnNewUpdate", "ignore");

QString ReleaseChannel = theConf->GetString("Options/ReleaseChannel", "stable");
if (ReleaseChannel != "preview" && (!g_CertInfo.active || g_CertInfo.expired)) // allow revisions for preview channel
if (ReleaseChannel != "preview" && (!g_CertInfo.active || g_CertInfo.expired)) // without active cert, allow revisions for preview channel
return "ignore"; // this service requires a valid certificate
return theConf->GetString("Options/OnNewUpdate", "ignore");

return OnNewUpdate;
}

QString COnlineUpdater::GetOnNewReleaseOption() const
{
QString OnNewRelease = theConf->GetString("Options/OnNewRelease", "download");
if ((g_CertInfo.active && g_CertInfo.expired) && OnNewRelease == "install")
return "download"; // disable auto update on an active but expired personal certificate

if (OnNewRelease == "install" || OnNewRelease == "download") {
QString ReleaseChannel = theConf->GetString("Options/ReleaseChannel", "stable");
if (ReleaseChannel != "preview" && (!g_CertInfo.active || g_CertInfo.expired)) // without active cert, allow automated updates only for preview channel
return "notify"; // this service requires a valid certificate
}

//if ((g_CertInfo.active && g_CertInfo.expired) && OnNewRelease == "install")
// return "download"; // disable auto update on an active but expired personal certificate
return OnNewRelease;
}

Expand Down Expand Up @@ -489,14 +499,6 @@ bool COnlineUpdater::HandleUpdate()

bool bAllowAuto = g_CertInfo.active && !g_CertInfo.expired; // To use automatic updates a valid certificate is required

//
// if we allow for version updates but not for automatic installation/download of new release
// ignore the release and install it using the version updater
//

if (bNewUpdate && bNewRelease && !bAllowAuto)
bNewRelease = false;

bool bCanRunInstaller = (m_CheckMode == eAuto && OnNewRelease == "install");
bool bIsInstallerReady = false;
if (bNewRelease)
Expand All @@ -512,7 +514,7 @@ bool COnlineUpdater::HandleUpdate()
// clear when not up to date
theConf->DelValue("Updater/InstallerVersion");

if ((bAllowAuto && (bCanRunInstaller || (m_CheckMode == eAuto && OnNewRelease == "download"))) || AskDownload(Release, bAllowAuto))
if ((bCanRunInstaller || (m_CheckMode == eAuto && OnNewRelease == "download")) || AskDownload(Release, bAllowAuto))
{
if (DownloadInstaller(Release, m_CheckMode == eManual))
return true;
Expand Down
7 changes: 5 additions & 2 deletions SandboxiePlus/SandMan/Windows/SettingsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1395,25 +1395,28 @@ void CSettingsWindow::UpdateUpdater()
{
ui.cmbInterval->setEnabled(true);

bool bAllowAuto;
if (ui.radStable->isChecked() && !bOk) {
ui.cmbUpdate->setEnabled(false);
ui.cmbUpdate->setCurrentIndex(ui.cmbUpdate->findData("ignore"));

ui.lblRevision->setText(tr("Supporter certificate required for access"));
bAllowAuto = false;
} else {
ui.cmbUpdate->setEnabled(true);

ui.lblRevision->setText(QString());
bAllowAuto = true;
}

ui.cmbRelease->setEnabled(true);
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(ui.cmbRelease->model());
for (int i = 1; i < ui.cmbRelease->count(); i++) {
QStandardItem* item = model->item(i);
item->setFlags(bOk ? (item->flags() | Qt::ItemIsEnabled) : (item->flags() & ~Qt::ItemIsEnabled));
item->setFlags(bAllowAuto ? (item->flags() | Qt::ItemIsEnabled) : (item->flags() & ~Qt::ItemIsEnabled));
}

if(!bOk)
if(!bAllowAuto)
ui.lblRelease->setText(tr("Supporter certificate required for automation"));
else
ui.lblRelease->setText(QString());
Expand Down

0 comments on commit 20320d1

Please sign in to comment.