mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user