From 0058edc24ef1c8c84cbf1866a08e704f461e7d3a Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Mon, 31 Jul 2023 20:38:13 +0900 Subject: [PATCH] added server availability check after entering credentials - moved the protocol self-selection button to the PageSetupWizardEasy page --- client/amnezia_application.cpp | 9 + client/amnezia_application.h | 3 + client/translations/amneziavpn_ru.ts | 1271 ++++++++++++----- client/ui/controllers/installController.cpp | 21 + client/ui/controllers/installController.h | 2 + client/ui/models/languageModel.cpp | 2 +- client/ui/models/languageModel.h | 6 +- .../qml/Components/SelectLanguageDrawer.qml | 3 +- client/ui/qml/Controls2/PopupType.qml | 2 + .../qml/Pages2/PageProtocolCloakSettings.qml | 6 +- .../Pages2/PageProtocolOpenVpnSettings.qml | 6 +- .../PageProtocolShadowSocksSettings.qml | 6 +- .../ui/qml/Pages2/PageServiceSftpSettings.qml | 6 +- .../Pages2/PageServiceTorWebsiteSettings.qml | 6 +- .../ui/qml/Pages2/PageSettingsApplication.qml | 2 +- .../ui/qml/Pages2/PageSettingsServerData.qml | 5 - .../qml/Pages2/PageSetupWizardCredentials.qml | 47 +- client/ui/qml/Pages2/PageSetupWizardEasy.qml | 34 +- .../qml/Pages2/PageSetupWizardInstalling.qml | 5 - client/ui/qml/Pages2/PageSetupWizardStart.qml | 3 +- client/ui/qml/Pages2/PageStart.qml | 20 + 21 files changed, 1002 insertions(+), 463 deletions(-) diff --git a/client/amnezia_application.cpp b/client/amnezia_application.cpp index 2ee9af16..7d7a0376 100644 --- a/client/amnezia_application.cpp +++ b/client/amnezia_application.cpp @@ -221,6 +221,12 @@ void AmneziaApplication::updateTranslator(const QLocale &locale) QResource::registerResource(":/translations.qrc"); if (!m_translator->isEmpty()) QCoreApplication::removeTranslator(m_translator); + + if (locale == QLocale::English) { + m_settings->setAppLanguage(locale); + m_engine->retranslate(); + } + if (m_translator->load(locale, QString("amneziavpn"), QLatin1String("_"), QLatin1String(":/i18n"))) { if (QCoreApplication::installTranslator(m_translator)) { m_settings->setAppLanguage(locale); @@ -228,6 +234,8 @@ void AmneziaApplication::updateTranslator(const QLocale &locale) m_engine->retranslate(); } + + emit translationsUpdated(); } bool AmneziaApplication::parseCommands() @@ -271,6 +279,7 @@ void AmneziaApplication::initModels() m_languageModel.reset(new LanguageModel(m_settings, this)); m_engine->rootContext()->setContextProperty("LanguageModel", m_languageModel.get()); connect(m_languageModel.get(), &LanguageModel::updateTranslations, this, &AmneziaApplication::updateTranslator); + connect(this, &AmneziaApplication::translationsUpdated, m_languageModel.get(), &LanguageModel::translationsUpdated); m_protocolsModel.reset(new ProtocolsModel(m_settings, this)); m_engine->rootContext()->setContextProperty("ProtocolsModel", m_protocolsModel.get()); diff --git a/client/amnezia_application.h b/client/amnezia_application.h index 3ba42e41..2a10aa86 100644 --- a/client/amnezia_application.h +++ b/client/amnezia_application.h @@ -65,6 +65,9 @@ public: QQmlApplicationEngine *qmlEngine() const; +signals: + void translationsUpdated(); + private: void initModels(); void initControllers(); diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index 197c9d40..f338216b 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -138,6 +138,24 @@ + + ConnectionTypeSelectionDrawer + + + Connection data + + + + + Server IP, login and password + + + + + QR code, key or configuration file + + + ContextMenu @@ -164,11 +182,71 @@ ExportController - + + Access error! + + + + Save AmneziaVPN config + + ImportController + + + Open config file + + + + + InstallController + + + + installed successfully. + + + + + + is already installed on the server. + + + + + + +Already installed containers were found on the server. All installed containers have been added to the application + + + + + Server ' + + + + + ' was removed + + + + + All containers from server ' + + + + + has been removed from the server ' + + + + + Please login as the user + + + NotificationHandler @@ -198,156 +276,6 @@ - - OpenVpnSettings - - - VPN Addresses Subnet - - - - - Network protocol - - - - - Port - - - - - Auto-negotiate encryption - - - - - - Hash - - - - - SHA512 - - - - - SHA384 - - - - - SHA256 - - - - - SHA3-512 - - - - - SHA3-384 - - - - - SHA3-256 - - - - - whirlpool - - - - - BLAKE2b512 - - - - - BLAKE2s256 - - - - - SHA1 - - - - - - Cipher - - - - - AES-256-GCM - - - - - AES-192-GCM - - - - - AES-128-GCM - - - - - AES-256-CBC - - - - - AES-192-CBC - - - - - AES-128-CBC - - - - - ChaCha20-Poly1305 - - - - - ARIA-256-CBC - - - - - CAMELLIA-256-CBC - - - - - none - - - - - TLS auth - - - - - Block DNS requests outside of VPN - - - - - Additional configuration commands - - - PageAbout @@ -545,6 +473,11 @@ Removing services from + + + Usually it takes no more than 5 minutes + + PageGeneralSettings @@ -587,12 +520,12 @@ PageHome - - Протокол подключения + + VPN protocol - + Servers @@ -1049,6 +982,304 @@ If AmneziaDNS service is not installed on the same server, or this option is unc + + PageProtocolCloakSettings + + + Settings updated successfully + + + + + Cloak settings + + + + + Disguised as traffic from + + + + + Port + + + + + + Cipher + + + + + Save and Restart Amnezia + + + + + PageProtocolOpenVpnSettings + + + Settings updated successfully + + + + + OpenVPN settings + + + + + VPN Addresses Subnet + + + + + Network protocol + + + + + Port + + + + + Auto-negotiate encryption + + + + + + Hash + + + + + SHA512 + + + + + SHA384 + + + + + SHA256 + + + + + SHA3-512 + + + + + SHA3-384 + + + + + SHA3-256 + + + + + whirlpool + + + + + BLAKE2b512 + + + + + BLAKE2s256 + + + + + SHA1 + + + + + + Cipher + + + + + AES-256-GCM + + + + + AES-192-GCM + + + + + AES-128-GCM + + + + + AES-256-CBC + + + + + AES-192-CBC + + + + + AES-128-CBC + + + + + ChaCha20-Poly1305 + + + + + ARIA-256-CBC + + + + + CAMELLIA-256-CBC + + + + + none + + + + + TLS auth + + + + + Block DNS requests outside of VPN + + + + + Additional client configuration commands + + + + + + Commands: + + + + + Additional server configuration commands + + + + + Remove OpenVPN + + + + + Remove OpenVpn from server? + + + + + Continue + Продолжить + + + + Cancel + + + + + Save and Restart Amnezia + + + + + PageProtocolRaw + + + settings + + + + + Show connection options + + + + + Connection options + + + + + + Remove + + + + + from server? + + + + + Continue + Продолжить + + + + Cancel + + + + + PageProtocolShadowSocksSettings + + + Settings updated successfully + + + + + ShadowSocks settings + + + + + Port + + + + + + Cipher + + + + + Save and Restart Amnezia + + + PageQrDecoderIos @@ -1175,6 +1406,139 @@ If AmneziaDNS service is not installed on the same server, or this option is unc + + PageServiceSftpSettings + + + Settings updated successfully + + + + + SFTP settings + + + + + Host + + + + + Port + + + + + Login + + + + + Password + + + + + Mount folder on device + + + + + In order to mount remote SFTP folder as local drive, perform following steps: <br> + + + + + + <br>1. Install the latest version of + + + + + + <br>2. Install the latest version of + + + + + Detailed instructions + + + + + Remove SFTP and all data stored there + + + + + Some description + + + + + Continue + Продолжить + + + + Cancel + + + + + PageServiceTorWebsiteSettings + + + Settings updated successfully + + + + + Tor website settings + + + + + Website address + + + + + Use <a href="https://www.torproject.org/download/" style="color: #FBB26A;">Tor Browser</a> to open this url. + + + + + After installation it takes several minutes while your onion site will become available in the Tor Network. + + + + + When configuring WordPress set the domain as this onion address. + + + + + Remove website + + + + + Some description + + + + + Continue + Продолжить + + + + Cancel + + + PageSettings @@ -1275,65 +1639,85 @@ And if you don't like the app, all the more support it - the donation will PageSettingsApplication - + Application - + Language - + + Logging + + + + + Enabled + + + + + Disabled + + + + Reset settings and remove all data from the application + + + Reset settings and remove all data from the application? + + + + + All settings will be reset to default. All installed AmneziaVPN services will still remain on the server. + + + + + Continue + Продолжить + + + + Cancel + + PageSettingsBackup - + Backup - - Save logs + + Settings restored from backup file - - Open folder with logs - - - - - Save logs to file - - - - - Clear logs - - - - + Configuration backup - + It will help you instantly restore connection settings at the next installation - + Make a backup - + Restore from backup @@ -1347,7 +1731,7 @@ And if you don't like the app, all the more support it - the donation will - Use AmnesiaDNS if installed on the server + Use AmneziaDNS if installed on the server @@ -1399,11 +1783,39 @@ And if you don't like the app, all the more support it - the donation will - + Save + + PageSettingsLogging + + + Logging + + + + + Save logs + + + + + Open folder with logs + + + + + Save logs to file + + + + + Clear logs + + + PageSettingsServerData @@ -1413,80 +1825,80 @@ And if you don't like the app, all the more support it - the donation will - Не найдено установленных контейнеров + No installed containers found - + Clear Amnezia cache - + May be needed when changing other settings - + Clear cached profiles? Очистить закешированные профили - + some description - - - + + + Continue Продолжить - - - + + + Cancel - - Проверить сервер на наличие ранее установленных сервисов Amnezia + + Check the server for previously installed Amnezia services - - Добавим их в приложение, если они не отображались + + Add them to the application if they were not displayed - + Remove server from application - + Remove server? - + All installed AmneziaVPN services will still remain on the server. - + Clear server from Amnezia software - + Clear server from Amnezia software? - + All containers will be deleted on the server. This means that configuration files, keys and certificates will be deleted. @@ -1499,26 +1911,63 @@ And if you don't like the app, all the more support it - the donation will - + Save - + Protocols - + Services - + Data + + PageSettingsServerProtocol + + + settings + + + + + + Remove + + + + + from server? + + + + + Continue + Продолжить + + + + Cancel + + + + + PageSettingsServersList + + + Servers + + + PageSetupWizard @@ -1568,6 +2017,41 @@ OpenVPN profile will be installed. + + PageSetupWizardConfigSource + + + Server connection + + + + + Do not use connection code from public sources. It may have been created to intercept your data. + +It's okay if a friend passed the code. + + + + + What do you have? + + + + + File with connection settings + + + + + QR-code + + + + + Key as text + + + PageSetupWizardCredentials @@ -1582,42 +2066,47 @@ OpenVPN profile will be installed. - + 255.255.255.255:88 + + + + + + Insert + + + + + Password / SSH private key + + + + + Continue + Продолжить + + + Enter the address in the format 255.255.255.255:88 - + Login to connect via SSH - - Password / Private key - - - - - Set up a server the easy way - - - - - Select protocol to install - - - - + Ip address cannot be empty - + Login cannot be empty - + Password/private key cannot be empty @@ -1625,12 +2114,22 @@ OpenVPN profile will be installed. PageSetupWizardEasy - + What is the level of internet control in your region? + Set up a VPN yourself + + + + + I want to choose a VPN protocol + + + + Continue Продолжить @@ -1670,14 +2169,18 @@ This protocol support exporting connection profiles to mobile devices by exporti PageSetupWizardInstalling - - - The container you are trying to install is already installed on the server. All installed containers have been added to the application + + The server has already been added to the application - - The server has already been added to the application + + Installing + + + + + Usually it takes no more than 5 minutes @@ -1751,31 +2254,72 @@ This protocol supports exporting connection profiles to mobile devices by using - + detailed protocol description - + Close - - Установить + + Network protocol + + + + + Port + + + + + Install + + + + + PageSetupWizardProtocols + + + VPN protocol + + + + + Choose the one with the highest priority for you. Later, you can install other protocols and additional services, such as DNS proxy and SFTP. + + + + + PageSetupWizardQrReader + + + Point the camera at the QR code and hold for a couple of seconds. PageSetupWizardStart + + + Free service for creating a personal VPN on your server. + + + + + Helps you access blocked content without revealing your privacy, even to VPN providers. + + - У меня есть данные для подключения + I have the data to connect - У меня ничего нет + I have nothing @@ -1837,27 +2381,27 @@ Please note, you should add addresses to the list after VPN connection establish PageSetupWizardViewConfig - + New connection - + Do not use connection code from public sources. It could be created to intercept your data. - + Collapse content - + Show content - + Connect @@ -1865,80 +2409,84 @@ Please note, you should add addresses to the list after VPN connection establish PageShare - - For the AmnesiaVPN app - - - - + OpenVpn native format - + WireGuard native format - + VPN Access - + Connection - - Full - - - - + VPN access without the ability to manage the server - + Full access to server - + Server and service - + Server - + + Accessing + + + + Protocols and services - - + Connection to - - + + File with connection settings to - - + + For the AmneziaVPN app + + + + + Full access + + + + + Connection format - + Share @@ -2298,87 +2846,6 @@ New encryption keys pair will be generated. - - PageTest - - - Протоколы - - - - - Сервисы - - - - - Данные - - - - - - Forget this server - - - - - SHA512 - - - - - SHA384 - - - - - SHA256 - - - - - SHA3-512 - - - - - SHA3-384 - - - - - SHA3-256 - - - - - whirlpool - - - - - BLAKE2b512 - - - - - BLAKE2s256 - - - - - SHA1 - - - - - - - Auto-negotiate encryption - - - PageVPN @@ -2470,7 +2937,7 @@ AmneziaVPN detected this profile may contain malicious scripts. Please, carefull PopupType - + Close @@ -2683,59 +3150,63 @@ AmneziaVPN detected this profile may contain malicious scripts. Please, carefull - + IPsec - - + + Web site in Tor network - - + DNS Service - + Sftp file sharing service - + + Amnezia DNS + + + + OpenVPN container - + Container with OpenVpn and ShadowSocks - + Container with OpenVpn and ShadowSocks protocols configured with traffic masking by Cloak plugin - + WireGuard container - + IPsec container - + Sftp file sharing service - is secure FTP service - + Sftp service @@ -2788,17 +3259,17 @@ AmneziaVPN detected this profile may contain malicious scripts. Please, carefull ServerContainersLogic - + Error occurred while configuring server. - + Error message: - + See logs for details. @@ -2807,17 +3278,17 @@ AmneziaVPN detected this profile may contain malicious scripts. Please, carefull ServerSettingsLogic - + Clear client cached profile - + Service: - + Cache cleared @@ -2825,13 +3296,13 @@ AmneziaVPN detected this profile may contain malicious scripts. Please, carefull Settings - + Server #1 - - + + Server @@ -2844,20 +3315,30 @@ AmneziaVPN detected this profile may contain malicious scripts. Please, carefull - + Save log - + Backup application config - + Open backup + + + Backup file is empty + + + + + Backup file is corrupted + + ShareConnectionButtonCopyType @@ -2875,22 +3356,22 @@ AmneziaVPN detected this profile may contain malicious scripts. Please, carefull ShareConnectionDrawer - - Save connection code + + Share - + Copy - + Show content - + To read the QR code in the Amnezia app, select "Add Server" → "I have connection details" @@ -2934,24 +3415,24 @@ AmneziaVPN detected this profile may contain malicious scripts. Please, carefull StartPageLogic - - + + Connect - - + + Please fill in all fields - + Connecting... - + Open config file @@ -2987,17 +3468,17 @@ AmneziaVPN detected this profile may contain malicious scripts. Please, carefull UiLogic - + Error occurred while configuring server. - + Error message: - + See logs for details. @@ -3081,27 +3562,27 @@ AmneziaVPN detected this profile may contain malicious scripts. Please, carefull amnezia::ContainerProps - + Low - + High - + Medium - + Many foreign websites and VPN providers are blocked - + Some foreign sites are blocked, but VPN providers are not blocked diff --git a/client/ui/controllers/installController.cpp b/client/ui/controllers/installController.cpp index be235e42..d6c32fac 100644 --- a/client/ui/controllers/installController.cpp +++ b/client/ui/controllers/installController.cpp @@ -392,3 +392,24 @@ void InstallController::mountSftpDrive(const QString &port, const QString &passw #endif } + +bool InstallController::checkSshConnection() +{ + ServerController serverController(m_settings); + + ErrorCode errorCode = ErrorCode::NoError; + QString output; + output = serverController.checkSshConnection(m_currentlyInstalledServerCredentials, &errorCode); + + if (errorCode != ErrorCode::NoError) { + emit installationErrorOccurred(errorString(errorCode)); + return false; + } else { + if (output.contains(tr("Please login as the user"))) { + output.replace("\n", ""); + emit installationErrorOccurred(output); + return false; + } + } + return true; +} diff --git a/client/ui/controllers/installController.h b/client/ui/controllers/installController.h index 8bc04f39..b25f2082 100644 --- a/client/ui/controllers/installController.h +++ b/client/ui/controllers/installController.h @@ -37,6 +37,8 @@ public slots: void mountSftpDrive(const QString &port, const QString &password, const QString &username); + bool checkSshConnection(); + signals: void installContainerFinished(QString finishMessage); void installServerFinished(QString finishMessage); diff --git a/client/ui/models/languageModel.cpp b/client/ui/models/languageModel.cpp index adbbdaaa..5135f348 100644 --- a/client/ui/models/languageModel.cpp +++ b/client/ui/models/languageModel.cpp @@ -55,7 +55,7 @@ int LanguageModel::getCurrentLanguageIndex() } } -QString LanguageModel::getCurrentLanuageName() +QString LanguageModel::getCurrentLanguageName() { return m_availableLanguages[getCurrentLanguageIndex()].name; } diff --git a/client/ui/models/languageModel.h b/client/ui/models/languageModel.h index 4e8a9092..b64862dd 100644 --- a/client/ui/models/languageModel.h +++ b/client/ui/models/languageModel.h @@ -43,13 +43,17 @@ public: int rowCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + Q_PROPERTY(QString currentLanguageName READ getCurrentLanguageName NOTIFY translationsUpdated) + Q_PROPERTY(int currentLanguageIndex READ getCurrentLanguageIndex NOTIFY translationsUpdated) + public slots: void changeLanguage(const LanguageSettings::AvailableLanguageEnum language); int getCurrentLanguageIndex(); - QString getCurrentLanuageName(); + QString getCurrentLanguageName(); signals: void updateTranslations(const QLocale &locale); + void translationsUpdated(); protected: QHash roleNames() const override; diff --git a/client/ui/qml/Components/SelectLanguageDrawer.qml b/client/ui/qml/Components/SelectLanguageDrawer.qml index d872a889..d318aab8 100644 --- a/client/ui/qml/Components/SelectLanguageDrawer.qml +++ b/client/ui/qml/Components/SelectLanguageDrawer.qml @@ -59,7 +59,7 @@ DrawerType { interactive: false model: LanguageModel - currentIndex: LanguageModel.getCurrentLanguageIndex() + currentIndex: LanguageModel.currentLanguageIndex ButtonGroup { id: buttonGroup @@ -127,6 +127,7 @@ DrawerType { onClicked: { listView.currentIndex = index LanguageModel.changeLanguage(languageIndex) + root.close() } } } diff --git a/client/ui/qml/Controls2/PopupType.qml b/client/ui/qml/Controls2/PopupType.qml index e7bb16f4..e4d2a449 100644 --- a/client/ui/qml/Controls2/PopupType.qml +++ b/client/ui/qml/Controls2/PopupType.qml @@ -55,6 +55,8 @@ Popup { BasicButtonType { visible: closeButtonVisible + implicitHeight: 32 + defaultColor: "white" hoveredColor: "#C1C2C5" pressedColor: "#AEB0B7" diff --git a/client/ui/qml/Pages2/PageProtocolCloakSettings.qml b/client/ui/qml/Pages2/PageProtocolCloakSettings.qml index 54c2ffb8..cc764451 100644 --- a/client/ui/qml/Pages2/PageProtocolCloakSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolCloakSettings.qml @@ -17,13 +17,9 @@ PageType { Connections { target: InstallController - function onInstallationErrorOccurred(errorMessage) { - PageController.showErrorMessage(errorMessage) - } - function onUpdateContainerFinished() { //todo change to notification - PageController.showErrorMessage(qsTr("Settings updated successfully")) + PageController.showNotificationMessage(qsTr("Settings updated successfully")) } } diff --git a/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml b/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml index 26a9c495..7d38a2b0 100644 --- a/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml @@ -18,13 +18,9 @@ PageType { Connections { target: InstallController - function onInstallationErrorOccurred(errorMessage) { - PageController.showErrorMessage(errorMessage) - } - function onUpdateContainerFinished() { //todo change to notification - PageController.showErrorMessage(qsTr("Settings updated successfully")) + PageController.showNotificationMessage(qsTr("Settings updated successfully")) } } diff --git a/client/ui/qml/Pages2/PageProtocolShadowSocksSettings.qml b/client/ui/qml/Pages2/PageProtocolShadowSocksSettings.qml index d873beac..64390790 100644 --- a/client/ui/qml/Pages2/PageProtocolShadowSocksSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolShadowSocksSettings.qml @@ -17,13 +17,9 @@ PageType { Connections { target: InstallController - function onInstallationErrorOccurred(errorMessage) { - PageController.showErrorMessage(errorMessage) - } - function onUpdateContainerFinished() { //todo change to notification - PageController.showErrorMessage(qsTr("Settings updated successfully")) + PageController.showNotificationMessage(qsTr("Settings updated successfully")) } } diff --git a/client/ui/qml/Pages2/PageServiceSftpSettings.qml b/client/ui/qml/Pages2/PageServiceSftpSettings.qml index 0eabb076..d37562a1 100644 --- a/client/ui/qml/Pages2/PageServiceSftpSettings.qml +++ b/client/ui/qml/Pages2/PageServiceSftpSettings.qml @@ -19,13 +19,9 @@ PageType { Connections { target: InstallController - function onInstallationErrorOccurred(errorMessage) { - PageController.showErrorMessage(errorMessage) - } - function onUpdateContainerFinished() { //todo change to notification - PageController.showErrorMessage(qsTr("Settings updated successfully")) + PageController.showNotificationMessage(qsTr("Settings updated successfully")) } } diff --git a/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml b/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml index 7cf2a81a..5ddb9ed6 100644 --- a/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml +++ b/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml @@ -20,13 +20,9 @@ PageType { Connections { target: InstallController - function onInstallationErrorOccurred(errorMessage) { - PageController.showErrorMessage(errorMessage) - } - function onUpdateContainerFinished() { //todo change to notification - PageController.showErrorMessage(qsTr("Settings updated successfully")) + PageController.showNotificationMessage(qsTr("Settings updated successfully")) } } diff --git a/client/ui/qml/Pages2/PageSettingsApplication.qml b/client/ui/qml/Pages2/PageSettingsApplication.qml index 2c7d8601..2001e892 100644 --- a/client/ui/qml/Pages2/PageSettingsApplication.qml +++ b/client/ui/qml/Pages2/PageSettingsApplication.qml @@ -48,7 +48,7 @@ PageType { Layout.topMargin: 16 text: qsTr("Language") - descriptionText: LanguageModel.getCurrentLanuageName() + descriptionText: LanguageModel.currentLanguageName rightImageSource: "qrc:/images/controls/chevron-right.svg" clickedFunction: function() { diff --git a/client/ui/qml/Pages2/PageSettingsServerData.qml b/client/ui/qml/Pages2/PageSettingsServerData.qml index 3aec4242..12e66269 100644 --- a/client/ui/qml/Pages2/PageSettingsServerData.qml +++ b/client/ui/qml/Pages2/PageSettingsServerData.qml @@ -28,11 +28,6 @@ PageType { PageController.showErrorMessage(message) } - function onInstallationErrorOccurred(errorMessage) { - closePage() // close deInstalling page - PageController.showErrorMessage(errorMessage) - } - function onRemoveCurrentlyProcessedServerFinished(finishedMessage) { if (!ServersModel.getServersCount()) { PageController.replaceStartPage() diff --git a/client/ui/qml/Pages2/PageSetupWizardCredentials.qml b/client/ui/qml/Pages2/PageSetupWizardCredentials.qml index cc1197ad..dab860c1 100644 --- a/client/ui/qml/Pages2/PageSetupWizardCredentials.qml +++ b/client/ui/qml/Pages2/PageSetupWizardCredentials.qml @@ -94,7 +94,7 @@ PageType { Layout.fillWidth: true Layout.topMargin: 24 - text: qsTr("Set up a server the easy way") + text: qsTr("Continue") onClicked: function() { if (!isCredentialsFilled()) { @@ -104,34 +104,41 @@ PageType { InstallController.setShouldCreateServer(true) InstallController.setCurrentlyInstalledServerCredentials(hostname.textField.text, username.textField.text, secretData.textField.text) + PageController.showBusyIndicator(true) + var isConnectionOpened = InstallController.checkSshConnection() + PageController.showBusyIndicator(false) + if (!isConnectionOpened) { + return + } + goToPage(PageEnum.PageSetupWizardEasy) } } - BasicButtonType { - Layout.fillWidth: true - Layout.topMargin: -8 +// BasicButtonType { +// Layout.fillWidth: true +// Layout.topMargin: -8 - defaultColor: "transparent" - hoveredColor: Qt.rgba(1, 1, 1, 0.08) - pressedColor: Qt.rgba(1, 1, 1, 0.12) - disabledColor: "#878B91" - textColor: "#D7D8DB" - borderWidth: 1 +// defaultColor: "transparent" +// hoveredColor: Qt.rgba(1, 1, 1, 0.08) +// pressedColor: Qt.rgba(1, 1, 1, 0.12) +// disabledColor: "#878B91" +// textColor: "#D7D8DB" +// borderWidth: 1 - text: qsTr("Select protocol to install") +// text: qsTr("Select protocol to install") - onClicked: function() { - if (!isCredentialsFilled()) { - return - } +// onClicked: function() { +// if (!isCredentialsFilled()) { +// return +// } - InstallController.setShouldCreateServer(true) - InstallController.setCurrentlyInstalledServerCredentials(hostname.textField.text, username.textField.text, secretData.textField.text) +// InstallController.setShouldCreateServer(true) +// InstallController.setCurrentlyInstalledServerCredentials(hostname.textField.text, username.textField.text, secretData.textField.text) - goToPage(PageEnum.PageSetupWizardProtocols) - } - } +// goToPage(PageEnum.PageSetupWizardProtocols) +// } +// } } } diff --git a/client/ui/qml/Pages2/PageSetupWizardEasy.qml b/client/ui/qml/Pages2/PageSetupWizardEasy.qml index 2a6e1909..ac1c3a44 100644 --- a/client/ui/qml/Pages2/PageSetupWizardEasy.qml +++ b/client/ui/qml/Pages2/PageSetupWizardEasy.qml @@ -15,6 +15,8 @@ import "../Config" PageType { id: root + property bool isEasySetup: true + SortFilterProxyModel { id: proxyContainersModel sourceModel: ContainersModel @@ -64,6 +66,10 @@ PageType { headerText: qsTr("What is the level of internet control in your region?") } + ButtonGroup { + id: buttonGroup + } + ListView { id: containers width: parent.width @@ -101,6 +107,7 @@ PageType { ButtonGroup.group: buttonGroup onClicked: function() { + isEasySetup = true var defaultContainerProto = ContainerProps.defaultProtocol(dockerContainer) containers.dockerContainer = dockerContainer @@ -117,9 +124,18 @@ PageType { } } } + } - ButtonGroup { - id: buttonGroup + CardType { + implicitWidth: parent.width + + headerText: qsTr("Set up a VPN yourself") + bodyText: qsTr("I want to choose a VPN protocol") + + ButtonGroup.group: buttonGroup + + onClicked: function() { + isEasySetup = false } } @@ -132,11 +148,15 @@ PageType { text: qsTr("Continue") onClicked: function() { - ContainersModel.setCurrentlyProcessedContainerIndex(containers.dockerContainer) - goToPage(PageEnum.PageSetupWizardInstalling); - InstallController.install(containers.dockerContainer, - containers.containerDefaultPort, - containers.containerDefaultTransportProto) + if (root.isEasySetup) { + ContainersModel.setCurrentlyProcessedContainerIndex(containers.dockerContainer) + goToPage(PageEnum.PageSetupWizardInstalling); + InstallController.install(containers.dockerContainer, + containers.containerDefaultPort, + containers.containerDefaultTransportProto) + } else { + goToPage(PageEnum.PageSetupWizardProtocols) + } } } } diff --git a/client/ui/qml/Pages2/PageSetupWizardInstalling.qml b/client/ui/qml/Pages2/PageSetupWizardInstalling.qml index f254a474..6c6d1a67 100644 --- a/client/ui/qml/Pages2/PageSetupWizardInstalling.qml +++ b/client/ui/qml/Pages2/PageSetupWizardInstalling.qml @@ -17,11 +17,6 @@ PageType { Connections { target: InstallController - function onInstallationErrorOccurred(errorMessage) { - closePage() - PageController.showErrorMessage(errorMessage) - } - function onInstallContainerFinished(finishedMessage) { goToStartPage() if (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageHome)) { diff --git a/client/ui/qml/Pages2/PageSetupWizardStart.qml b/client/ui/qml/Pages2/PageSetupWizardStart.qml index eff17ab5..11d7ba29 100644 --- a/client/ui/qml/Pages2/PageSetupWizardStart.qml +++ b/client/ui/qml/Pages2/PageSetupWizardStart.qml @@ -85,8 +85,7 @@ PageType { text: qsTr("I have nothing") - onClicked: { - } + onClicked: Qt.openUrlExternally("https://ru-docs.amnezia.org/guides/hosting-instructions") } } diff --git a/client/ui/qml/Pages2/PageStart.qml b/client/ui/qml/Pages2/PageStart.qml index 811fc923..ec29b314 100644 --- a/client/ui/qml/Pages2/PageStart.qml +++ b/client/ui/qml/Pages2/PageStart.qml @@ -45,6 +45,26 @@ PageType { } } + Connections { + target: InstallController + + function onInstallationErrorOccurred(errorMessage) { + PageController.showErrorMessage(errorMessage) + + var needCloseCurrentPage = false + var currentPageName = stackView.currentItem.objectName + + if (currentPageName === PageController.getPagePath(PageEnum.PageSetupWizardInstalling)) { + needCloseCurrentPage = true + } else if (currentPageName === PageController.getPagePath(PageEnum.PageDeinstalling)) { + needCloseCurrentPage = true + } + if (needCloseCurrentPage) { + PageController.closePage() + } + } + } + StackViewType { id: tabBarStackView