mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-01-18 19:50:38 +01:00
parent
8cf5707575
commit
fbe4d3ce9f
@ -58,6 +58,10 @@ SubsonicSettingsPage::SubsonicSettingsPage(SettingsDialog *parent)
|
||||
|
||||
dialog()->installEventFilter(this);
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
ui_->checkbox_http2->hide();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
SubsonicSettingsPage::~SubsonicSettingsPage() { delete ui_; }
|
||||
@ -72,6 +76,7 @@ void SubsonicSettingsPage::Load() {
|
||||
QByteArray password = s.value("password").toByteArray();
|
||||
if (password.isEmpty()) ui_->password->clear();
|
||||
else ui_->password->setText(QString::fromUtf8(QByteArray::fromBase64(password)));
|
||||
ui_->checkbox_http2->setChecked(s.value("http2", true).toBool());
|
||||
ui_->checkbox_verify_certificate->setChecked(s.value("verifycertificate", false).toBool());
|
||||
ui_->checkbox_download_album_covers->setChecked(s.value("downloadalbumcovers", true).toBool());
|
||||
ui_->checkbox_server_scrobbling->setChecked(s.value("serversidescrobbling", false).toBool());
|
||||
@ -91,6 +96,7 @@ void SubsonicSettingsPage::Save() {
|
||||
s.setValue("url", QUrl(ui_->server_url->text()));
|
||||
s.setValue("username", ui_->username->text());
|
||||
s.setValue("password", QString::fromUtf8(ui_->password->text().toUtf8().toBase64()));
|
||||
s.setValue("http2", ui_->checkbox_http2->isChecked());
|
||||
s.setValue("verifycertificate", ui_->checkbox_verify_certificate->isChecked());
|
||||
s.setValue("downloadalbumcovers", ui_->checkbox_download_album_covers->isChecked());
|
||||
s.setValue("serversidescrobbling", ui_->checkbox_server_scrobbling->isChecked());
|
||||
|
@ -106,6 +106,13 @@
|
||||
<string>Preferences</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkbox_http2">
|
||||
<property name="text">
|
||||
<string>Use HTTP2 when possible</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkbox_verify_certificate">
|
||||
<property name="text">
|
||||
|
@ -100,6 +100,10 @@ QNetworkReply *SubsonicBaseRequest::CreateGetRequest(const QString &ressource_na
|
||||
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
req.setAttribute(QNetworkRequest::Http2AllowedAttribute, http2());
|
||||
#endif
|
||||
|
||||
QNetworkReply *reply = network_->get(req);
|
||||
QObject::connect(reply, &QNetworkReply::sslErrors, this, &SubsonicBaseRequest::HandleSSLErrors);
|
||||
|
||||
|
@ -61,13 +61,14 @@ class SubsonicBaseRequest : public QObject {
|
||||
virtual void Error(const QString &error, const QVariant &debug = QVariant()) = 0;
|
||||
QString ErrorsToHTML(const QStringList &errors);
|
||||
|
||||
QString client_name() { return service_->client_name(); }
|
||||
QString api_version() { return service_->api_version(); }
|
||||
QUrl server_url() { return service_->server_url(); }
|
||||
QString username() { return service_->username(); }
|
||||
QString password() { return service_->password(); }
|
||||
bool verify_certificate() { return service_->verify_certificate(); }
|
||||
bool download_album_covers() { return service_->download_album_covers(); }
|
||||
QString client_name() const { return service_->client_name(); }
|
||||
QString api_version() const { return service_->api_version(); }
|
||||
QUrl server_url() const { return service_->server_url(); }
|
||||
QString username() const { return service_->username(); }
|
||||
QString password() const { return service_->password(); }
|
||||
bool http2() const { return service_->http2(); }
|
||||
bool verify_certificate() const { return service_->verify_certificate(); }
|
||||
bool download_album_covers() const { return service_->download_album_covers(); }
|
||||
|
||||
private slots:
|
||||
void HandleSSLErrors(QList<QSslError> ssl_errors);
|
||||
|
@ -735,6 +735,10 @@ void SubsonicRequest::FlushAlbumCoverRequests() {
|
||||
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
req.setAttribute(QNetworkRequest::Http2AllowedAttribute, http2());
|
||||
#endif
|
||||
|
||||
if (!verify_certificate()) {
|
||||
QSslConfiguration sslconfig = QSslConfiguration::defaultConfiguration();
|
||||
sslconfig.setPeerVerifyMode(QSslSocket::VerifyNone);
|
||||
|
@ -73,6 +73,7 @@ SubsonicService::SubsonicService(Application *app, QObject *parent)
|
||||
collection_backend_(nullptr),
|
||||
collection_model_(nullptr),
|
||||
collection_sort_model_(new QSortFilterProxyModel(this)),
|
||||
http2_(true),
|
||||
verify_certificate_(false),
|
||||
download_album_covers_(true),
|
||||
ping_redirects_(0)
|
||||
@ -138,6 +139,7 @@ void SubsonicService::ReloadSettings() {
|
||||
if (password.isEmpty()) password_.clear();
|
||||
else password_ = QString::fromUtf8(QByteArray::fromBase64(password));
|
||||
|
||||
http2_ = s.value("http2", true).toBool();
|
||||
verify_certificate_ = s.value("verifycertificate", false).toBool();
|
||||
download_album_covers_ = s.value("downloadalbumcovers", true).toBool();
|
||||
|
||||
@ -196,6 +198,10 @@ void SubsonicService::SendPingWithCredentials(QUrl url, const QString &username,
|
||||
|
||||
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
req.setAttribute(QNetworkRequest::Http2AllowedAttribute, http2_);
|
||||
#endif
|
||||
|
||||
errors_.clear();
|
||||
QNetworkReply *reply = network_->get(req);
|
||||
replies_ << reply;
|
||||
|
@ -62,19 +62,20 @@ class SubsonicService : public InternetService {
|
||||
void ReloadSettings() override;
|
||||
void Exit() override;
|
||||
|
||||
Application *app() { return app_; }
|
||||
Application *app() const { return app_; }
|
||||
|
||||
QString client_name() { return kClientName; }
|
||||
QString api_version() { return kApiVersion; }
|
||||
QUrl server_url() { return server_url_; }
|
||||
QString username() { return username_; }
|
||||
QString password() { return password_; }
|
||||
bool verify_certificate() { return verify_certificate_; }
|
||||
bool download_album_covers() { return download_album_covers_; }
|
||||
QString client_name() const { return kClientName; }
|
||||
QString api_version() const { return kApiVersion; }
|
||||
QUrl server_url() const { return server_url_; }
|
||||
QString username() const { return username_; }
|
||||
QString password() const { return password_; }
|
||||
bool http2() const { return http2_; }
|
||||
bool verify_certificate() const { return verify_certificate_; }
|
||||
bool download_album_covers() const { return download_album_covers_; }
|
||||
|
||||
CollectionBackend *collection_backend() { return collection_backend_; }
|
||||
CollectionModel *collection_model() { return collection_model_; }
|
||||
QSortFilterProxyModel *collection_sort_model() { return collection_sort_model_; }
|
||||
CollectionBackend *collection_backend() const { return collection_backend_; }
|
||||
CollectionModel *collection_model() const { return collection_model_; }
|
||||
QSortFilterProxyModel *collection_sort_model() const { return collection_sort_model_; }
|
||||
|
||||
CollectionBackend *songs_collection_backend() override { return collection_backend_; }
|
||||
CollectionModel *songs_collection_model() override { return collection_model_; }
|
||||
@ -124,6 +125,7 @@ class SubsonicService : public InternetService {
|
||||
QUrl server_url_;
|
||||
QString username_;
|
||||
QString password_;
|
||||
bool http2_;
|
||||
bool verify_certificate_;
|
||||
bool download_album_covers_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user