feat(core): add option to ignore SSL errors (#1521)

This commit is contained in:
DeckerSU 2023-08-06 20:00:07 +02:00 committed by GitHub
parent 94247fd4d0
commit 9eb6169073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 2 deletions

View File

@ -66,6 +66,14 @@ Application::Application(QObject *parent)
m_fileManager = new FileManager(this);
m_httpServer = new HttpServer(this);
connect(m_networkManager, &QNetworkAccessManager::sslErrors, this, [this](QNetworkReply *reply, const QList<QSslError> &errors)
{
if (m_settings->isIgnoreSSLErrorsEnabled) {
// Ignore all SSL errors
reply->ignoreSslErrors();
}
});
// Extractor setup
m_extractorThread = new QThread(this);
m_extractor = new Extractor();
@ -271,11 +279,13 @@ void Application::applySettings()
QNetworkProxy::setApplicationProxy(proxy);
// Force NM to pick up changes.
m_networkManager->clearAccessCache();
break;
}
}
// Force NM to pick up changes.
m_networkManager->clearAccessCache();
}
QString Application::userAgent()

View File

@ -181,6 +181,7 @@ void Settings::load()
proxyAuthenticate = settings->value(QStringLiteral("authenticate"), false).toBool();
proxyUserName = settings->value(QStringLiteral("username")).toString();
proxyPassword = settings->value(QStringLiteral("password")).toString();
isIgnoreSSLErrorsEnabled = settings->value(QStringLiteral("ignore_ssl_errors"), false).toBool();
settings->endGroup();
settings->beginGroup(GroupDocsets);
@ -268,6 +269,7 @@ void Settings::save()
settings->setValue(QStringLiteral("authenticate"), proxyAuthenticate);
settings->setValue(QStringLiteral("username"), proxyUserName);
settings->setValue(QStringLiteral("password"), proxyPassword);
settings->setValue(QStringLiteral("ignore_ssl_errors"), isIgnoreSSLErrorsEnabled);
settings->endGroup();
settings->beginGroup(GroupDocsets);

View File

@ -99,6 +99,7 @@ public:
Socks5 = 4
};
Q_ENUM(ProxyType)
bool isIgnoreSSLErrorsEnabled;
// Internal
// --------

View File

@ -675,6 +675,7 @@ bool DocsetsDialog::updatesAvailable() const
QNetworkReply *DocsetsDialog::download(const QUrl &url)
{
QNetworkReply *reply = m_application->download(url);
connect(reply, &QNetworkReply::downloadProgress, this, &DocsetsDialog::downloadProgress);
connect(reply, &QNetworkReply::finished, this, &DocsetsDialog::downloadCompleted);
m_replies.append(reply);

View File

@ -255,6 +255,8 @@ void SettingsDialog::loadSettings()
ui->proxyRequiresAuthCheckBox->setChecked(settings->proxyAuthenticate);
ui->proxyUsernameEdit->setText(settings->proxyUserName);
ui->proxyPasswordEdit->setText(settings->proxyPassword);
ui->ignoreSSLErrorsCheckBox->setChecked(settings->isIgnoreSSLErrorsEnabled);
}
void SettingsDialog::saveSettings()
@ -330,5 +332,7 @@ void SettingsDialog::saveSettings()
settings->proxyUserName = ui->proxyUsernameEdit->text();
settings->proxyPassword = ui->proxyPasswordEdit->text();
settings->isIgnoreSSLErrorsEnabled = ui->ignoreSSLErrorsCheckBox->isChecked();
settings->save();
}

View File

@ -745,6 +745,22 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_8">
<property name="title">
<string>Security</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_15">
<item>
<widget class="QCheckBox" name="ignoreSSLErrorsCheckBox">
<property name="text">
<string>Ignore SSL errors</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">