dbhub: Use port 5550 for local development server

When connecting to a locally running development server use port 5550
instead of 443. This allows the server to run without any special
rights.
This commit is contained in:
Martin Kleusberg
2020-07-09 09:51:48 +02:00
parent 46ecf9094c
commit fc71212d91
2 changed files with 12 additions and 7 deletions
+10 -4
View File
@@ -381,11 +381,17 @@ QString RemoteDatabase::getInfoFromClientCert(const QString& cert, CertInfo info
// Return requested part of the CN // Return requested part of the CN
if(info == CertInfoUser) if(info == CertInfoUser)
{
return cn_parts.first(); return cn_parts.first();
else if(info == CertInfoServer) } else if(info == CertInfoServer) {
return cn_parts.last(); // Assemble the full URL from the host name. We use port 443 by default but for
else // local development purposes we use 5550 instead.
return QString(); QString host = cn_parts.last();
host = QString("https://%1:%2/").arg(host).arg(host.contains("docker-dev") ? "5550" : "443");
return host;
}
return QString();
} }
bool RemoteDatabase::prepareSsl(QNetworkRequest* request, const QString& clientCert) bool RemoteDatabase::prepareSsl(QNetworkRequest* request, const QString& clientCert)
+2 -3
View File
@@ -87,8 +87,7 @@ void RemoteDock::setNewIdentity(const QString& identity)
return; return;
// Open root directory. Get host name from client cert // Open root directory. Get host name from client cert
QString host = remoteDatabase.getInfoFromClientCert(cert, RemoteDatabase::CertInfoServer); remoteModel->setNewRootDir(remoteDatabase.getInfoFromClientCert(cert, RemoteDatabase::CertInfoServer), cert);
remoteModel->setNewRootDir(QString("https://%1:443/").arg(host), cert);
// Enable buttons if necessary // Enable buttons if necessary
enableButtons(); enableButtons();
@@ -131,7 +130,7 @@ void RemoteDock::pushDatabase()
name = name.remove(QRegExp("_[0-9]+.remotedb$")); name = name.remove(QRegExp("_[0-9]+.remotedb$"));
// Show the user a dialog for setting all the commit details // Show the user a dialog for setting all the commit details
QString host = QString("https://%1:443/").arg(remoteDatabase.getInfoFromClientCert(remoteModel->currentClientCertificate(), RemoteDatabase::CertInfoServer)); QString host = remoteDatabase.getInfoFromClientCert(remoteModel->currentClientCertificate(), RemoteDatabase::CertInfoServer);
RemotePushDialog pushDialog(this, remoteDatabase, host, remoteModel->currentClientCertificate(), name); RemotePushDialog pushDialog(this, remoteDatabase, host, remoteModel->currentClientCertificate(), name);
if(pushDialog.exec() != QDialog::Accepted) if(pushDialog.exec() != QDialog::Accepted)
return; return;