From c2b02a45a2891e9333a1a38c2c9aa79f9a39d894 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Sat, 21 Jan 2023 10:35:01 +0300 Subject: [PATCH 1/9] fixed path to linux install folderfixed path to installed application in linux --- .gitignore | 3 +++ deploy/installer/config/controlscript.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 20624e5b..562b2ee7 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,6 @@ captures/ # Android Profiling *.hprof client/3rd/ShadowSocks/ss_ios.xcconfig + +# UML generated pics +out/ \ No newline at end of file diff --git a/deploy/installer/config/controlscript.js b/deploy/installer/config/controlscript.js index 9be76c15..df7cefee 100644 --- a/deploy/installer/config/controlscript.js +++ b/deploy/installer/config/controlscript.js @@ -26,7 +26,7 @@ function appInstalled() } else if (runningOnMacOS()){ appInstalledUninstallerPath = "/Applications/" + appName() + ".app/maintenancetool.app/Contents/MacOS/maintenancetool"; } else if (runningOnLinux()){ - allInstalledUninstallerPath = "/opt/" + appName(); + appInstalledUninstallerPath = "/opt/" + appName(); } return installer.fileExists(appInstalledUninstallerPath) || installer.fileExists(appInstalledUninstallerPath_x86); From eb66354c763ca8fb0b492593740131e98c4492b5 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Sun, 22 Jan 2023 08:24:45 +0300 Subject: [PATCH 2/9] fixed path to maintenancetool in linux - added x11 to runningOnLinux() function --- deploy/installer/config/controlscript.js | 4 ++-- .../packages/org.amneziavpn.package/meta/componentscript.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deploy/installer/config/controlscript.js b/deploy/installer/config/controlscript.js index df7cefee..bf22f8f6 100644 --- a/deploy/installer/config/controlscript.js +++ b/deploy/installer/config/controlscript.js @@ -26,7 +26,7 @@ function appInstalled() } else if (runningOnMacOS()){ appInstalledUninstallerPath = "/Applications/" + appName() + ".app/maintenancetool.app/Contents/MacOS/maintenancetool"; } else if (runningOnLinux()){ - appInstalledUninstallerPath = "/opt/" + appName(); + appInstalledUninstallerPath = "/opt/" + appName() + "/maintenancetool"; } return installer.fileExists(appInstalledUninstallerPath) || installer.fileExists(appInstalledUninstallerPath_x86); @@ -49,7 +49,7 @@ function runningOnMacOS() function runningOnLinux() { - return (installer.value("os") === "linux"); + return ((installer.value("os") === "linux") || (installer.value("os") === "x11")); } function sleep(miliseconds) { diff --git a/deploy/installer/packages/org.amneziavpn.package/meta/componentscript.js b/deploy/installer/packages/org.amneziavpn.package/meta/componentscript.js index d752d5a3..aae48338 100644 --- a/deploy/installer/packages/org.amneziavpn.package/meta/componentscript.js +++ b/deploy/installer/packages/org.amneziavpn.package/meta/componentscript.js @@ -93,7 +93,7 @@ Component.prototype.createOperations = function() } else if (runningOnMacOS()) { component.addElevatedOperation("Execute", "@TargetDir@/post_install.sh", "UNDOEXECUTE", "@TargetDir@/post_uninstall.sh"); } else if (runningOnLinux()) { - component.addElevatedOperation("Execute", "bash", "@TargetDir@/post_install.sh", "UNDOEXECUTE", "bash", "@TargetDir@/post_uninstall.sh"); + component.addElevatedOperation("Execute", "bash", "@TargetDir@/post_install.sh", "UNDOEXECUTE", "bash", "@TargetDir@/post_uninstall.sh"); } } From ee609f3e8f92775bb01456f10d86b68cd57e6409 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Tue, 24 Jan 2023 09:43:12 +0300 Subject: [PATCH 3/9] fixed warning with QFutureWatcher - renamed readWireguardConfiguration function to match what it does --- client/core/servercontroller.cpp | 3 +-- client/protocols/wireguardprotocol.cpp | 4 ++-- client/protocols/wireguardprotocol.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/client/core/servercontroller.cpp b/client/core/servercontroller.cpp index 716a7740..375215b7 100644 --- a/client/core/servercontroller.cpp +++ b/client/core/servercontroller.cpp @@ -549,10 +549,9 @@ ErrorCode ServerController::installDockerWorker(const ServerCredentials &credent return ErrorCode::NoError; }); - watcher.setFuture(future); - QEventLoop wait; QObject::connect(&watcher, &QFutureWatcher::finished, &wait, &QEventLoop::quit); + watcher.setFuture(future); wait.exec(); m_cancelInstallation = false; diff --git a/client/protocols/wireguardprotocol.cpp b/client/protocols/wireguardprotocol.cpp index 985d835c..224d5176 100644 --- a/client/protocols/wireguardprotocol.cpp +++ b/client/protocols/wireguardprotocol.cpp @@ -12,7 +12,7 @@ WireguardProtocol::WireguardProtocol(const QJsonObject &configuration, QObject* VpnProtocol(configuration, parent) { m_configFile.setFileName(QDir::tempPath() + QDir::separator() + serviceName() + ".conf"); - readWireguardConfiguration(configuration); + writeWireguardConfiguration(configuration); } WireguardProtocol::~WireguardProtocol() @@ -70,7 +70,7 @@ void WireguardProtocol::stop() } -void WireguardProtocol::readWireguardConfiguration(const QJsonObject &configuration) +void WireguardProtocol::writeWireguardConfiguration(const QJsonObject &configuration) { QJsonObject jConfig = configuration.value(ProtocolProps::key_proto_config_data(Proto::WireGuard)).toObject(); diff --git a/client/protocols/wireguardprotocol.h b/client/protocols/wireguardprotocol.h index 3a091cac..7a50b0d3 100644 --- a/client/protocols/wireguardprotocol.h +++ b/client/protocols/wireguardprotocol.h @@ -23,7 +23,7 @@ public: private: QString configPath() const; - void readWireguardConfiguration(const QJsonObject &configuration); + void writeWireguardConfiguration(const QJsonObject &configuration); void updateRouteGateway(QString line); void updateVpnGateway(const QString &line); From 051a2a3ef2bf0447765fb3829cf99c4bacbb829d Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Fri, 27 Jan 2023 10:25:14 +0300 Subject: [PATCH 4/9] Added popup to confirm actions "Clear server from Amnesia software" and "Forget this server" --- client/containers/containers_defs.cpp | 2 +- client/resources.qrc | 1 + client/ui/qml/Controls/PopupWithQuestion.qml | 55 ++++++++++++++++++++ client/ui/qml/Pages/PageServerSettings.qml | 31 +++++++++-- 4 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 client/ui/qml/Controls/PopupWithQuestion.qml diff --git a/client/containers/containers_defs.cpp b/client/containers/containers_defs.cpp index 3313a772..c9ee2959 100644 --- a/client/containers/containers_defs.cpp +++ b/client/containers/containers_defs.cpp @@ -70,7 +70,7 @@ QList ContainerProps::allContainers() QMap ContainerProps::containerHumanNames() { return { - {DockerContainer::None, "Unknown (Old version)"}, + {DockerContainer::None, "Not installed"}, {DockerContainer::OpenVpn, "OpenVPN"}, {DockerContainer::ShadowSocks, "OpenVpn over ShadowSocks"}, {DockerContainer::Cloak, "OpenVpn over Cloak"}, diff --git a/client/resources.qrc b/client/resources.qrc index 105c06b8..4651f91e 100644 --- a/client/resources.qrc +++ b/client/resources.qrc @@ -163,5 +163,6 @@ images/svg/control_point_black_24dp.svg images/svg/settings_suggest_black_24dp.svg server_scripts/website_tor/Dockerfile + ui/qml/Controls/PopupWithQuestion.qml diff --git a/client/ui/qml/Controls/PopupWithQuestion.qml b/client/ui/qml/Controls/PopupWithQuestion.qml new file mode 100644 index 00000000..a5ea4611 --- /dev/null +++ b/client/ui/qml/Controls/PopupWithQuestion.qml @@ -0,0 +1,55 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Popup { + id: root + + property string questionText + property string yesText: "yes" + property string noText: "no" + property var yesFunc + property var noFunc + + anchors.centerIn: Overlay.overlay + modal: true + closePolicy: Popup.NoAutoClose + + width: parent.width - 20 + + ColumnLayout { + width: parent.width + Text { + horizontalAlignment: Text.AlignHCenter + Layout.fillWidth: true + wrapMode: Text.WordWrap + font.pixelSize: 16 + text: questionText + } + + RowLayout { + BlueButtonType { + id: yesButton + Layout.fillWidth: true + text: yesText + onClicked: { + root.enabled = false + if (yesFunc && typeof yesFunc === "function") { + yesFunc() + } + root.enabled = true + } + } + BlueButtonType { + id: noButton + Layout.fillWidth: true + text: noText + onClicked: { + if (noFunc && typeof noFunc === "function") { + noFunc() + } + } + } + } + } +} diff --git a/client/ui/qml/Pages/PageServerSettings.qml b/client/ui/qml/Pages/PageServerSettings.qml index 921cc8d9..1c7f2248 100644 --- a/client/ui/qml/Pages/PageServerSettings.qml +++ b/client/ui/qml/Pages/PageServerSettings.qml @@ -93,24 +93,49 @@ PageBase { ServerSettingsLogic.onPushButtonClearClientCacheClicked() } } + BlueButtonType { Layout.fillWidth: true Layout.topMargin: 10 text: ServerSettingsLogic.pushButtonClearText visible: ServerSettingsLogic.pushButtonClearVisible - onClicked: { - ServerSettingsLogic.onPushButtonClearServer() + onClicked: { + popupClearServer.open() } } + + PopupWithQuestion { + id: popupClearServer + questionText: "Attention! All containers will be deleted on the server. This means that configuration files, keys and certificates will be deleted. Continue?" + yesFunc: function() { + ServerSettingsLogic.onPushButtonClearServer() + close() + } + noFunc: function() { + close() + } + } + BlueButtonType { Layout.fillWidth: true Layout.topMargin: 10 text: qsTr("Forget this server") onClicked: { - ServerSettingsLogic.onPushButtonForgetServer() + popupForgetServer.open() } } + PopupWithQuestion { + id: popupForgetServer + questionText: "Attention! Something will happen. Continue?" + yesFunc: function() { + ServerSettingsLogic.onPushButtonForgetServer() + close() + } + noFunc: function() { + close() + } + } } } From da47054497a5efb810ddcf585a475b22dae1fe20 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Fri, 27 Jan 2023 18:37:08 +0300 Subject: [PATCH 5/9] changed element type to confirm container deletion from MessageDialog to PopupWithQuestion - fixed "back" button availability for readonly servers --- client/ui/qml/Pages/PageServerContainers.qml | 30 +++++++++---------- .../ui/qml/Pages/Protocols/PageProtoCloak.qml | 3 +- .../qml/Pages/Protocols/PageProtoOpenVPN.qml | 6 +--- .../Pages/Protocols/PageProtoShadowSocks.qml | 2 +- client/ui/qml/main.qml | 12 -------- 5 files changed, 18 insertions(+), 35 deletions(-) diff --git a/client/ui/qml/Pages/PageServerContainers.qml b/client/ui/qml/Pages/PageServerContainers.qml index 4b8383e6..86363698 100644 --- a/client/ui/qml/Pages/PageServerContainers.qml +++ b/client/ui/qml/Pages/PageServerContainers.qml @@ -297,23 +297,24 @@ PageBase { implicitHeight: 30 checked: default_role - - MessageDialog { - id: dialogRemove - buttons: StandardButton.Yes | StandardButton.Cancel - title: "AmneziaVPN" - text: qsTr("Remove container") + " " + name_role + "?" + "\n" + qsTr("This action will erase all data of this container on the server.") - onAccepted: { - tb_c.currentIndex = -1 - ServerContainersLogic.onPushButtonRemoveClicked(proxyContainersModel.mapToSource(index)) - } - } - - onClicked: dialogRemove.open() + onClicked: popupRemove.open() VisibleBehavior on visible { } } + PopupWithQuestion { + id: popupRemove + questionText: qsTr("Remove container") + " " + name_role + "?" + "\n" + qsTr("This action will erase all data of this container on the server.") + yesFunc: function() { + tb_c.currentIndex = -1 + ServerContainersLogic.onPushButtonRemoveClicked(proxyContainersModel.mapToSource(index)) + close() + } + noFunc: function() { + close() + } + } + ImageButtonType { id: button_share visible: (index === tb_c.currentIndex) && ServerContainersLogic.isManagedServer @@ -418,7 +419,7 @@ PageBase { BlueButtonType { id: pb_add_container - visible: container_selector.selectedIndex < 0 + visible: container_selector.selectedIndex < 0 && ServerContainersLogic.isManagedServer anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom @@ -430,6 +431,5 @@ PageBase { text: qsTr("Install new service") font.pixelSize: 16 onClicked: container_selector.visible ? container_selector.close() : container_selector.open() - } } diff --git a/client/ui/qml/Pages/Protocols/PageProtoCloak.qml b/client/ui/qml/Pages/Protocols/PageProtoCloak.qml index 86a2584a..bbccbad3 100644 --- a/client/ui/qml/Pages/Protocols/PageProtoCloak.qml +++ b/client/ui/qml/Pages/Protocols/PageProtoCloak.qml @@ -11,10 +11,9 @@ PageProtocolBase { protocol: ProtocolEnum.Cloak logic: UiLogic.protocolLogic(protocol) - enabled: logic.pageEnabled BackButton { id: back - enabled: logic.pageEnabled + enabled: !logic.pushButtonCancelVisible } Caption { diff --git a/client/ui/qml/Pages/Protocols/PageProtoOpenVPN.qml b/client/ui/qml/Pages/Protocols/PageProtoOpenVPN.qml index a0779d1c..590501d5 100644 --- a/client/ui/qml/Pages/Protocols/PageProtoOpenVPN.qml +++ b/client/ui/qml/Pages/Protocols/PageProtoOpenVPN.qml @@ -13,7 +13,7 @@ PageProtocolBase { BackButton { id: back - enabled: logic.pageEnabled + enabled: !logic.pushButtonCancelVisible } Caption { @@ -285,8 +285,6 @@ PageProtocolBase { } } } - - } BasicButtonType { @@ -338,8 +336,6 @@ PageProtocolBase { } } } - - } LabelType { diff --git a/client/ui/qml/Pages/Protocols/PageProtoShadowSocks.qml b/client/ui/qml/Pages/Protocols/PageProtoShadowSocks.qml index 4d627fe2..160c3ef6 100644 --- a/client/ui/qml/Pages/Protocols/PageProtoShadowSocks.qml +++ b/client/ui/qml/Pages/Protocols/PageProtoShadowSocks.qml @@ -13,7 +13,7 @@ PageProtocolBase { BackButton { id: back - enabled: logic.pageEnabled + enabled: !logic.pushButtonCancelVisible } Caption { diff --git a/client/ui/qml/main.qml b/client/ui/qml/main.qml index 7f631f96..10552c11 100644 --- a/client/ui/qml/main.qml +++ b/client/ui/qml/main.qml @@ -232,18 +232,6 @@ Window { } } - MessageDialog { - id: closePrompt -// x: (root.width - width) / 2 -// y: (root.height - height) / 2 - title: qsTr("Exit") - text: qsTr("Do you really want to quit?") -// standardButtons: StandardButton.Yes | StandardButton.No -// onYesClicked: { -// Qt.quit() -// } - visible: false - } MessageDialog { id: publicKeyWarning title: "AmneziaVPN" From 00c4cf300a171ef54c639a9cb8d30e712c0c8e5c Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Fri, 27 Jan 2023 19:56:39 +0300 Subject: [PATCH 6/9] fixed the width of the buttons in popupWithQuestion --- client/ui/qml/Controls/PopupWithQuestion.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/ui/qml/Controls/PopupWithQuestion.qml b/client/ui/qml/Controls/PopupWithQuestion.qml index a5ea4611..4eafd359 100644 --- a/client/ui/qml/Controls/PopupWithQuestion.qml +++ b/client/ui/qml/Controls/PopupWithQuestion.qml @@ -30,6 +30,7 @@ Popup { RowLayout { BlueButtonType { id: yesButton + Layout.preferredWidth: parent.width / 2 Layout.fillWidth: true text: yesText onClicked: { @@ -42,6 +43,7 @@ Popup { } BlueButtonType { id: noButton + Layout.preferredWidth: parent.width / 2 Layout.fillWidth: true text: noText onClicked: { From d652ecff21356f5f453e33e9c4f6f60592dbb7cb Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Sun, 29 Jan 2023 08:39:31 +0300 Subject: [PATCH 7/9] For the openvpn-cloak container, the choice of the transport protocol in the openvpn settings is blocked --- client/server_scripts/openvpn_cloak/Dockerfile | 1 - .../openvpn_cloak/configure_container.sh | 4 ++-- .../ui/pages_logic/protocols/OpenVpnLogic.cpp | 18 +++++++++--------- client/ui/qml/Pages/PageNewServerProtocols.qml | 2 +- client/ui/qml/Pages/PageServerContainers.qml | 1 - 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/client/server_scripts/openvpn_cloak/Dockerfile b/client/server_scripts/openvpn_cloak/Dockerfile index b3a6810d..3cb14e82 100644 --- a/client/server_scripts/openvpn_cloak/Dockerfile +++ b/client/server_scripts/openvpn_cloak/Dockerfile @@ -1,5 +1,4 @@ FROM alpine:3.15 - LABEL maintainer="AmneziaVPN" ARG SS_RELEASE="v1.13.1" diff --git a/client/server_scripts/openvpn_cloak/configure_container.sh b/client/server_scripts/openvpn_cloak/configure_container.sh index 26b514a4..5e2deb45 100644 --- a/client/server_scripts/openvpn_cloak/configure_container.sh +++ b/client/server_scripts/openvpn_cloak/configure_container.sh @@ -1,6 +1,6 @@ cat > /opt/amnezia/openvpn/server.conf < /opt/amnezia/cloak/ck-config.json < Date: Sun, 29 Jan 2023 09:01:48 +0300 Subject: [PATCH 8/9] Changed notification text for "Forget this server" action --- client/ui/qml/Pages/PageServerSettings.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ui/qml/Pages/PageServerSettings.qml b/client/ui/qml/Pages/PageServerSettings.qml index 1c7f2248..85bc07e3 100644 --- a/client/ui/qml/Pages/PageServerSettings.qml +++ b/client/ui/qml/Pages/PageServerSettings.qml @@ -127,7 +127,7 @@ PageBase { PopupWithQuestion { id: popupForgetServer - questionText: "Attention! Something will happen. Continue?" + questionText: "Attention! This action will not remove the container on the server, it will only remove the container information from the application. Continue?" yesFunc: function() { ServerSettingsLogic.onPushButtonForgetServer() close() From ca4d6e0b2fe56b874a6f77c190a6b42afb78b2e6 Mon Sep 17 00:00:00 2001 From: pokamest Date: Tue, 31 Jan 2023 00:47:01 +0000 Subject: [PATCH 9/9] Android cmake build fix --- client/3rd/QtSsh/src/botan/botan.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/3rd/QtSsh/src/botan/botan.cmake b/client/3rd/QtSsh/src/botan/botan.cmake index 24a35d1c..983b76db 100644 --- a/client/3rd/QtSsh/src/botan/botan.cmake +++ b/client/3rd/QtSsh/src/botan/botan.cmake @@ -27,7 +27,7 @@ if(APPLE AND NOT IOS) set(SOURCES ${SOURCES} ${CMAKE_CURRENT_LIST_DIR}/macos/botan_all.cpp) endif() -if(LINUX) +if(LINUX AND NOT ANDROID) include_directories(${CMAKE_CURRENT_LIST_DIR}/linux) set(HEADERS ${HEADERS} ${CMAKE_CURRENT_LIST_DIR}/linux/botan_all.h) set(SOURCES ${SOURCES} ${CMAKE_CURRENT_LIST_DIR}/linux/botan_all.cpp)