added a button to scan the server for already installed containers
- refactoring of old code, redundant sections of code removed
This commit is contained in:
parent
480b2181f0
commit
2580475f67
12 changed files with 136 additions and 98 deletions
|
@ -32,7 +32,6 @@ enum ErrorCode
|
|||
ServerContainerMissingError,
|
||||
ServerDockerFailedError,
|
||||
ServerCancelInstallation,
|
||||
ServerContainerAlreadyInstalledError,
|
||||
|
||||
// Ssh connection errors
|
||||
SshSocketError, SshTimeoutError, SshProtocolError,
|
||||
|
|
|
@ -16,7 +16,6 @@ QString errorString(ErrorCode code){
|
|||
case(ServerContainerMissingError): return QObject::tr("Server error: Docker container missing");
|
||||
case(ServerDockerFailedError): return QObject::tr("Server error: Docker failed");
|
||||
case(ServerCancelInstallation): return QObject::tr("Installation canceled by user");
|
||||
case(ServerContainerAlreadyInstalledError): return QObject::tr("Container already installed");
|
||||
|
||||
// Ssh connection errors
|
||||
case(SshSocketError): return QObject::tr("Ssh connection error");
|
||||
|
|
|
@ -879,7 +879,7 @@ ErrorCode ServerController::getAlreadyInstalledContainers(const ServerCredential
|
|||
if (containerInfo.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
const static QRegularExpression containerAndPortRegExp("(amnezia-[a-z]*).*?>([0-9]*)/(udp|tcp).*");
|
||||
const static QRegularExpression containerAndPortRegExp("(amnezia[-a-z]*).*?>([0-9]*)/(udp|tcp).*");
|
||||
QRegularExpressionMatch containerAndPortMatch = containerAndPortRegExp.match(containerInfo);
|
||||
if (containerAndPortMatch.hasMatch()) {
|
||||
QString name = containerAndPortMatch.captured(1);
|
||||
|
@ -890,8 +890,8 @@ ErrorCode ServerController::getAlreadyInstalledContainers(const ServerCredential
|
|||
QJsonObject config {
|
||||
{ config_key::container, name },
|
||||
{ ProtocolProps::protoToString(mainProto), QJsonObject {
|
||||
{ config_key::port, port },
|
||||
{ config_key::transport_proto, transportProto }}
|
||||
{ config_key::port, port },
|
||||
{ config_key::transport_proto, transportProto }}
|
||||
}
|
||||
};
|
||||
installedContainers.insert(container, config);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue