Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ deploy/build_64/*
winbuild*.bat
.cache/
.vscode/
aqtinstall.log


# Qt-es
Expand Down
6 changes: 6 additions & 0 deletions client/core/controllers/coreSignalHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ void CoreSignalHandlers::initSettingsSplitTunnelingHandler()

void CoreSignalHandlers::initInstallControllerHandler()
{
connect(m_coreController->m_installController, &InstallController::installationStepChanged,
m_coreController->m_installUiController, &InstallUiController::installationStepChanged,
Qt::QueuedConnection);
connect(m_coreController->m_installController, &InstallController::removalStepChanged,
m_coreController->m_installUiController, &InstallUiController::removalStepChanged,
Qt::QueuedConnection);
connect(m_coreController->m_installController, &InstallController::serverIsBusy, m_coreController->m_installUiController, &InstallUiController::serverIsBusy);
connect(m_coreController->m_installUiController, &InstallUiController::cancelInstallation, m_coreController->m_installController, &InstallController::cancelInstallation);
connect(m_coreController->m_serversUiController, &ServersUiController::processedServerIdChanged,
Expand Down
19 changes: 19 additions & 0 deletions client/core/controllers/selfhosted/installController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,55 +106,68 @@ ErrorCode InstallController::setupContainer(const ServerCredentials &credentials
SshSession sshSession(this);
ErrorCode e = ErrorCode::NoError;

emit installationStepChanged(tr("Checking server access…"), 0.03);
e = isUserInSudo(credentials, sshSession);
if (e)
return e;

emit installationStepChanged(tr("Checking server readiness…"), 0.07);
e = isServerDpkgBusy(credentials, sshSession);
if (e)
return e;

emit installationStepChanged(tr("Installing Docker on the server…"), 0.12);
e = installDockerWorker(credentials, container, sshSession);
if (e)
return e;
emit installationStepChanged(tr("Docker ready"), 0.30);
qDebug().noquote() << "InstallController::setupContainer installDockerWorker finished";

if (!isUpdate) {
emit installationStepChanged(tr("Checking port availability…"), 0.33);
e = isServerPortBusy(credentials, container, config, sshSession);
if (e)
return e;
}

emit installationStepChanged(tr("Preparing server environment…"), 0.38);
e = prepareHostWorker(credentials, container, sshSession);
if (e)
return e;
qDebug().noquote() << "InstallController::setupContainer prepareHostWorker finished";

emit installationStepChanged(tr("Removing old container…"), 0.42);
const amnezia::ScriptVars removeContainerVars =
amnezia::genBaseVars(credentials, container, QString(), QString());
const bool removeDataVolume = !isUpdate && (container == DockerContainer::MtProxy || container == DockerContainer::Telemt);
sshSession.runScript(credentials, buildRemoveContainerScript(removeContainerVars, removeDataVolume));
qDebug().noquote() << "InstallController::setupContainer removeContainer finished";

emit installationStepChanged(tr("Building the VPN container…"), 0.47);
qDebug().noquote() << "buildContainerWorker start";
e = buildContainerWorker(credentials, container, config, sshSession);
if (e)
return e;
emit installationStepChanged(tr("Container image built"), 0.63);
qDebug().noquote() << "InstallController::setupContainer buildContainerWorker finished";

emit installationStepChanged(tr("Starting the container…"), 0.68);
e = runContainerWorker(credentials, container, config, sshSession);
if (e)
return e;
qDebug().noquote() << "InstallController::setupContainer runContainerWorker finished";

emit installationStepChanged(tr("Configuring the protocol…"), 0.72);
e = configureContainerWorker(credentials, container, config, sshSession);
if (e)
return e;
qDebug().noquote() << "InstallController::setupContainer configureContainerWorker finished";

emit installationStepChanged(tr("Setting up firewall rules…"), 0.77);
setupServerFirewall(credentials, sshSession);
qDebug().noquote() << "InstallController::setupContainer setupServerFirewall finished";

emit installationStepChanged(tr("Running startup scripts…"), 0.90);
return startupContainerWorker(credentials, container, config, sshSession);
}

Expand Down Expand Up @@ -413,6 +426,8 @@ ErrorCode InstallController::prepareContainerConfig(DockerContainer container, c
return ErrorCode::NoError;
}

emit installationStepChanged(tr("Generating client configuration…"), 0.96);

if (ContainerUtils::containerService(container) != ServiceType::Other) {
Proto protocol = ContainerUtils::defaultProtocol(container);

Expand Down Expand Up @@ -999,9 +1014,11 @@ ErrorCode InstallController::removeAllContainers(const QString &serverId)
return ErrorCode::InternalError;
}
SshSession sshSession(this);
emit removalStepChanged(tr("Removing all containers…"), 0.15);
ErrorCode errorCode = sshSession.runScript(credentials, amnezia::scriptData(SharedScriptType::remove_all_containers));

if (errorCode == ErrorCode::NoError) {
emit removalStepChanged(tr("Cleaning up configuration…"), 0.90);
adminConfig->containers.clear();
adminConfig->defaultContainer = DockerContainer::None;
m_serversRepository->editServer(serverId, adminConfig->toJson(), serverConfigUtils::ConfigType::SelfHostedAdmin);
Expand All @@ -1024,10 +1041,12 @@ ErrorCode InstallController::removeContainer(const QString &serverId, DockerCont
const amnezia::ScriptVars removeContainerVars =
amnezia::genBaseVars(credentials, container, QString(), QString());
const bool removeDataVolume = (container == DockerContainer::MtProxy || container == DockerContainer::Telemt);
emit removalStepChanged(tr("Removing container…"), 0.15);
ErrorCode errorCode =
sshSession.runScript(credentials, buildRemoveContainerScript(removeContainerVars, removeDataVolume));

if (errorCode == ErrorCode::NoError) {
emit removalStepChanged(tr("Cleaning up configuration…"), 0.90);
QMap<DockerContainer, ContainerConfig> containers = adminConfig->containers;
containers.remove(container);

Expand Down
2 changes: 2 additions & 0 deletions client/core/controllers/selfhosted/installController.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class InstallController : public QObject
void configValidated(bool isValid);
void validationErrorOccurred(ErrorCode errorCode);

void installationStepChanged(const QString &message, double progress);
void removalStepChanged(const QString &message, double progress);
void serverIsBusy(const bool isBusy);
void cancelInstallationRequested();
void clientRevocationRequested(const QString &serverId, const ContainerConfig &containerConfig, DockerContainer container);
Expand Down
112 changes: 111 additions & 1 deletion client/translations/amneziavpn_ru_RU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,91 @@ Already installed containers were found on the server. All installed containers
<source>Api config removed</source>
<translation>Конфигурация API удалена</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="109"/>
<source>Checking server access…</source>
<translation>Проверка доступа к серверу…</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="114"/>
<source>Checking server readiness…</source>
<translation>Проверка готовности сервера…</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="119"/>
<source>Installing Docker on the server…</source>
<translation>Установка Docker на сервере…</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="123"/>
<source>Docker ready</source>
<translation>Docker готов</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="127"/>
<source>Checking port availability…</source>
<translation>Проверка доступности порта…</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="133"/>
<source>Preparing server environment…</source>
<translation>Подготовка окружения на сервере…</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="139"/>
<source>Removing old container…</source>
<translation>Удаление старого контейнера…</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="146"/>
<source>Building the VPN container…</source>
<translation>Сборка VPN-контейнера…</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="151"/>
<source>Container image built</source>
<translation>Образ контейнера собран</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="154"/>
<source>Starting the container…</source>
<translation>Запуск контейнера…</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="160"/>
<source>Configuring the protocol…</source>
<translation>Настройка протокола…</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="166"/>
<source>Setting up firewall rules…</source>
<translation>Настройка правил брандмауэра…</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="170"/>
<source>Running startup scripts…</source>
<translation>Выполнение стартовых скриптов…</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="429"/>
<source>Generating client configuration…</source>
<translation>Генерация клиентской конфигурации…</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="1006"/>
<source>Removing all containers…</source>
<translation>Удаление всех контейнеров…</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="1028"/>
<source>Removing container…</source>
<translation>Удаление контейнера…</translation>
</message>
<message>
<location filename="../core/controllers/selfhosted/installController.cpp" line="1044"/>
<source>Cleaning up configuration…</source>
<translation>Очистка конфигурации…</translation>
</message>
<message>
<location filename="../ui/controllers/installController.cpp" line="818"/>
<source>%1 cached profile cleared</source>
Expand Down Expand Up @@ -584,7 +669,17 @@ Already installed containers were found on the server. All installed containers
<message>
<location filename="../ui/qml/Pages2/PageDeinstalling.qml" line="81"/>
<source>Usually it takes no more than 5 minutes</source>
<translation>Обычно это занимает не более 5 минут</translation>
<translation type="vanished">Обычно это занимает не более 5 минут</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageDeinstalling.qml" line="20"/>
<source>Removing…</source>
<translation>Удаление…</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageDeinstalling.qml" line="109"/>
<source>Removal failed</source>
<translation>Ошибка удаления</translation>
</message>
</context>
<context>
Expand Down Expand Up @@ -3608,6 +3703,21 @@ Thank you for staying with us!</source>
<source>Usually it takes no more than 5 minutes</source>
<translation>Обычно это занимает не более 5 минут</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSetupWizardInstalling.qml" line="21"/>
<source>Connecting to the server…</source>
<translation>Подключение к серверу…</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSetupWizardInstalling.qml" line="111"/>
<source>Installation failed</source>
<translation>Ошибка установки</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSetupWizardInstalling.qml" line="123"/>
<source>Server is busy with other updates, waiting…</source>
<translation>Сервер занят другими обновлениями, ожидание…</translation>
</message>
</context>
<context>
<name>PageSetupWizardProtocolSettings</name>
Expand Down
2 changes: 2 additions & 0 deletions client/ui/controllers/selfhosted/installUiController.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ public slots:
void passphraseRequestStarted();
void passphraseRequestFinished();

void installationStepChanged(const QString &message, double progress);
void removalStepChanged(const QString &message, double progress);
void serverIsBusy(const bool isBusy);
void cancelInstallation();

Expand Down
Loading