mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-24 05:55:59 +03:00
Merge pull request #1057 from nextcloud/fix/proxy-login-flow
Fix login flow with system proxy
This commit is contained in:
commit
822c386709
3 changed files with 43 additions and 23 deletions
|
@ -74,29 +74,37 @@ void ClientProxy::setupQtProxyFromConfig()
|
|||
}
|
||||
|
||||
switch (proxyType) {
|
||||
case QNetworkProxy::NoProxy:
|
||||
qCInfo(lcClientProxy) << "Set proxy configuration to use NO proxy";
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
|
||||
break;
|
||||
case QNetworkProxy::DefaultProxy:
|
||||
qCInfo(lcClientProxy) << "Set proxy configuration to use system configuration";
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
break;
|
||||
case QNetworkProxy::Socks5Proxy:
|
||||
proxy.setType(QNetworkProxy::Socks5Proxy);
|
||||
qCInfo(lcClientProxy) << "Set proxy configuration to SOCKS5" << printQNetworkProxy(proxy);
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||
QNetworkProxy::setApplicationProxy(proxy);
|
||||
break;
|
||||
case QNetworkProxy::HttpProxy:
|
||||
proxy.setType(QNetworkProxy::HttpProxy);
|
||||
qCInfo(lcClientProxy) << "Set proxy configuration to HTTP" << printQNetworkProxy(proxy);
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||
QNetworkProxy::setApplicationProxy(proxy);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case QNetworkProxy::NoProxy:
|
||||
qCInfo(lcClientProxy) << "Set proxy configuration to use NO proxy";
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
|
||||
break;
|
||||
case QNetworkProxy::DefaultProxy:
|
||||
qCInfo(lcClientProxy) << "Set proxy configuration to use the prefered system proxy for http tcp connections";
|
||||
{
|
||||
QNetworkProxyQuery query;
|
||||
query.setProtocolTag("http");
|
||||
query.setQueryType(QNetworkProxyQuery::TcpSocket);
|
||||
auto proxies = QNetworkProxyFactory::proxyForQuery(query);
|
||||
proxy = proxies.first();
|
||||
}
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||
QNetworkProxy::setApplicationProxy(proxy);
|
||||
break;
|
||||
case QNetworkProxy::Socks5Proxy:
|
||||
proxy.setType(QNetworkProxy::Socks5Proxy);
|
||||
qCInfo(lcClientProxy) << "Set proxy configuration to SOCKS5" << printQNetworkProxy(proxy);
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||
QNetworkProxy::setApplicationProxy(proxy);
|
||||
break;
|
||||
case QNetworkProxy::HttpProxy:
|
||||
proxy.setType(QNetworkProxy::HttpProxy);
|
||||
qCInfo(lcClientProxy) << "Set proxy configuration to HTTP" << printQNetworkProxy(proxy);
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||
QNetworkProxy::setApplicationProxy(proxy);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <QWebEngineUrlRequestJob>
|
||||
#include <QProgressBar>
|
||||
#include <QVBoxLayout>
|
||||
#include <QNetworkProxyFactory>
|
||||
|
||||
#include "owncloudwizard.h"
|
||||
#include "creds/webflowcredentials.h"
|
||||
|
@ -27,9 +28,17 @@ WebViewPage::WebViewPage(QWidget *parent)
|
|||
setLayout(layout);
|
||||
|
||||
connect(_webView, &WebView::urlCatched, this, &WebViewPage::urlCatched);
|
||||
|
||||
//_useSystemProxy = QNetworkProxyFactory::usesSystemConfiguration();
|
||||
}
|
||||
|
||||
WebViewPage::~WebViewPage() {
|
||||
//QNetworkProxyFactory::setUseSystemConfiguration(_useSystemProxy);
|
||||
}
|
||||
|
||||
void WebViewPage::initializePage() {
|
||||
//QNetworkProxy::setApplicationProxy(QNetworkProxy::applicationProxy());
|
||||
|
||||
QString url;
|
||||
if (_ocWizard->registration()) {
|
||||
url = "https://nextcloud.com/register";
|
||||
|
|
|
@ -14,6 +14,7 @@ class WebViewPage : public AbstractCredentialsWizardPage
|
|||
Q_OBJECT
|
||||
public:
|
||||
WebViewPage(QWidget *parent = nullptr);
|
||||
~WebViewPage();
|
||||
|
||||
void initializePage() override;
|
||||
int nextId() const override;
|
||||
|
@ -34,6 +35,8 @@ private:
|
|||
|
||||
QString _user;
|
||||
QString _pass;
|
||||
|
||||
bool _useSystemProxy;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue