QT: AutoUpdate - improvement message limit exceeded github (#2365)

This commit is contained in:
DanielSvoboda 2025-02-07 01:40:13 -03:00 committed by GitHub
parent 46cbee1585
commit 78b4f10cc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 126 additions and 2 deletions

View file

@ -67,8 +67,20 @@ void CheckUpdate::CheckForUpdates(const bool showMessage) {
connect(reply, &QNetworkReply::finished, this, [this, reply, showMessage, updateChannel]() {
if (reply->error() != QNetworkReply::NoError) {
QMessageBox::warning(this, tr("Error"),
QString(tr("Network error:") + "\n" + reply->errorString()));
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 403) {
QString response = reply->readAll();
if (response.startsWith("{\"message\":\"API rate limit exceeded for")) {
QMessageBox::warning(this, tr("Auto Updater"),
tr("Error_Github_limit_MSG").replace("\\n", "\n"));
} else {
QMessageBox::warning(
this, tr("Error"),
QString(tr("Network error:") + "\n" + reply->errorString()));
}
} else {
QMessageBox::warning(this, tr("Error"),
QString(tr("Network error:") + "\n" + reply->errorString()));
}
reply->deleteLater();
return;
}