Merge remote-tracking branch 'origin/dev' into ios-wireguard
This commit is contained in:
commit
8591d4e96c
31 changed files with 287 additions and 2632 deletions
|
@ -78,14 +78,15 @@
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<service android:name=".VPNService"
|
<service android:name=".VPNService"
|
||||||
android:process=":QtOnlyProcess"
|
android:process=":QtOnlyProcess"
|
||||||
android:permission="android.permission.BIND_VPN_SERVICE">
|
android:permission="android.permission.BIND_VPN_SERVICE">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.net.VpnService"/>
|
<action android:name="android.net.VpnService"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
<service android:name="org.mozilla.firefox.vpn.qt.VPNPermissionHelper"
|
|
||||||
android:permission="android.permission.BIND_VPN_SERVICE">
|
<service android:name="org.amnezia.vpn.qt.VPNPermissionHelper"
|
||||||
|
android:permission="android.permission.BIND_VPN_SERVICE">
|
||||||
</service>
|
</service>
|
||||||
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
|
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
|
||||||
</application>
|
</application>
|
||||||
|
|
|
@ -31,9 +31,7 @@ HEADERS += \
|
||||||
containers/containers_defs.h \
|
containers/containers_defs.h \
|
||||||
core/defs.h \
|
core/defs.h \
|
||||||
core/errorstrings.h \
|
core/errorstrings.h \
|
||||||
core/ipcclient.h \
|
|
||||||
configurators/openvpn_configurator.h \
|
configurators/openvpn_configurator.h \
|
||||||
core/privileged_process.h \
|
|
||||||
core/scripts_registry.h \
|
core/scripts_registry.h \
|
||||||
core/server_defs.h \
|
core/server_defs.h \
|
||||||
core/servercontroller.h \
|
core/servercontroller.h \
|
||||||
|
@ -88,9 +86,7 @@ SOURCES += \
|
||||||
configurators/wireguard_configurator.cpp \
|
configurators/wireguard_configurator.cpp \
|
||||||
containers/containers_defs.cpp \
|
containers/containers_defs.cpp \
|
||||||
core/errorstrings.cpp \
|
core/errorstrings.cpp \
|
||||||
core/ipcclient.cpp \
|
|
||||||
configurators/openvpn_configurator.cpp \
|
configurators/openvpn_configurator.cpp \
|
||||||
core/privileged_process.cpp \
|
|
||||||
core/scripts_registry.cpp \
|
core/scripts_registry.cpp \
|
||||||
core/server_defs.cpp \
|
core/server_defs.cpp \
|
||||||
core/servercontroller.cpp \
|
core/servercontroller.cpp \
|
||||||
|
@ -203,6 +199,8 @@ win32|macx|linux:!android {
|
||||||
DEFINES += AMNEZIA_DESKTOP
|
DEFINES += AMNEZIA_DESKTOP
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
core/ipcclient.h \
|
||||||
|
core/privileged_process.h \
|
||||||
ui/systemtray_notificationhandler.h \
|
ui/systemtray_notificationhandler.h \
|
||||||
protocols/openvpnprotocol.h \
|
protocols/openvpnprotocol.h \
|
||||||
protocols/openvpnovercloakprotocol.h \
|
protocols/openvpnovercloakprotocol.h \
|
||||||
|
@ -210,11 +208,16 @@ win32|macx|linux:!android {
|
||||||
protocols/wireguardprotocol.h \
|
protocols/wireguardprotocol.h \
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
core/ipcclient.cpp \
|
||||||
|
core/privileged_process.cpp \
|
||||||
ui/systemtray_notificationhandler.cpp \
|
ui/systemtray_notificationhandler.cpp \
|
||||||
protocols/openvpnprotocol.cpp \
|
protocols/openvpnprotocol.cpp \
|
||||||
protocols/openvpnovercloakprotocol.cpp \
|
protocols/openvpnovercloakprotocol.cpp \
|
||||||
protocols/shadowsocksvpnprotocol.cpp \
|
protocols/shadowsocksvpnprotocol.cpp \
|
||||||
protocols/wireguardprotocol.cpp \
|
protocols/wireguardprotocol.cpp \
|
||||||
|
|
||||||
|
REPC_REPLICA += ../ipc/ipc_interface.rep
|
||||||
|
REPC_REPLICA += ../ipc/ipc_process_interface.rep
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
@ -360,6 +363,4 @@ ios {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
REPC_REPLICA += ../ipc/ipc_interface.rep
|
|
||||||
!ios: REPC_REPLICA += ../ipc/ipc_process_interface.rep
|
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ Proto ContainerProps::defaultProtocol(DockerContainer c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContainerProps::isWorkingOnPlatform(DockerContainer c)
|
bool ContainerProps::isSupportedByCurrentPlatform(DockerContainer c)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
// it may be changed fot future containers :)
|
// it may be changed fot future containers :)
|
||||||
Q_INVOKABLE static Proto defaultProtocol(DockerContainer c);
|
Q_INVOKABLE static Proto defaultProtocol(DockerContainer c);
|
||||||
|
|
||||||
Q_INVOKABLE static bool isWorkingOnPlatform(DockerContainer c);
|
Q_INVOKABLE static bool isSupportedByCurrentPlatform(DockerContainer c);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,6 @@ bool IpcClient::init(IpcClient *instance)
|
||||||
|
|
||||||
QSharedPointer<PrivilegedProcess> IpcClient::CreatePrivilegedProcess()
|
QSharedPointer<PrivilegedProcess> IpcClient::CreatePrivilegedProcess()
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_IOS
|
|
||||||
if (! Instance()->m_ipcClient || ! Instance()->m_ipcClient->isReplicaValid()) {
|
if (! Instance()->m_ipcClient || ! Instance()->m_ipcClient->isReplicaValid()) {
|
||||||
qWarning() << "IpcClient::createPrivilegedProcess : IpcClient IpcClient replica is not valid";
|
qWarning() << "IpcClient::createPrivilegedProcess : IpcClient IpcClient replica is not valid";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -107,9 +106,6 @@ QSharedPointer<PrivilegedProcess> IpcClient::CreatePrivilegedProcess()
|
||||||
|
|
||||||
auto proccessReplica = QSharedPointer<PrivilegedProcess>(pd->ipcProcess);
|
auto proccessReplica = QSharedPointer<PrivilegedProcess>(pd->ipcProcess);
|
||||||
return proccessReplica;
|
return proccessReplica;
|
||||||
#else
|
|
||||||
return QSharedPointer<PrivilegedProcess>();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include "privileged_process.h"
|
#include "privileged_process.h"
|
||||||
|
|
||||||
#ifndef Q_OS_IOS
|
|
||||||
PrivilegedProcess::PrivilegedProcess() :
|
PrivilegedProcess::PrivilegedProcess() :
|
||||||
IpcProcessInterfaceReplica()
|
IpcProcessInterfaceReplica()
|
||||||
{
|
{
|
||||||
|
@ -26,4 +25,3 @@ void PrivilegedProcess::waitForFinished(int msecs)
|
||||||
|
|
||||||
loop->exec();
|
loop->exec();
|
||||||
}
|
}
|
||||||
#endif // Q_OS_IOS
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#ifndef Q_OS_IOS
|
|
||||||
#include "rep_ipc_process_interface_replica.h"
|
#include "rep_ipc_process_interface_replica.h"
|
||||||
// This class is dangerous - instance of this class casted from base class,
|
// This class is dangerous - instance of this class casted from base class,
|
||||||
// so it support only functions
|
// so it support only functions
|
||||||
|
@ -20,11 +19,6 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#else // defined Q_OS_IOS
|
|
||||||
class IpcProcessInterfaceReplica {};
|
|
||||||
class PrivilegedProcess {};
|
|
||||||
#endif // Q_OS_IOS
|
|
||||||
|
|
||||||
#endif // PRIVILEGED_PROCESS_H
|
#endif // PRIVILEGED_PROCESS_H
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include <QDateTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
@ -6,12 +7,14 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <core/ipcclient.h>
|
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#ifdef AMNEZIA_DESKTOP
|
||||||
|
#include <core/ipcclient.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
QFile Debug::m_file;
|
QFile Debug::m_file;
|
||||||
QTextStream Debug::m_textStream;
|
QTextStream Debug::m_textStream;
|
||||||
QString Debug::m_logFileName = QString("%1.log").arg(APPLICATION_NAME);
|
QString Debug::m_logFileName = QString("%1.log").arg(APPLICATION_NAME);
|
||||||
|
@ -140,6 +143,7 @@ void Debug::clearLogs()
|
||||||
|
|
||||||
void Debug::clearServiceLogs()
|
void Debug::clearServiceLogs()
|
||||||
{
|
{
|
||||||
|
#ifdef AMNEZIA_DESKTOP
|
||||||
IpcClient *m_IpcClient = new IpcClient;
|
IpcClient *m_IpcClient = new IpcClient;
|
||||||
|
|
||||||
if (!m_IpcClient->isSocketConnected()) {
|
if (!m_IpcClient->isSocketConnected()) {
|
||||||
|
@ -156,6 +160,7 @@ void Debug::clearServiceLogs()
|
||||||
else {
|
else {
|
||||||
qWarning() << "Error occured cleaning up service logs";
|
qWarning() << "Error occured cleaning up service logs";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Debug::cleanUp()
|
void Debug::cleanUp()
|
||||||
|
|
|
@ -97,7 +97,7 @@ constexpr char ckBypassUidKeyPath[] = "/opt/amnezia/cloak/cloak_bypass_uid.key";
|
||||||
constexpr char ckAdminKeyPath[] = "/opt/amnezia/cloak/cloak_admin_uid.key";
|
constexpr char ckAdminKeyPath[] = "/opt/amnezia/cloak/cloak_admin_uid.key";
|
||||||
constexpr char defaultPort[] = "443";
|
constexpr char defaultPort[] = "443";
|
||||||
constexpr char defaultRedirSite[] = "tile.openstreetmap.org";
|
constexpr char defaultRedirSite[] = "tile.openstreetmap.org";
|
||||||
constexpr char defaultCipher[] = "chacha20-ietf-poly1305";
|
constexpr char defaultCipher[] = "chacha20-poly1305";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -3,6 +3,7 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "ui/qautostart.h"
|
#include "ui/qautostart.h"
|
||||||
|
#include "ui/uilogic.h"
|
||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -65,22 +66,7 @@ void AppSettingsLogic::onPushButtonOpenLogsClicked()
|
||||||
|
|
||||||
void AppSettingsLogic::onPushButtonExportLogsClicked()
|
void AppSettingsLogic::onPushButtonExportLogsClicked()
|
||||||
{
|
{
|
||||||
QString log = Debug::getLogFile();
|
uiLogic()->saveTextFile(tr("Save log"), "AmneziaVPN.log", ".log", Debug::getLogFile());
|
||||||
QString ext = ".log";
|
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Save log"),
|
|
||||||
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*" + ext);
|
|
||||||
|
|
||||||
if (fileName.isEmpty()) return;
|
|
||||||
if (!fileName.endsWith(ext)) fileName.append(ext);
|
|
||||||
|
|
||||||
QFile save(fileName);
|
|
||||||
save.open(QIODevice::WriteOnly);
|
|
||||||
save.write(log.toUtf8());
|
|
||||||
save.close();
|
|
||||||
|
|
||||||
QFileInfo fi(fileName);
|
|
||||||
QDesktopServices::openUrl(fi.absoluteDir().absolutePath());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppSettingsLogic::onPushButtonClearLogsClicked()
|
void AppSettingsLogic::onPushButtonClearLogsClicked()
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "core/errorstrings.h"
|
#include "core/errorstrings.h"
|
||||||
#include <core/servercontroller.h>
|
#include <core/servercontroller.h>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
ServerSettingsLogic::ServerSettingsLogic(UiLogic *logic, QObject *parent):
|
ServerSettingsLogic::ServerSettingsLogic(UiLogic *logic, QObject *parent):
|
||||||
PageLogicBase(logic, parent),
|
PageLogicBase(logic, parent),
|
||||||
|
|
|
@ -206,6 +206,6 @@ void SitesLogic::onPushButtonSitesExportClicked()
|
||||||
for (auto s : sites.keys()) {
|
for (auto s : sites.keys()) {
|
||||||
data += s + "\t" + sites.value(s).toString() + "\n";
|
data += s + "\t" + sites.value(s).toString() + "\n";
|
||||||
}
|
}
|
||||||
uiLogic()->saveTextFile("Sites", ".txt", data);
|
uiLogic()->saveTextFile("Export Sites", "sites.txt", ".txt", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
#include "VpnLogic.h"
|
#include "VpnLogic.h"
|
||||||
|
|
||||||
#include "core/errorstrings.h"
|
#include "core/errorstrings.h"
|
||||||
#include "vpnconnection.h"
|
#include "vpnconnection.h"
|
||||||
|
#include <QTimer>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "../uilogic.h"
|
#include "../uilogic.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
@ -19,6 +22,8 @@ VpnLogic::VpnLogic(UiLogic *logic, QObject *parent):
|
||||||
m_labelSpeedReceivedText{tr("0 Mbps")},
|
m_labelSpeedReceivedText{tr("0 Mbps")},
|
||||||
m_labelSpeedSentText{tr("0 Mbps")},
|
m_labelSpeedSentText{tr("0 Mbps")},
|
||||||
m_labelStateText{},
|
m_labelStateText{},
|
||||||
|
m_isContainerHaveAuthData{false},
|
||||||
|
m_isContainerSupportedByCurrentPlatform{false},
|
||||||
m_widgetVpnModeEnabled{false}
|
m_widgetVpnModeEnabled{false}
|
||||||
{
|
{
|
||||||
connect(uiLogic()->m_vpnConnection, &VpnConnection::bytesChanged, this, &VpnLogic::onBytesChanged);
|
connect(uiLogic()->m_vpnConnection, &VpnConnection::bytesChanged, this, &VpnLogic::onBytesChanged);
|
||||||
|
@ -49,6 +54,8 @@ void VpnLogic::onUpdatePage()
|
||||||
selectedContainer == DockerContainer::ShadowSocks||
|
selectedContainer == DockerContainer::ShadowSocks||
|
||||||
selectedContainer == DockerContainer::Cloak);
|
selectedContainer == DockerContainer::Cloak);
|
||||||
|
|
||||||
|
set_isContainerHaveAuthData(m_settings.haveAuthData(m_settings.defaultServerIndex()));
|
||||||
|
|
||||||
set_radioButtonVpnModeAllSitesChecked(mode == Settings::VpnAllSites || !isCustomRoutesSupported());
|
set_radioButtonVpnModeAllSitesChecked(mode == Settings::VpnAllSites || !isCustomRoutesSupported());
|
||||||
set_radioButtonVpnModeForwardSitesChecked(mode == Settings::VpnOnlyForwardSites && isCustomRoutesSupported());
|
set_radioButtonVpnModeForwardSitesChecked(mode == Settings::VpnOnlyForwardSites && isCustomRoutesSupported());
|
||||||
set_radioButtonVpnModeExceptSitesChecked(mode == Settings::VpnAllExceptSites && isCustomRoutesSupported());
|
set_radioButtonVpnModeExceptSitesChecked(mode == Settings::VpnAllExceptSites && isCustomRoutesSupported());
|
||||||
|
@ -72,8 +79,8 @@ void VpnLogic::onUpdatePage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
set_isContainerWorkingOnPlatform(ContainerProps::isWorkingOnPlatform(selectedContainer));
|
set_isContainerSupportedByCurrentPlatform(ContainerProps::isSupportedByCurrentPlatform(selectedContainer));
|
||||||
if (!isContainerWorkingOnPlatform()) {
|
if (!isContainerSupportedByCurrentPlatform()) {
|
||||||
set_labelErrorText(tr("AmneziaVPN not supporting selected protocol on this device. Select another protocol."));
|
set_labelErrorText(tr("AmneziaVPN not supporting selected protocol on this device. Select another protocol."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -238,6 +245,6 @@ void VpnLogic::onConnectWorker(int serverIndex, const ServerCredentials &credent
|
||||||
|
|
||||||
void VpnLogic::onDisconnect()
|
void VpnLogic::onDisconnect()
|
||||||
{
|
{
|
||||||
set_pushButtonConnectChecked(false);
|
onConnectionStateChanged(VpnProtocol::Disconnected);
|
||||||
emit disconnectFromVpn();
|
emit disconnectFromVpn();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@ class VpnLogic : public PageLogicBase
|
||||||
AUTO_PROPERTY(bool, pushButtonConnectEnabled)
|
AUTO_PROPERTY(bool, pushButtonConnectEnabled)
|
||||||
AUTO_PROPERTY(bool, pushButtonConnectVisible)
|
AUTO_PROPERTY(bool, pushButtonConnectVisible)
|
||||||
AUTO_PROPERTY(bool, widgetVpnModeEnabled)
|
AUTO_PROPERTY(bool, widgetVpnModeEnabled)
|
||||||
AUTO_PROPERTY(bool, isContainerWorkingOnPlatform)
|
AUTO_PROPERTY(bool, isContainerSupportedByCurrentPlatform)
|
||||||
|
AUTO_PROPERTY(bool, isContainerHaveAuthData)
|
||||||
|
|
||||||
AUTO_PROPERTY(QString, labelErrorText)
|
AUTO_PROPERTY(QString, labelErrorText)
|
||||||
AUTO_PROPERTY(QString, labelVersionText)
|
AUTO_PROPERTY(QString, labelVersionText)
|
||||||
|
|
|
@ -5,11 +5,13 @@ BasicButtonType {
|
||||||
id: root
|
id: root
|
||||||
property alias iconMargin: img.anchors.margins
|
property alias iconMargin: img.anchors.margins
|
||||||
property alias img: img
|
property alias img: img
|
||||||
|
property int imgMargin: 4
|
||||||
|
property int imgMarginHover: 3
|
||||||
background: Item {}
|
background: Item {}
|
||||||
contentItem: Image {
|
contentItem: Image {
|
||||||
id: img
|
id: img
|
||||||
source: root.icon.source
|
source: root.icon.source
|
||||||
anchors.fill: root
|
anchors.fill: root
|
||||||
anchors.margins: root.containsMouse ? 3 : 4
|
anchors.margins: root.containsMouse ? imgMarginHover : imgMargin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import QtQuick.Controls 2.12
|
||||||
BasicButtonType {
|
BasicButtonType {
|
||||||
id: root
|
id: root
|
||||||
property alias textItem: textItem
|
property alias textItem: textItem
|
||||||
|
height: 30
|
||||||
|
|
||||||
background: Item {}
|
background: Item {}
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
|
|
|
@ -42,6 +42,7 @@ PageBase {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
CheckBoxType {
|
CheckBoxType {
|
||||||
|
visible: !GC.isMobile()
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: qsTr("Auto connect")
|
text: qsTr("Auto connect")
|
||||||
checked: AppSettingsLogic.checkBoxAutoConnectChecked
|
checked: AppSettingsLogic.checkBoxAutoConnectChecked
|
||||||
|
@ -51,6 +52,7 @@ PageBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckBoxType {
|
CheckBoxType {
|
||||||
|
visible: !GC.isMobile()
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: qsTr("Auto start")
|
text: qsTr("Auto start")
|
||||||
checked: AppSettingsLogic.checkBoxAutostartChecked
|
checked: AppSettingsLogic.checkBoxAutostartChecked
|
||||||
|
@ -60,6 +62,7 @@ PageBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckBoxType {
|
CheckBoxType {
|
||||||
|
visible: !GC.isMobile()
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: qsTr("Start minimized")
|
text: qsTr("Start minimized")
|
||||||
checked: AppSettingsLogic.checkBoxStartMinimizedChecked
|
checked: AppSettingsLogic.checkBoxStartMinimizedChecked
|
||||||
|
@ -74,6 +77,7 @@ PageBase {
|
||||||
text: AppSettingsLogic.labelVersionText
|
text: AppSettingsLogic.labelVersionText
|
||||||
}
|
}
|
||||||
BlueButtonType {
|
BlueButtonType {
|
||||||
|
visible: !GC.isMobile()
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 41
|
Layout.preferredHeight: 41
|
||||||
text: qsTr("Check for updates")
|
text: qsTr("Check for updates")
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.12
|
import QtQuick.Controls 2.12
|
||||||
|
import QtQuick.Layouts 1.15
|
||||||
import QtGraphicalEffects 1.15
|
import QtGraphicalEffects 1.15
|
||||||
import PageEnum 1.0
|
import PageEnum 1.0
|
||||||
import "./"
|
import "./"
|
||||||
|
@ -13,176 +14,155 @@ PageBase {
|
||||||
|
|
||||||
BackButton {
|
BackButton {
|
||||||
id: back
|
id: back
|
||||||
|
z: -1
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- App settings ------------
|
Flickable {
|
||||||
Rectangle {
|
id: fl
|
||||||
id: l1
|
width: root.width
|
||||||
visible: !GC.isMobile()
|
|
||||||
anchors.top: back.bottom
|
anchors.top: back.bottom
|
||||||
x: 20
|
anchors.topMargin: 0
|
||||||
width: parent.width - 40
|
anchors.bottom: root.bottom
|
||||||
height: GC.isMobile() ? 0: 1
|
anchors.bottomMargin: 10
|
||||||
color: "#DDDDDD"
|
anchors.left: root.left
|
||||||
}
|
anchors.leftMargin: 30
|
||||||
|
anchors.right: root.right
|
||||||
|
anchors.rightMargin: 30
|
||||||
|
|
||||||
SettingButtonType {
|
contentHeight: content.height
|
||||||
id: b1
|
clip: true
|
||||||
visible: !GC.isMobile()
|
|
||||||
anchors.top: l1.bottom
|
ColumnLayout {
|
||||||
anchors.topMargin: GC.isMobile() ? 0: 15
|
id: content
|
||||||
x: 30
|
enabled: logic.pageEnabled
|
||||||
width: parent.width - 80
|
anchors.top: parent.top
|
||||||
height: GC.isMobile() ? 0: 30
|
anchors.topMargin: 10
|
||||||
icon.source: "qrc:/images/svg/settings_black_24dp.svg"
|
anchors.left: parent.left
|
||||||
text: qsTr("App settings")
|
anchors.right: parent.right
|
||||||
onClicked: {
|
|
||||||
UiLogic.goToPage(PageEnum.AppSettings)
|
spacing: 15
|
||||||
|
|
||||||
|
|
||||||
|
// ---------- App settings ------------
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 1
|
||||||
|
color: "#DDDDDD"
|
||||||
|
}
|
||||||
|
SettingButtonType {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 30
|
||||||
|
icon.source: "qrc:/images/svg/settings_black_24dp.svg"
|
||||||
|
text: qsTr("App settings")
|
||||||
|
onClicked: {
|
||||||
|
UiLogic.goToPage(PageEnum.AppSettings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- Network settings ------------
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 1
|
||||||
|
color: "#DDDDDD"
|
||||||
|
}
|
||||||
|
SettingButtonType {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 30
|
||||||
|
icon.source: "qrc:/images/svg/settings_suggest_black_24dp.svg"
|
||||||
|
text: qsTr("Network settings")
|
||||||
|
onClicked: {
|
||||||
|
UiLogic.goToPage(PageEnum.NetworkSettings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- Server settings ------------
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 1
|
||||||
|
color: "#DDDDDD"
|
||||||
|
}
|
||||||
|
SettingButtonType {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 30
|
||||||
|
icon.source: "qrc:/images/svg/vpn_key_black_24dp.svg"
|
||||||
|
text: qsTr("Server Settings")
|
||||||
|
onClicked: {
|
||||||
|
GeneralSettingsLogic.onPushButtonGeneralSettingsServerSettingsClicked()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- Share connection ------------
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 1
|
||||||
|
color: "#DDDDDD"
|
||||||
|
}
|
||||||
|
SettingButtonType {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 30
|
||||||
|
icon.source: "qrc:/images/svg/share_black_24dp.svg"
|
||||||
|
text: qsTr("Share connection")
|
||||||
|
enabled: GeneralSettingsLogic.pushButtonGeneralSettingsShareConnectionEnable
|
||||||
|
onClicked: {
|
||||||
|
GeneralSettingsLogic.onPushButtonGeneralSettingsShareConnectionClicked()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- Servers ------------
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 1
|
||||||
|
color: "#DDDDDD"
|
||||||
|
}
|
||||||
|
SettingButtonType {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 30
|
||||||
|
icon.source: "qrc:/images/svg/format_list_bulleted_black_24dp.svg"
|
||||||
|
text: qsTr("Servers")
|
||||||
|
onClicked: {
|
||||||
|
UiLogic.goToPage(PageEnum.ServersList)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- Add server ------------
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 1
|
||||||
|
color: "#DDDDDD"
|
||||||
|
}
|
||||||
|
SettingButtonType {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 30
|
||||||
|
icon.source: "qrc:/images/svg/control_point_black_24dp.svg"
|
||||||
|
text: qsTr("Add server")
|
||||||
|
onClicked: {
|
||||||
|
UiLogic.goToPage(PageEnum.Start)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 1
|
||||||
|
color: "#DDDDDD"
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: fl.height > (75+1) * 6 ? fl.height - (75+1) * 6 : 0
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingButtonType {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 30
|
||||||
|
Layout.bottomMargin: 20
|
||||||
|
icon.source: "qrc:/images/svg/logout_black_24dp.svg"
|
||||||
|
text: qsTr("Exit")
|
||||||
|
onClicked: {
|
||||||
|
Qt.quit()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- Network settings ------------
|
|
||||||
Rectangle {
|
|
||||||
id: l2
|
|
||||||
anchors.top: b1.bottom
|
|
||||||
anchors.topMargin: 15
|
|
||||||
x: 20
|
|
||||||
width: parent.width - 40
|
|
||||||
height: 1
|
|
||||||
color: "#DDDDDD"
|
|
||||||
}
|
|
||||||
SettingButtonType {
|
|
||||||
id: b2
|
|
||||||
x: 30
|
|
||||||
anchors.top: l2.bottom
|
|
||||||
anchors.topMargin: 15
|
|
||||||
width: parent.width - 40
|
|
||||||
height: 30
|
|
||||||
icon.source: "qrc:/images/svg/settings_suggest_black_24dp.svg"
|
|
||||||
text: qsTr("Network settings")
|
|
||||||
onClicked: {
|
|
||||||
UiLogic.goToPage(PageEnum.NetworkSettings)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------- Server settings ------------
|
|
||||||
Rectangle {
|
|
||||||
id: l3
|
|
||||||
anchors.top: b2.bottom
|
|
||||||
anchors.topMargin: 15
|
|
||||||
x: 20
|
|
||||||
width: parent.width - 40
|
|
||||||
height: 1
|
|
||||||
color: "#DDDDDD"
|
|
||||||
}
|
|
||||||
SettingButtonType {
|
|
||||||
id: b3
|
|
||||||
x: 30
|
|
||||||
anchors.top: l3.bottom
|
|
||||||
anchors.topMargin: 15
|
|
||||||
width: 330
|
|
||||||
height: 30
|
|
||||||
icon.source: "qrc:/images/svg/vpn_key_black_24dp.svg"
|
|
||||||
text: qsTr("Server Settings")
|
|
||||||
onClicked: {
|
|
||||||
GeneralSettingsLogic.onPushButtonGeneralSettingsServerSettingsClicked()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------- Share connection ------------
|
|
||||||
Rectangle {
|
|
||||||
id: l4
|
|
||||||
anchors.top: b3.bottom
|
|
||||||
anchors.topMargin: 15
|
|
||||||
x: 20
|
|
||||||
width: parent.width - 40
|
|
||||||
height: 1
|
|
||||||
color: "#DDDDDD"
|
|
||||||
}
|
|
||||||
SettingButtonType {
|
|
||||||
id: b4
|
|
||||||
x: 30
|
|
||||||
anchors.top: l4.bottom
|
|
||||||
anchors.topMargin: 15
|
|
||||||
width: 330
|
|
||||||
height: 30
|
|
||||||
icon.source: "qrc:/images/svg/share_black_24dp.svg"
|
|
||||||
text: qsTr("Share connection")
|
|
||||||
enabled: GeneralSettingsLogic.pushButtonGeneralSettingsShareConnectionEnable
|
|
||||||
onClicked: {
|
|
||||||
GeneralSettingsLogic.onPushButtonGeneralSettingsShareConnectionClicked()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------- Servers ------------
|
|
||||||
Rectangle {
|
|
||||||
id: l5
|
|
||||||
anchors.top: b4.bottom
|
|
||||||
anchors.topMargin: 15
|
|
||||||
x: 20
|
|
||||||
width: parent.width - 40
|
|
||||||
height: 1
|
|
||||||
color: "#DDDDDD"
|
|
||||||
}
|
|
||||||
SettingButtonType {
|
|
||||||
id: b5
|
|
||||||
x: 30
|
|
||||||
anchors.top: l5.bottom
|
|
||||||
anchors.topMargin: 15
|
|
||||||
width: 330
|
|
||||||
height: 30
|
|
||||||
icon.source: "qrc:/images/svg/format_list_bulleted_black_24dp.svg"
|
|
||||||
text: qsTr("Servers")
|
|
||||||
onClicked: {
|
|
||||||
UiLogic.goToPage(PageEnum.ServersList)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------- Add server ------------
|
|
||||||
Rectangle {
|
|
||||||
id: l6
|
|
||||||
anchors.top: b5.bottom
|
|
||||||
anchors.topMargin: 15
|
|
||||||
x: 20
|
|
||||||
width: parent.width - 40
|
|
||||||
height: 1
|
|
||||||
color: "#DDDDDD"
|
|
||||||
}
|
|
||||||
SettingButtonType {
|
|
||||||
id: b6
|
|
||||||
x: 30
|
|
||||||
anchors.top: l6.bottom
|
|
||||||
anchors.topMargin: 15
|
|
||||||
width: 330
|
|
||||||
height: 30
|
|
||||||
icon.source: "qrc:/images/svg/control_point_black_24dp.svg"
|
|
||||||
text: qsTr("Add server")
|
|
||||||
onClicked: {
|
|
||||||
UiLogic.goToPage(PageEnum.Start)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: l7
|
|
||||||
anchors.top: b6.bottom
|
|
||||||
anchors.topMargin: 15
|
|
||||||
x: 20
|
|
||||||
width: parent.width - 40
|
|
||||||
height: 1
|
|
||||||
color: "#DDDDDD"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SettingButtonType {
|
|
||||||
x: 30
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.bottomMargin: 20
|
|
||||||
width: 330
|
|
||||||
height: 30
|
|
||||||
icon.source: "qrc:/images/svg/logout_black_24dp.svg"
|
|
||||||
text: qsTr("Exit")
|
|
||||||
onClicked: {
|
|
||||||
Qt.quit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,16 +16,16 @@ PageBase {
|
||||||
}
|
}
|
||||||
Caption {
|
Caption {
|
||||||
id: caption
|
id: caption
|
||||||
text: qsTr("Servers list")
|
text: qsTr("Servers")
|
||||||
width: undefined
|
width: undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
SvgButtonType {
|
SvgButtonType {
|
||||||
anchors.bottom: caption.bottom
|
anchors.verticalCenter: caption.verticalCenter
|
||||||
anchors.leftMargin: 10
|
anchors.leftMargin: 10
|
||||||
anchors.left: caption.right
|
anchors.left: caption.right
|
||||||
width: 24
|
width: 27
|
||||||
height: 24
|
height: 27
|
||||||
|
|
||||||
icon.source: "qrc:/images/svg/control_point_black_24dp.svg"
|
icon.source: "qrc:/images/svg/control_point_black_24dp.svg"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
|
@ -59,9 +59,11 @@ PageBase {
|
||||||
|
|
||||||
ImageButtonType {
|
ImageButtonType {
|
||||||
x: parent.width - 40
|
x: parent.width - 40
|
||||||
y: 10
|
y: 0
|
||||||
width: 31
|
width: 41
|
||||||
height: 31
|
height: 41
|
||||||
|
imgMarginHover: 8
|
||||||
|
imgMargin: 9
|
||||||
icon.source: "qrc:/images/settings_grey.png"
|
icon.source: "qrc:/images/settings_grey.png"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.goToPage(PageEnum.GeneralSettings)
|
UiLogic.goToPage(PageEnum.GeneralSettings)
|
||||||
|
@ -98,7 +100,7 @@ PageBase {
|
||||||
}
|
}
|
||||||
contentItem: Item {}
|
contentItem: Item {}
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
enabled: VpnLogic.pushButtonConnectEnabled && VpnLogic.isContainerWorkingOnPlatform
|
enabled: VpnLogic.pushButtonConnectEnabled && VpnLogic.isContainerSupportedByCurrentPlatform
|
||||||
opacity: VpnLogic.pushButtonConnectVisible ? 1 : 0
|
opacity: VpnLogic.pushButtonConnectVisible ? 1 : 0
|
||||||
|
|
||||||
// transitions: Transition {
|
// transitions: Transition {
|
||||||
|
@ -128,14 +130,14 @@ PageBase {
|
||||||
LabelType {
|
LabelType {
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
height: 21
|
height: 21
|
||||||
text: qsTr("Server") + ": "
|
text: ( VpnLogic.isContainerHaveAuthData ? qsTr("Server") : qsTr("Profile")) + ": "
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicButtonType {
|
BasicButtonType {
|
||||||
Layout.alignment: Qt.AlignLeft
|
Layout.alignment: Qt.AlignLeft
|
||||||
height: 21
|
height: 21
|
||||||
background: Item {}
|
background: Item {}
|
||||||
text: VpnLogic.labelCurrentServer + " →"
|
text: VpnLogic.labelCurrentServer + (VpnLogic.isContainerHaveAuthData ? " →" : "")
|
||||||
font.family: "Lato"
|
font.family: "Lato"
|
||||||
font.styleName: "normal"
|
font.styleName: "normal"
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
|
@ -163,12 +165,12 @@ PageBase {
|
||||||
Layout.alignment: Qt.AlignLeft
|
Layout.alignment: Qt.AlignLeft
|
||||||
height: 21
|
height: 21
|
||||||
background: Item {}
|
background: Item {}
|
||||||
text: VpnLogic.labelCurrentService + " →"
|
text: VpnLogic.labelCurrentService + (VpnLogic.isContainerHaveAuthData ? " →" : "")
|
||||||
font.family: "Lato"
|
font.family: "Lato"
|
||||||
font.styleName: "normal"
|
font.styleName: "normal"
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.onGotoCurrentProtocolsPage()
|
if (VpnLogic.isContainerHaveAuthData) UiLogic.onGotoCurrentProtocolsPage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,12 +194,12 @@ PageBase {
|
||||||
height: 21
|
height: 21
|
||||||
implicitWidth: implicitContentWidth > root.width * 0.6 ? root.width * 0.6 : implicitContentWidth + leftPadding + rightPadding
|
implicitWidth: implicitContentWidth > root.width * 0.6 ? root.width * 0.6 : implicitContentWidth + leftPadding + rightPadding
|
||||||
background: Item {}
|
background: Item {}
|
||||||
text: VpnLogic.labelCurrentDns + " →"
|
text: VpnLogic.labelCurrentDns + (VpnLogic.isContainerHaveAuthData ? " →" : "")
|
||||||
font.family: "Lato"
|
font.family: "Lato"
|
||||||
font.styleName: "normal"
|
font.styleName: "normal"
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.goToPage(PageEnum.NetworkSettings)
|
if (VpnLogic.isContainerHaveAuthData) UiLogic.goToPage(PageEnum.NetworkSettings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ New encryption keys pair will be generated.")
|
||||||
visible: tfShareCode.textArea.length > 0
|
visible: tfShareCode.textArea.length > 0
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.saveTextFile(qsTr("Save AmneziaVPN config"), "*.vpn", tfShareCode.textArea.text)
|
UiLogic.saveTextFile(qsTr("Save AmneziaVPN config"), "amnezia_config.vpn", "*.vpn", tfShareCode.textArea.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ PageShareProtocolBase {
|
||||||
visible: tfShareCode.textArea.length > 0
|
visible: tfShareCode.textArea.length > 0
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.saveTextFile(qsTr("Save AmneziaVPN config"), "*.json", tfShareCode.textArea.text)
|
UiLogic.saveTextFile(qsTr("Save AmneziaVPN config"), "amnezia_config_cloak.json", "*.json", tfShareCode.textArea.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ PageShareProtocolBase {
|
||||||
visible: tfCert.textArea.length > 0
|
visible: tfCert.textArea.length > 0
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.saveTextFile(qsTr("Export p12 certificate"), "*.p12", tfCert.textArea.text)
|
UiLogic.saveTextFile(qsTr("Export p12 certificate"), "amnezia_ikev2_cert_for_windows.p12", "*.p12", tfCert.textArea.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ PageShareProtocolBase {
|
||||||
visible: tfMobileConfig.textArea.length > 0
|
visible: tfMobileConfig.textArea.length > 0
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.saveTextFile(qsTr("Export config for Apple"), "*.plist", tfMobileConfig.textArea.text)
|
UiLogic.saveTextFile(qsTr("Export config for Apple"), "amnezia_for_apple.plist", "*.plist", tfMobileConfig.textArea.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ PageShareProtocolBase {
|
||||||
visible: tfStrongSwanConfig.textArea.length > 0
|
visible: tfStrongSwanConfig.textArea.length > 0
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.saveTextFile(qsTr("Export config for StrongSwan"), "*.profile", tfStrongSwanConfig.textArea.text)
|
UiLogic.saveTextFile(qsTr("Export config for StrongSwan"), "amnezia_for_StrongSwan.profile", "*.profile", tfStrongSwanConfig.textArea.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ PageShareProtocolBase {
|
||||||
visible: tfShareCode.textArea.length > 0
|
visible: tfShareCode.textArea.length > 0
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "*.ovpn", tfShareCode.textArea.text)
|
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "amnezia_for_openvpn.ovpn", "*.ovpn", tfShareCode.textArea.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ PageShareProtocolBase {
|
||||||
visible: tfShareCode.textArea.length > 0
|
visible: tfShareCode.textArea.length > 0
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "*.conf", tfShareCode.textArea.text)
|
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "amnezia_for_wireguard.conf", "*.conf", tfShareCode.textArea.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ Window {
|
||||||
height: GC.isDesktop() ? GC.screenHeight + titleBar.height : GC.screenHeight
|
height: GC.isDesktop() ? GC.screenHeight + titleBar.height : GC.screenHeight
|
||||||
minimumWidth: 360
|
minimumWidth: 360
|
||||||
minimumHeight: GC.isDesktop() ? 640 : 0
|
minimumHeight: GC.isDesktop() ? 640 : 0
|
||||||
Keys.enabled: true
|
|
||||||
onClosing: {
|
onClosing: {
|
||||||
console.debug("QML onClosing signal")
|
console.debug("QML onClosing signal")
|
||||||
UiLogic.onCloseWindow()
|
UiLogic.onCloseWindow()
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
#include <QQmlFile>
|
||||||
|
|
||||||
#include "configurators/cloak_configurator.h"
|
#include "configurators/cloak_configurator.h"
|
||||||
#include "configurators/vpn_configurator.h"
|
#include "configurators/vpn_configurator.h"
|
||||||
|
@ -29,7 +30,6 @@
|
||||||
#include "core/errorstrings.h"
|
#include "core/errorstrings.h"
|
||||||
|
|
||||||
#include "containers/containers_defs.h"
|
#include "containers/containers_defs.h"
|
||||||
#include "protocols/shadowsocksvpnprotocol.h"
|
|
||||||
|
|
||||||
#include "ui/qautostart.h"
|
#include "ui/qautostart.h"
|
||||||
|
|
||||||
|
@ -135,6 +135,11 @@ UiLogic::~UiLogic()
|
||||||
void UiLogic::initalizeUiLogic()
|
void UiLogic::initalizeUiLogic()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
|
connect(AndroidController::instance(), &AndroidController::initialized, [this](bool status, bool connected, const QDateTime& connectionDate) {
|
||||||
|
if (connected) {
|
||||||
|
vpnLogic()->onConnectionStateChanged(VpnProtocol::Connected);
|
||||||
|
}
|
||||||
|
});
|
||||||
if (!AndroidController::instance()->initialize()) {
|
if (!AndroidController::instance()->initialize()) {
|
||||||
qDebug() << QString("Init failed") ;
|
qDebug() << QString("Init failed") ;
|
||||||
emit VpnProtocol::Error;
|
emit VpnProtocol::Error;
|
||||||
|
@ -605,21 +610,52 @@ PageEnumNS::Page UiLogic::currentPage()
|
||||||
return static_cast<PageEnumNS::Page>(currentPageValue());
|
return static_cast<PageEnumNS::Page>(currentPageValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
void UiLogic::saveTextFile(const QString& desc, QString ext, const QString& data)
|
void UiLogic::saveTextFile(const QString& desc, const QString& suggestedName, QString ext, const QString& data)
|
||||||
{
|
{
|
||||||
|
// ext.replace("*", "");
|
||||||
|
// QString fileName = QFileDialog::getSaveFileName(nullptr, desc,
|
||||||
|
// QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*" + ext);
|
||||||
|
|
||||||
|
// if (fileName.isEmpty()) return;
|
||||||
|
// if (!fileName.endsWith(ext)) fileName.append(ext);
|
||||||
|
|
||||||
|
// QFile save(fileName);
|
||||||
|
// save.open(QIODevice::WriteOnly);
|
||||||
|
// save.write(data.toUtf8());
|
||||||
|
// save.close();
|
||||||
|
|
||||||
|
// QFileInfo fi(fileName);
|
||||||
|
// QDesktopServices::openUrl(fi.absoluteDir().absolutePath());
|
||||||
|
|
||||||
|
|
||||||
ext.replace("*", "");
|
ext.replace("*", "");
|
||||||
QString fileName = QFileDialog::getSaveFileName(nullptr, desc,
|
QString docDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||||
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*" + ext);
|
QUrl fileName;
|
||||||
|
#ifdef AMNEZIA_DESKTOP
|
||||||
|
fileName = QFileDialog::getSaveFileUrl(nullptr, desc,
|
||||||
|
QUrl::fromLocalFile(docDir + "/" + suggestedName), "*" + ext);
|
||||||
if (fileName.isEmpty()) return;
|
if (fileName.isEmpty()) return;
|
||||||
if (!fileName.endsWith(ext)) fileName.append(ext);
|
if (!fileName.toString().endsWith(ext)) fileName = QUrl(fileName.toString() + ext);
|
||||||
|
#elif defined Q_OS_ANDROID
|
||||||
|
fileName = QFileDialog::getSaveFileUrl(nullptr, suggestedName,
|
||||||
|
QUrl::fromLocalFile(docDir), "*" + ext);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
qDebug() << "UiLogic::saveTextFile" << fileName;
|
||||||
|
if (fileName.isEmpty()) return;
|
||||||
|
|
||||||
|
#ifdef AMNEZIA_DESKTOP
|
||||||
|
QFile save(fileName.toLocalFile());
|
||||||
|
#else
|
||||||
|
qDebug() << "UiLogic::saveTextFile" << QQmlFile::urlToLocalFileOrQrc(fileName);
|
||||||
|
QFile save(QQmlFile::urlToLocalFileOrQrc(fileName));
|
||||||
|
#endif
|
||||||
|
|
||||||
QFile save(fileName);
|
|
||||||
save.open(QIODevice::WriteOnly);
|
save.open(QIODevice::WriteOnly);
|
||||||
save.write(data.toUtf8());
|
save.write(data.toUtf8());
|
||||||
save.close();
|
save.close();
|
||||||
|
|
||||||
QFileInfo fi(fileName);
|
QFileInfo fi(fileName.toLocalFile());
|
||||||
QDesktopServices::openUrl(fi.absoluteDir().absolutePath());
|
QDesktopServices::openUrl(fi.absoluteDir().absolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void keyPressEvent(Qt::Key key);
|
Q_INVOKABLE void keyPressEvent(Qt::Key key);
|
||||||
|
|
||||||
Q_INVOKABLE void saveTextFile(const QString& desc, QString ext, const QString& data);
|
Q_INVOKABLE void saveTextFile(const QString& desc, const QString &suggestedName, QString ext, const QString& data);
|
||||||
Q_INVOKABLE void saveBinaryFile(const QString& desc, QString ext, const QString& data);
|
Q_INVOKABLE void saveBinaryFile(const QString& desc, QString ext, const QString& data);
|
||||||
Q_INVOKABLE void copyToClipboard(const QString& text);
|
Q_INVOKABLE void copyToClipboard(const QString& text);
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,12 @@
|
||||||
#include <configurators/wireguard_configurator.h>
|
#include <configurators/wireguard_configurator.h>
|
||||||
#include <configurators/vpn_configurator.h>
|
#include <configurators/vpn_configurator.h>
|
||||||
#include <core/servercontroller.h>
|
#include <core/servercontroller.h>
|
||||||
|
|
||||||
|
#ifdef AMNEZIA_DESKTOP
|
||||||
|
#include "ipc.h"
|
||||||
|
#include "core/ipcclient.h"
|
||||||
#include <protocols/wireguardprotocol.h>
|
#include <protocols/wireguardprotocol.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
#include "android_controller.h"
|
#include "android_controller.h"
|
||||||
|
@ -21,9 +26,6 @@
|
||||||
#include <protocols/ios_vpnprotocol.h>
|
#include <protocols/ios_vpnprotocol.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ipc.h"
|
|
||||||
#include "core/ipcclient.h"
|
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "vpnconnection.h"
|
#include "vpnconnection.h"
|
||||||
|
|
||||||
|
@ -48,6 +50,7 @@ void VpnConnection::onBytesChanged(quint64 receivedBytes, quint64 sentBytes)
|
||||||
|
|
||||||
void VpnConnection::onConnectionStateChanged(VpnProtocol::VpnConnectionState state)
|
void VpnConnection::onConnectionStateChanged(VpnProtocol::VpnConnectionState state)
|
||||||
{
|
{
|
||||||
|
#ifdef AMNEZIA_DESKTOP
|
||||||
if (IpcClient::Interface()) {
|
if (IpcClient::Interface()) {
|
||||||
if (state == VpnProtocol::Connected){
|
if (state == VpnProtocol::Connected){
|
||||||
IpcClient::Interface()->resetIpStack();
|
IpcClient::Interface()->resetIpStack();
|
||||||
|
@ -87,7 +90,7 @@ void VpnConnection::onConnectionStateChanged(VpnProtocol::VpnConnectionState sta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
emit connectionStateChanged(state);
|
emit connectionStateChanged(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +101,7 @@ const QString &VpnConnection::remoteAddress() const
|
||||||
|
|
||||||
void VpnConnection::addSitesRoutes(const QString &gw, Settings::RouteMode mode)
|
void VpnConnection::addSitesRoutes(const QString &gw, Settings::RouteMode mode)
|
||||||
{
|
{
|
||||||
|
#ifdef AMNEZIA_DESKTOP
|
||||||
QStringList ips;
|
QStringList ips;
|
||||||
QStringList sites;
|
QStringList sites;
|
||||||
const QVariantMap &m = m_settings.vpnSites(mode);
|
const QVariantMap &m = m_settings.vpnSites(mode);
|
||||||
|
@ -137,6 +141,7 @@ void VpnConnection::addSitesRoutes(const QString &gw, Settings::RouteMode mode)
|
||||||
};
|
};
|
||||||
QHostInfo::lookupHost(site, this, cbResolv);
|
QHostInfo::lookupHost(site, this, cbResolv);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<VpnProtocol> VpnConnection::vpnProtocol() const
|
QSharedPointer<VpnProtocol> VpnConnection::vpnProtocol() const
|
||||||
|
@ -146,6 +151,7 @@ QSharedPointer<VpnProtocol> VpnConnection::vpnProtocol() const
|
||||||
|
|
||||||
void VpnConnection::addRoutes(const QStringList &ips)
|
void VpnConnection::addRoutes(const QStringList &ips)
|
||||||
{
|
{
|
||||||
|
#ifdef AMNEZIA_DESKTOP
|
||||||
if (connectionState() == VpnProtocol::Connected && IpcClient::Interface()) {
|
if (connectionState() == VpnProtocol::Connected && IpcClient::Interface()) {
|
||||||
if (m_settings.routeMode() == Settings::VpnOnlyForwardSites) {
|
if (m_settings.routeMode() == Settings::VpnOnlyForwardSites) {
|
||||||
IpcClient::Interface()->routeAddList(m_vpnProtocol->vpnGateway(), ips);
|
IpcClient::Interface()->routeAddList(m_vpnProtocol->vpnGateway(), ips);
|
||||||
|
@ -154,10 +160,12 @@ void VpnConnection::addRoutes(const QStringList &ips)
|
||||||
IpcClient::Interface()->routeAddList(m_vpnProtocol->routeGateway(), ips);
|
IpcClient::Interface()->routeAddList(m_vpnProtocol->routeGateway(), ips);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void VpnConnection::deleteRoutes(const QStringList &ips)
|
void VpnConnection::deleteRoutes(const QStringList &ips)
|
||||||
{
|
{
|
||||||
|
#ifdef AMNEZIA_DESKTOP
|
||||||
if (connectionState() == VpnProtocol::Connected && IpcClient::Interface()) {
|
if (connectionState() == VpnProtocol::Connected && IpcClient::Interface()) {
|
||||||
if (m_settings.routeMode() == Settings::VpnOnlyForwardSites) {
|
if (m_settings.routeMode() == Settings::VpnOnlyForwardSites) {
|
||||||
IpcClient::Interface()->routeDeleteList(vpnProtocol()->vpnGateway(), ips);
|
IpcClient::Interface()->routeDeleteList(vpnProtocol()->vpnGateway(), ips);
|
||||||
|
@ -166,11 +174,14 @@ void VpnConnection::deleteRoutes(const QStringList &ips)
|
||||||
IpcClient::Interface()->routeDeleteList(m_vpnProtocol->routeGateway(), ips);
|
IpcClient::Interface()->routeDeleteList(m_vpnProtocol->routeGateway(), ips);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void VpnConnection::flushDns()
|
void VpnConnection::flushDns()
|
||||||
{
|
{
|
||||||
|
#ifdef AMNEZIA_DESKTOP
|
||||||
if (IpcClient::Interface()) IpcClient::Interface()->flushDns();
|
if (IpcClient::Interface()) IpcClient::Interface()->flushDns();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorCode VpnConnection::lastError() const
|
ErrorCode VpnConnection::lastError() const
|
||||||
|
@ -351,6 +362,7 @@ void VpnConnection::disconnectFromVpn()
|
||||||
{
|
{
|
||||||
// qDebug() << "Disconnect from VPN 1";
|
// qDebug() << "Disconnect from VPN 1";
|
||||||
|
|
||||||
|
#ifdef AMNEZIA_DESKTOP
|
||||||
if (IpcClient::Interface()) {
|
if (IpcClient::Interface()) {
|
||||||
IpcClient::Interface()->flushDns();
|
IpcClient::Interface()->flushDns();
|
||||||
|
|
||||||
|
@ -358,8 +370,15 @@ void VpnConnection::disconnectFromVpn()
|
||||||
QRemoteObjectPendingReply<bool> response = IpcClient::Interface()->clearSavedRoutes();
|
QRemoteObjectPendingReply<bool> response = IpcClient::Interface()->clearSavedRoutes();
|
||||||
response.waitForFinished(1000);
|
response.waitForFinished(1000);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!m_vpnProtocol.data()) {
|
if (!m_vpnProtocol.data()) {
|
||||||
|
emit connectionStateChanged(VpnProtocol::Disconnected);
|
||||||
|
#ifdef Q_OS_ANDROID
|
||||||
|
AndroidController::instance()->stop();
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_vpnProtocol.data()->stop();
|
m_vpnProtocol.data()->stop();
|
||||||
|
|
|
@ -8,9 +8,12 @@
|
||||||
|
|
||||||
#include "protocols/vpnprotocol.h"
|
#include "protocols/vpnprotocol.h"
|
||||||
#include "core/defs.h"
|
#include "core/defs.h"
|
||||||
#include "core/ipcclient.h"
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
|
#ifdef AMNEZIA_DESKTOP
|
||||||
|
#include "core/ipcclient.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace amnezia;
|
using namespace amnezia;
|
||||||
|
|
||||||
class VpnConnection : public QObject
|
class VpnConnection : public QObject
|
||||||
|
@ -74,8 +77,10 @@ private:
|
||||||
QJsonObject m_vpnConfiguration;
|
QJsonObject m_vpnConfiguration;
|
||||||
QJsonObject m_routeMode;
|
QJsonObject m_routeMode;
|
||||||
QString m_remoteAddress;
|
QString m_remoteAddress;
|
||||||
IpcClient *m_IpcClient {nullptr};
|
|
||||||
|
|
||||||
|
#ifdef AMNEZIA_DESKTOP
|
||||||
|
IpcClient *m_IpcClient {nullptr};
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPNCONNECTION_H
|
#endif // VPNCONNECTION_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue