dbhub: Improve UI for pushing databases

This improves the user experience for pushing database files. Before
this you had to type in the entire URL for pushing, e.g.:
https://db4s-beta.dbhub.io:5550/username/databasename
With this the host name as well as the user name is taken from the
currently active client certificate. So all you have to type in now is
the database name. And for this we make a sensible automatic suggestion
based on the name of the local file you're trying to push.

Note that while this makes pushing databases a lot easier, it still
doesn't implement proper version control or any extra code for handling
conflicts etc.
This commit is contained in:
Martin Kleusberg
2017-08-03 19:02:42 +02:00
parent d14fb1fbb1
commit e08ebffd63
4 changed files with 48 additions and 14 deletions

View File

@@ -235,6 +235,23 @@ const QList<QSslCertificate>& RemoteDatabase::caCertificates() const
return certs;
}
QString RemoteDatabase::getInfoFromClientCert(const QString& cert, CertInfo info) const
{
// Get the common name of the certificate and split it into user name and server address
QString cn = m_clientCertFiles[cert].subjectInfo(QSslCertificate::CommonName).at(0);
QStringList cn_parts = cn.split("@");
if(cn_parts.size() < 2)
return QString();
// Return requested part of the CN
if(info == CertInfoUser)
return cn_parts.first();
else if(info == CertInfoServer)
return cn_parts.last();
else
return QString();
}
bool RemoteDatabase::prepareSsl(QNetworkRequest* request, const QString& clientCert)
{
// Check if client cert exists