This commit is contained in:
DavidXanatos 2023-12-03 20:05:40 +01:00
parent 8222b621fb
commit 0ab9c47544
5 changed files with 82 additions and 31 deletions

View File

@ -10,6 +10,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- fixed running sandboxed processes located in a imdisk volume [#3472](https://github.com/sandboxie-plus/Sandboxie/discussions/3472)
### Changed
- without an active, non expired, supporter certificate, automatic updates/downloads are not longer available for the stable channel
- the autoamtic updater will still work and notify about new stable releases, the user will be guided to visit the download page and download the latest installer manually
## [1.12.3 / 5.67.3] - 2023-12-02

View File

@ -1722,7 +1722,7 @@
<string>Hotpatches for the installed version, updates to the Templates.ini and translations.</string>
</property>
<property name="text">
<string>Version Updates</string>
<string>Incremental Updates</string>
</property>
</widget>
</item>
@ -1754,13 +1754,6 @@ Unlike the preview channel, it does not include untested, potentially breaking,
</property>
</widget>
</item>
<item row="7" column="4" colspan="2">
<widget class="QLabel" name="lblRevision">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QComboBox" name="cmbUpdate"/>
</item>
@ -1780,10 +1773,10 @@ Unlike the preview channel, it does not include untested, potentially breaking,
<item row="8" column="2">
<widget class="QLabel" name="label_25">
<property name="toolTip">
<string>New full versions from the selected release channel.</string>
<string>New full installers from the selected release channel.</string>
</property>
<property name="text">
<string>New Versions</string>
<string>Full Upgrades</string>
</property>
</widget>
</item>
@ -1860,6 +1853,20 @@ Unlike the preview channel, it does not include untested, potentially breaking,
</property>
</widget>
</item>
<item row="7" column="4" colspan="3">
<widget class="QLabel" name="lblRevision">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="8" column="4" colspan="3">
<widget class="QLabel" name="lblRelease">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@ -446,6 +446,7 @@ bool COnlineUpdater::HandleUpdate()
{
QString PendingUpdate;
QString OnNewRelease = GetOnNewReleaseOption();
bool bNewRelease = false;
QVariantMap Release = m_UpdateData["release"].toMap();
QString ReleaseStr = Release["version"].toString();
@ -457,7 +458,6 @@ bool COnlineUpdater::HandleUpdate()
}
QString OnNewUpdate = GetOnNewUpdateOption();
bool bNewUpdate = false;
QVariantMap Update = m_UpdateData["update"].toMap();
QString UpdateStr = Update["version"].toString();
@ -486,7 +486,16 @@ bool COnlineUpdater::HandleUpdate()
// solution: apply updates silently, then prompt to install new release, else prioritize installing new releases over updating the existing one
//
QString OnNewRelease = GetOnNewReleaseOption();
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 instalation/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)
@ -502,7 +511,7 @@ bool COnlineUpdater::HandleUpdate()
// clear when not up to date
theConf->DelValue("Updater/InstallerVersion");
if ((bCanRunInstaller || (m_CheckMode == eAuto && OnNewRelease == "download")) || AskDownload(Release))
if ((bAllowAuto && (bCanRunInstaller || (m_CheckMode == eAuto && OnNewRelease == "download"))) || AskDownload(Release, bAllowAuto))
{
if (DownloadInstaller(Release, m_CheckMode == eManual))
return true;
@ -524,7 +533,7 @@ bool COnlineUpdater::HandleUpdate()
// clear when not up to date
theConf->DelValue("Updater/UpdateVersion");
if ((bCanApplyUpdate || (m_CheckMode == eAuto && OnNewUpdate == "download")) || AskDownload(Update))
if ((bCanApplyUpdate || (m_CheckMode == eAuto && OnNewUpdate == "download")) || AskDownload(Update, true))
{
if (DownloadUpdate(Update, m_CheckMode == eManual))
return true;
@ -555,7 +564,7 @@ bool COnlineUpdater::HandleUpdate()
return bNewRelease || bNewUpdate;
}
bool COnlineUpdater::AskDownload(const QVariantMap& Data)
bool COnlineUpdater::AskDownload(const QVariantMap& Data, bool bAuto)
{
QString VersionStr = MakeVersionStr(Data);
@ -568,12 +577,25 @@ bool COnlineUpdater::AskDownload(const QVariantMap& Data)
QVariantMap Installer = Data["installer"].toMap();
QString DownloadUrl = Installer["downloadUrl"].toString();
if (!DownloadUrl.isEmpty())
enum EAction
{
eNone = 0,
eDownload,
eNotify,
} Action = eNone;
if (bAuto && !DownloadUrl.isEmpty()) {
Action = eDownload;
FullMessage += tr("<p>Do you want to download the installer?</p>");
else if(Data.contains("files"))
}
else if (bAuto && Data.contains("files")) {
Action = eDownload;
FullMessage += tr("<p>Do you want to download the updates?</p>");
else if (!UpdateUrl.isEmpty())
FullMessage += tr("<p>Do you want to go to the <a href=\"%1\">update page</a>?</p>").arg(UpdateUrl);
}
else if (!UpdateUrl.isEmpty()) {
Action = eNotify;
FullMessage += tr("<p>Do you want to go to the <a href=\"%1\">download page</a>?</p>").arg(UpdateUrl);
}
CCheckableMessageBox mb(theGUI);
mb.setWindowTitle("Sandboxie-Plus");
@ -584,18 +606,18 @@ bool COnlineUpdater::AskDownload(const QVariantMap& Data)
mb.setCheckBoxText(tr("Don't show this update anymore."));
mb.setCheckBoxVisible(m_CheckMode != eManual);
if (!UpdateUrl.isEmpty() || !DownloadUrl.isEmpty() || Data.contains("files")) {
if (Action != eNone) {
mb.setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No | QDialogButtonBox::Cancel);
mb.setDefaultButton(QDialogButtonBox::Yes);
}
else
} else
mb.setStandardButtons(QDialogButtonBox::Ok);
mb.exec();
if (mb.clickedStandardButton() == QDialogButtonBox::Yes)
{
if (!DownloadUrl.isEmpty() || Data.contains("files")) {
if (Action == eDownload)
{
m_CheckMode = eManual;
return true;
}
@ -604,7 +626,8 @@ bool COnlineUpdater::AskDownload(const QVariantMap& Data)
}
else
{
if (mb.clickedStandardButton() == QDialogButtonBox::Cancel) {
if (mb.clickedStandardButton() == QDialogButtonBox::Cancel)
{
theConf->SetValue("Updater/PendingUpdate", "");
theGUI->UpdateLabel();
}

View File

@ -151,7 +151,7 @@ protected:
EUpdateScope ScanUpdateFiles(const QVariantMap& Update);
EUpdateScope GetFileScope(const QString& Path);
bool AskDownload(const QVariantMap& Update);
bool AskDownload(const QVariantMap& Update, bool bAuto);
static bool RunInstaller2(const QString& FilePath, bool bSilent);

View File

@ -1381,25 +1381,42 @@ QString CSettingsWindow::GetCertLevel()
void CSettingsWindow::UpdateUpdater()
{
bool bOk = (g_CertInfo.active && !g_CertInfo.expired);
//ui.radLive->setEnabled(false);
if (!ui.chkAutoUpdate->isChecked()) {
if (!ui.chkAutoUpdate->isChecked())
{
ui.cmbInterval->setEnabled(false);
ui.cmbUpdate->setEnabled(false);
ui.cmbRelease->setEnabled(false);
ui.lblRevision->setText(QString());
ui.lblRelease->setText(QString());
}
else {
else
{
ui.cmbInterval->setEnabled(true);
if (ui.radStable->isChecked() && (!g_CertInfo.active || g_CertInfo.expired)) {
if (ui.radStable->isChecked() && !bOk) {
ui.cmbUpdate->setEnabled(false);
ui.cmbUpdate->setCurrentIndex(ui.cmbUpdate->findData("ignore"));
ui.lblRevision->setText(tr("Supporter certificate required"));
}
else {
ui.lblRevision->setText(tr("Supporter certificate required for access"));
} else {
ui.cmbUpdate->setEnabled(true);
ui.lblRevision->setText(QString());
}
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));
}
if(!bOk)
ui.lblRelease->setText(tr("Supporter certificate required for automation"));
else
ui.lblRelease->setText(QString());
}
OnOptChanged();