1
0
forked from BRT/arc

Remove unused "notes" field from update mechanism and refactor version availability prompts for improved clarity.

This commit is contained in:
slava 2026-05-30 14:14:55 +05:00
parent 92e754ef6b
commit 63fa25a087
4 changed files with 16 additions and 11 deletions

View File

@ -128,7 +128,7 @@ if %ERRORLEVEL% neq 0 (
REM Генерируем version.json (UTF-8 без BOM — иначе QJsonDocument::fromJson падает)
REM и заливаем последним.
powershell -NoProfile -Command "$j = @{ latestVersion='!CURRENT_VERSION!'; zipUrl='!DOWNLOAD_URL!'; sha256='!ZIP_SHA256!'; minVersion='1.0.0'; notes='Обновление ARC'; mandatory=$false } | ConvertTo-Json; [System.IO.File]::WriteAllText('%PROJECT_DIR%version.json', $j, (New-Object System.Text.UTF8Encoding($false)))"
powershell -NoProfile -Command "$j = @{ latestVersion='!CURRENT_VERSION!'; zipUrl='!DOWNLOAD_URL!'; sha256='!ZIP_SHA256!'; minVersion='1.0.0'; mandatory=$false } | ConvertTo-Json; [System.IO.File]::WriteAllText('%PROJECT_DIR%version.json', $j, (New-Object System.Text.UTF8Encoding($false)))"
curl -f -s -S -T "%PROJECT_DIR%version.json" -u "%UPDATE_USER%:%UPDATE_PASS%" "%UPDATE_BASE%/version.json"
if %ERRORLEVEL% neq 0 (
echo ERROR: Failed to upload version.json to update server

View File

@ -92,7 +92,6 @@ void UpdateService::checkForUpdates() {
const QString latest = o.value("latestVersion").toString();
const QString zipUrl = o.value("zipUrl").toString();
const QString sha = o.value("sha256").toString();
const QString notes = o.value("notes").toString();
if (latest.isEmpty() || zipUrl.isEmpty()) {
emit checkFailed(QStringLiteral("В манифесте нет latestVersion/zipUrl"));
return;
@ -102,7 +101,7 @@ void UpdateService::checkForUpdates() {
emit upToDate(m_currentVersion);
return;
}
emit updateAvailable(latest, notes, zipUrl, sha);
emit updateAvailable(latest, zipUrl, sha);
}
void UpdateService::downloadAndApply(const QString &zipUrl,

View File

@ -39,7 +39,7 @@ public slots:
signals:
void upToDate(const QString &currentVersion);
void updateAvailable(const QString &newVersion, const QString &notes,
void updateAvailable(const QString &newVersion,
const QString &zipUrl, const QString &sha256);
void checkFailed(const QString &reason);
void downloadProgress(qint64 received, qint64 total);

View File

@ -199,14 +199,20 @@ void MainWindow::checkForUpdates() {
});
connect(svc, &UpdateService::updateAvailable, this,
[this, svc, reEnable](const QString &ver, const QString &notes,
[this, svc, reEnable](const QString &ver,
const QString &zipUrl, const QString &sha) {
QString text = QString("Доступна новая версия: %1.\nУстановить сейчас?\n\n"
const QString text = QString("Доступна новая версия: %1.\nУстановить сейчас?\n\n"
"Приложение перезапустится автоматически.").arg(ver);
if (!notes.isEmpty()) text += "\n\n" + notes;
const auto btn = QMessageBox::question(this, "Обновление", text,
QMessageBox::Yes | QMessageBox::No);
if (btn != QMessageBox::Yes) {
// Кнопки задаём вручную — стандартные Yes/No берут английские подписи
// из локализации Qt (как в остальных диалогах приложения).
QMessageBox confirmBox(this);
confirmBox.setWindowTitle("Обновление");
confirmBox.setText(text);
confirmBox.setIcon(QMessageBox::Question);
auto *yesBtn = confirmBox.addButton("Обновить", QMessageBox::YesRole);
confirmBox.addButton("Позже", QMessageBox::NoRole);
confirmBox.exec();
if (confirmBox.clickedButton() != yesBtn) {
reEnable();
svc->deleteLater();
return;