Merge pull request #1389 from amnezia-vpn/android7-pull

pull fixes
This commit is contained in:
pokamest 2025-01-31 23:02:15 +01:00 committed by GitHub
commit 4135eb0110
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 385 additions and 370 deletions

View file

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)
set(PROJECT AmneziaVPN) set(PROJECT AmneziaVPN)
project(${PROJECT} VERSION 4.8.3.1 project(${PROJECT} VERSION 4.8.3.2
DESCRIPTION "AmneziaVPN" DESCRIPTION "AmneziaVPN"
HOMEPAGE_URL "https://amnezia.org/" HOMEPAGE_URL "https://amnezia.org/"
) )
@ -11,7 +11,7 @@ string(TIMESTAMP CURRENT_DATE "%Y-%m-%d")
set(RELEASE_DATE "${CURRENT_DATE}") set(RELEASE_DATE "${CURRENT_DATE}")
set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH}) set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH})
set(APP_ANDROID_VERSION_CODE 1074) set(APP_ANDROID_VERSION_CODE 1075)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(MZ_PLATFORM_NAME "linux") set(MZ_PLATFORM_NAME "linux")

View file

@ -1,16 +1,14 @@
#include "xrayprotocol.h" #include "xrayprotocol.h"
#include "utilities.h"
#include "core/networkUtilities.h"
#include <QCryptographicHash> #include <QCryptographicHash>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
#include <QNetworkInterface> #include <QNetworkInterface>
#include "core/networkUtilities.h"
#include "utilities.h"
XrayProtocol::XrayProtocol(const QJsonObject &configuration, QObject *parent): XrayProtocol::XrayProtocol(const QJsonObject &configuration, QObject *parent) : VpnProtocol(configuration, parent)
VpnProtocol(configuration, parent)
{ {
readXrayConfiguration(configuration); readXrayConfiguration(configuration);
m_routeGateway = NetworkUtilities::getGatewayAndIface(); m_routeGateway = NetworkUtilities::getGatewayAndIface();
@ -45,10 +43,7 @@ ErrorCode XrayProtocol::start()
QStringList args = QStringList() << "-c" << m_xrayCfgFile.fileName() << "-format=json"; QStringList args = QStringList() << "-c" << m_xrayCfgFile.fileName() << "-format=json";
qDebug().noquote() << "XrayProtocol::start()" qDebug().noquote() << "XrayProtocol::start()" << xrayExecPath() << args.join(" ");
<< xrayExecPath() << args.join(" ");
m_xrayProcess.setProcessChannelMode(QProcess::MergedChannels); m_xrayProcess.setProcessChannelMode(QProcess::MergedChannels);
m_xrayProcess.setProgram(xrayExecPath()); m_xrayProcess.setProgram(xrayExecPath());
@ -66,7 +61,8 @@ ErrorCode XrayProtocol::start()
#endif #endif
}); });
connect(&m_xrayProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this](int exitCode, QProcess::ExitStatus exitStatus) { connect(&m_xrayProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this,
[this](int exitCode, QProcess::ExitStatus exitStatus) {
qDebug().noquote() << "XrayProtocol finished, exitCode, exitStatus" << exitCode << exitStatus; qDebug().noquote() << "XrayProtocol finished, exitCode, exitStatus" << exitCode << exitStatus;
setConnectionState(Vpn::ConnectionState::Disconnected); setConnectionState(Vpn::ConnectionState::Disconnected);
if ((exitStatus != QProcess::NormalExit) || (exitCode != 0)) { if ((exitStatus != QProcess::NormalExit) || (exitCode != 0)) {
@ -82,10 +78,9 @@ ErrorCode XrayProtocol::start()
setConnectionState(Vpn::ConnectionState::Connecting); setConnectionState(Vpn::ConnectionState::Connecting);
QThread::msleep(1000); QThread::msleep(1000);
return startTun2Sock(); return startTun2Sock();
} else
return ErrorCode::XrayExecutableMissing;
} }
else return ErrorCode::XrayExecutableMissing;
}
ErrorCode XrayProtocol::startTun2Sock() ErrorCode XrayProtocol::startTun2Sock()
{ {
@ -98,11 +93,9 @@ ErrorCode XrayProtocol::startTun2Sock()
connect(m_t2sProcess.data(), &IpcProcessTun2SocksReplica::stateChanged, this, connect(m_t2sProcess.data(), &IpcProcessTun2SocksReplica::stateChanged, this,
[&](QProcess::ProcessState newState) { qDebug() << "PrivilegedProcess stateChanged" << newState; }); [&](QProcess::ProcessState newState) { qDebug() << "PrivilegedProcess stateChanged" << newState; });
connect(m_t2sProcess.data(), &IpcProcessTun2SocksReplica::setConnectionState, this, connect(m_t2sProcess.data(), &IpcProcessTun2SocksReplica::setConnectionState, this, [&](int vpnState) {
[&](int vpnState) {
qDebug() << "PrivilegedProcess setConnectionState " << vpnState; qDebug() << "PrivilegedProcess setConnectionState " << vpnState;
if (vpnState == Vpn::ConnectionState::Connected) if (vpnState == Vpn::ConnectionState::Connected) {
{
setConnectionState(Vpn::ConnectionState::Connecting); setConnectionState(Vpn::ConnectionState::Connecting);
QList<QHostAddress> dnsAddr; QList<QHostAddress> dnsAddr;
dnsAddr.push_back(QHostAddress(m_configData.value(config_key::dns1).toString())); dnsAddr.push_back(QHostAddress(m_configData.value(config_key::dns1).toString()));
@ -127,7 +120,7 @@ ErrorCode XrayProtocol::startTun2Sock()
IpcClient::Interface()->enableKillSwitch(m_configData, 0); IpcClient::Interface()->enableKillSwitch(m_configData, 0);
} }
#endif #endif
if (m_routeMode == 0) { if (m_routeMode == Settings::RouteMode::VpnAllSites) {
IpcClient::Interface()->routeAddList(m_vpnGateway, QStringList() << "0.0.0.0/1"); IpcClient::Interface()->routeAddList(m_vpnGateway, QStringList() << "0.0.0.0/1");
IpcClient::Interface()->routeAddList(m_vpnGateway, QStringList() << "128.0.0.0/1"); IpcClient::Interface()->routeAddList(m_vpnGateway, QStringList() << "128.0.0.0/1");
IpcClient::Interface()->routeAddList(m_routeGateway, QStringList() << m_remoteAddress); IpcClient::Interface()->routeAddList(m_routeGateway, QStringList() << m_remoteAddress);
@ -137,8 +130,7 @@ ErrorCode XrayProtocol::startTun2Sock()
IpcClient::Interface()->updateResolvers("tun2", dnsAddr); IpcClient::Interface()->updateResolvers("tun2", dnsAddr);
QList<QNetworkInterface> netInterfaces = QNetworkInterface::allInterfaces(); QList<QNetworkInterface> netInterfaces = QNetworkInterface::allInterfaces();
for (int i = 0; i < netInterfaces.size(); i++) { for (int i = 0; i < netInterfaces.size(); i++) {
for (int j = 0; j < netInterfaces.at(i).addressEntries().size(); j++) for (int j = 0; j < netInterfaces.at(i).addressEntries().size(); j++) {
{
// killSwitch toggle // killSwitch toggle
if (m_vpnLocalAddress == netInterfaces.at(i).addressEntries().at(j).ip().toString()) { if (m_vpnLocalAddress == netInterfaces.at(i).addressEntries().at(j).ip().toString()) {
if (QVariant(m_configData.value(config_key::killSwitchOption).toString()).toBool()) { if (QVariant(m_configData.value(config_key::killSwitchOption).toString()).toBool()) {
@ -204,7 +196,7 @@ void XrayProtocol::readXrayConfiguration(const QJsonObject &configuration)
m_localPort = QString(amnezia::protocols::xray::defaultLocalProxyPort).toInt(); m_localPort = QString(amnezia::protocols::xray::defaultLocalProxyPort).toInt();
m_remoteHost = configuration.value(amnezia::config_key::hostName).toString(); m_remoteHost = configuration.value(amnezia::config_key::hostName).toString();
m_remoteAddress = NetworkUtilities::getIPAddress(m_remoteHost); m_remoteAddress = NetworkUtilities::getIPAddress(m_remoteHost);
m_routeMode = configuration.value(amnezia::config_key::splitTunnelType).toInt(); m_routeMode = static_cast<Settings::RouteMode>(configuration.value(amnezia::config_key::splitTunnelType).toInt());
m_primaryDNS = configuration.value(amnezia::config_key::dns1).toString(); m_primaryDNS = configuration.value(amnezia::config_key::dns1).toString();
m_secondaryDNS = configuration.value(amnezia::config_key::dns2).toString(); m_secondaryDNS = configuration.value(amnezia::config_key::dns2).toString();
} }

View file

@ -1,9 +1,11 @@
#ifndef XRAYPROTOCOL_H #ifndef XRAYPROTOCOL_H
#define XRAYPROTOCOL_H #define XRAYPROTOCOL_H
#include "openvpnprotocol.h"
#include "QProcess" #include "QProcess"
#include "containers/containers_defs.h" #include "containers/containers_defs.h"
#include "openvpnprotocol.h"
#include "settings.h"
class XrayProtocol : public VpnProtocol class XrayProtocol : public VpnProtocol
{ {
@ -24,11 +26,12 @@ protected:
private: private:
static QString xrayExecPath(); static QString xrayExecPath();
static QString tun2SocksExecPath(); static QString tun2SocksExecPath();
private: private:
int m_localPort; int m_localPort;
QString m_remoteHost; QString m_remoteHost;
QString m_remoteAddress; QString m_remoteAddress;
int m_routeMode; Settings::RouteMode m_routeMode;
QJsonObject m_configData; QJsonObject m_configData;
QString m_primaryDNS; QString m_primaryDNS;
QString m_secondaryDNS; QString m_secondaryDNS;
@ -37,7 +40,6 @@ private:
QSharedPointer<IpcProcessTun2SocksReplica> m_t2sProcess; QSharedPointer<IpcProcessTun2SocksReplica> m_t2sProcess;
#endif #endif
QTemporaryFile m_xrayCfgFile; QTemporaryFile m_xrayCfgFile;
}; };
#endif // XRAYPROTOCOL_H #endif // XRAYPROTOCOL_H

View file

@ -15,6 +15,12 @@
using namespace QKeychain; using namespace QKeychain;
namespace {
constexpr const char *settingsKeyTag = "settingsKeyTag";
constexpr const char *settingsIvTag = "settingsIvTag";
constexpr const char *keyChainName = "AmneziaVPN-Keychain";
}
SecureQSettings::SecureQSettings(const QString &organization, const QString &application, QObject *parent) SecureQSettings::SecureQSettings(const QString &organization, const QString &application, QObject *parent)
: QObject { parent }, m_settings(organization, application, parent), encryptedKeys({ "Servers/serversList" }) : QObject { parent }, m_settings(organization, application, parent), encryptedKeys({ "Servers/serversList" })
{ {
@ -49,7 +55,7 @@ QVariant SecureQSettings::value(const QString &key, const QVariant &defaultValue
// check if value is not encrypted, v. < 2.0.x // check if value is not encrypted, v. < 2.0.x
retVal = m_settings.value(key); retVal = m_settings.value(key);
if (retVal.isValid()) { if (retVal.isValid()) {
if (retVal.userType() == QVariant::ByteArray && retVal.toByteArray().mid(0, magicString.size()) == magicString) { if (retVal.userType() == QMetaType::QByteArray && retVal.toByteArray().mid(0, magicString.size()) == magicString) {
if (getEncKey().isEmpty() || getEncIv().isEmpty()) { if (getEncKey().isEmpty() || getEncIv().isEmpty()) {
qCritical() << "SecureQSettings::setValue Decryption requested, but key is empty"; qCritical() << "SecureQSettings::setValue Decryption requested, but key is empty";

View file

@ -8,10 +8,6 @@
#include "keychain.h" #include "keychain.h"
constexpr const char *settingsKeyTag = "settingsKeyTag";
constexpr const char *settingsIvTag = "settingsIvTag";
constexpr const char *keyChainName = "AmneziaVPN-Keychain";
class SecureQSettings : public QObject class SecureQSettings : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -44,7 +40,7 @@ public:
private: private:
QSettings m_settings; QSettings m_settings;
mutable QMap<QString, QVariant> m_cache; mutable QHash<QString, QVariant> m_cache;
QStringList encryptedKeys; // encode only key listed here QStringList encryptedKeys; // encode only key listed here
// only this fields need for backup // only this fields need for backup

View file

@ -1,7 +1,7 @@
if which apt-get > /dev/null 2>&1; then pm=$(which apt-get); silent_inst="-yq install"; check_pkgs="-yq update"; docker_pkg="docker.io"; dist="debian";\ if which apt-get > /dev/null 2>&1; then pm=$(which apt-get); silent_inst="-yq install"; check_pkgs="-yq update"; docker_pkg="docker.io"; dist="debian";\
elif which dnf > /dev/null 2>&1; then pm=$(which dnf); silent_inst="-yq install"; check_pkgs="-yq check-update"; docker_pkg="docker"; dist="fedora";\ elif which dnf > /dev/null 2>&1; then pm=$(which dnf); silent_inst="-yq install"; check_pkgs="-yq check-update"; docker_pkg="docker"; dist="fedora";\
elif which yum > /dev/null 2>&1; then pm=$(which yum); silent_inst="-y -q install"; check_pkgs="-y -q check-update"; docker_pkg="docker"; dist="centos";\ elif which yum > /dev/null 2>&1; then pm=$(which yum); silent_inst="-y -q install"; check_pkgs="-y -q check-update"; docker_pkg="docker"; dist="centos";\
elif which pacman > /dev/null 2>&1; then pm=$(which pacman); silent_inst="-S --noconfirm --noprogressbar --quiet"; check_pkgs="> /dev/null 2>&1"; docker_pkg="docker"; dist="archlinux";\ elif which pacman > /dev/null 2>&1; then pm=$(which pacman); silent_inst="-S --noconfirm --noprogressbar --quiet"; check_pkgs="-Sup"; docker_pkg="docker"; dist="archlinux";\
else echo "Packet manager not found"; exit 1; fi;\ else echo "Packet manager not found"; exit 1; fi;\
echo "Dist: $dist, Packet manager: $pm, Install command: $silent_inst, Check pkgs command: $check_pkgs, Docker pkg: $docker_pkg";\ echo "Dist: $dist, Packet manager: $pm, Install command: $silent_inst, Check pkgs command: $check_pkgs, Docker pkg: $docker_pkg";\
if [ "$dist" = "debian" ]; then export DEBIAN_FRONTEND=noninteractive; fi;\ if [ "$dist" = "debian" ]; then export DEBIAN_FRONTEND=noninteractive; fi;\
@ -12,6 +12,9 @@ if ! command -v docker > /dev/null 2>&1; then \
sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\ sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\
sleep 5; sudo systemctl enable --now docker; sleep 5;\ sleep 5; sudo systemctl enable --now docker; sleep 5;\
fi;\ fi;\
if [ "$(cat /sys/module/apparmor/parameters/enabled 2>/dev/null)" = "Y" ]; then \
if ! command -v apparmor_parser > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst apparmor; fi;\
fi;\
if [ "$(systemctl is-active docker)" != "active" ]; then \ if [ "$(systemctl is-active docker)" != "active" ]; then \
sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\ sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\
sleep 5; sudo systemctl start docker; sleep 5;\ sleep 5; sudo systemctl start docker; sleep 5;\

View file

@ -146,13 +146,6 @@ void ApiServicesModel::updateModel(const QJsonObject &data)
} else { } else {
for (const auto &service : services) { for (const auto &service : services) {
auto serviceObject = service.toObject(); auto serviceObject = service.toObject();
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
if (serviceObject.value(configKey::serviceType).toString() == serviceType::amneziaPremium) {
continue;
}
#endif
m_services.push_back(getApiServicesData(serviceObject)); m_services.push_back(getApiServicesData(serviceObject));
} }
} }
@ -255,7 +248,7 @@ ApiServicesModel::ApiServicesData ApiServicesModel::getApiServicesData(const QJs
serviceData.type = serviceType; serviceData.type = serviceType;
serviceData.protocol = serviceProtocol; serviceData.protocol = serviceProtocol;
serviceData.storeEndpoint = serviceInfo.value(configKey::storeEndpoint).toString(); serviceData.storeEndpoint = data.value(configKey::storeEndpoint).toString();
if (data.value(configKey::isAvailable).isBool()) { if (data.value(configKey::isAvailable).isBool()) {
serviceData.isServiceAvailable = data.value(configKey::isAvailable).toBool(); serviceData.isServiceAvailable = data.value(configKey::isAvailable).toBool();

View file

@ -135,7 +135,7 @@ DrawerType2 {
backgroundColor: AmneziaStyle.color.slateGray backgroundColor: AmneziaStyle.color.slateGray
textFieldPlaceholderText: qsTr("application name") textField.placeholderText: qsTr("application name")
} }
BasicButtonType { BasicButtonType {

View file

@ -22,11 +22,9 @@ Item {
property var clickedFunc property var clickedFunc
property alias textField: textField property alias textField: textField
property alias textFieldText: textField.text
property string textFieldTextColor: AmneziaStyle.color.paleGray property string textFieldTextColor: AmneziaStyle.color.paleGray
property string textFieldTextDisabledColor: AmneziaStyle.color.mutedGray property string textFieldTextDisabledColor: AmneziaStyle.color.mutedGray
property string textFieldPlaceholderText
property bool textFieldEditable: true property bool textFieldEditable: true
property string borderColor: AmneziaStyle.color.slateGray property string borderColor: AmneziaStyle.color.slateGray
@ -101,7 +99,6 @@ Item {
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhSensitiveData | Qt.ImhNoPredictiveText inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhSensitiveData | Qt.ImhNoPredictiveText
placeholderText: root.textFieldPlaceholderText
placeholderTextColor: AmneziaStyle.color.charcoalGray placeholderTextColor: AmneziaStyle.color.charcoalGray
selectionColor: AmneziaStyle.color.richBrown selectionColor: AmneziaStyle.color.richBrown
@ -129,8 +126,8 @@ Item {
} }
onActiveFocusChanged: { onActiveFocusChanged: {
if (checkEmptyText && textFieldText === "") { if (root.checkEmptyText && text === "") {
errorText = qsTr("The field can't be empty") root.errorText = qsTr("The field can't be empty")
} }
} }

View file

@ -66,18 +66,18 @@ PageType {
Layout.leftMargin: 16 Layout.leftMargin: 16
headerText: qsTr("Gateway endpoint") headerText: qsTr("Gateway endpoint")
textFieldText: SettingsController.gatewayEndpoint textField.text: SettingsController.gatewayEndpoint
buttonImageSource: textFieldText !== "" ? "qrc:/images/controls/refresh-cw.svg" : "" buttonImageSource: textField.text !== "" ? "qrc:/images/controls/refresh-cw.svg" : ""
clickedFunc: function() { clickedFunc: function() {
SettingsController.resetGatewayEndpoint() SettingsController.resetGatewayEndpoint()
} }
textField.onEditingFinished: { textField.onEditingFinished: {
textFieldText = textField.text.replace(/^\s+|\s+$/g, '') textField.text = textField.text.replace(/^\s+|\s+$/g, '')
if (textFieldText !== SettingsController.gatewayEndpoint) { if (textField.text !== SettingsController.gatewayEndpoint) {
SettingsController.gatewayEndpoint = textFieldText SettingsController.gatewayEndpoint = textField.text
} }
} }
} }

View file

@ -103,12 +103,12 @@ PageType {
Layout.topMargin: 40 Layout.topMargin: 40
headerText: qsTr("MTU") headerText: qsTr("MTU")
textFieldText: clientMtu textField.text: clientMtu
textField.validator: IntValidator { bottom: 576; top: 65535 } textField.validator: IntValidator { bottom: 576; top: 65535 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== clientMtu) { if (textField.text !== clientMtu) {
clientMtu = textFieldText clientMtu = textField.text
} }
} }
checkEmptyText: true checkEmptyText: true
@ -121,12 +121,12 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
headerText: "Jc - Junk packet count" headerText: "Jc - Junk packet count"
textFieldText: clientJunkPacketCount textField.text: clientJunkPacketCount
textField.validator: IntValidator { bottom: 0 } textField.validator: IntValidator { bottom: 0 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== clientJunkPacketCount) { if (textField.text !== clientJunkPacketCount) {
clientJunkPacketCount = textFieldText clientJunkPacketCount = textField.text
} }
} }
@ -141,12 +141,12 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
headerText: "Jmin - Junk packet minimum size" headerText: "Jmin - Junk packet minimum size"
textFieldText: clientJunkPacketMinSize textField.text: clientJunkPacketMinSize
textField.validator: IntValidator { bottom: 0 } textField.validator: IntValidator { bottom: 0 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== clientJunkPacketMinSize) { if (textField.text !== clientJunkPacketMinSize) {
clientJunkPacketMinSize = textFieldText clientJunkPacketMinSize = textField.text
} }
} }
@ -161,12 +161,12 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
headerText: "Jmax - Junk packet maximum size" headerText: "Jmax - Junk packet maximum size"
textFieldText: clientJunkPacketMaxSize textField.text: clientJunkPacketMaxSize
textField.validator: IntValidator { bottom: 0 } textField.validator: IntValidator { bottom: 0 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== clientJunkPacketMaxSize) { if (textField.text !== clientJunkPacketMaxSize) {
clientJunkPacketMaxSize = textFieldText clientJunkPacketMaxSize = textField.text
} }
} }
@ -189,7 +189,7 @@ PageType {
enabled: false enabled: false
headerText: qsTr("Port") headerText: qsTr("Port")
textFieldText: port textField.text: port
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -200,7 +200,7 @@ PageType {
enabled: false enabled: false
headerText: "S1 - Init packet junk size" headerText: "S1 - Init packet junk size"
textFieldText: serverInitPacketJunkSize textField.text: serverInitPacketJunkSize
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -211,7 +211,7 @@ PageType {
enabled: false enabled: false
headerText: "S2 - Response packet junk size" headerText: "S2 - Response packet junk size"
textFieldText: serverResponsePacketJunkSize textField.text: serverResponsePacketJunkSize
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -222,7 +222,7 @@ PageType {
enabled: false enabled: false
headerText: "H1 - Init packet magic header" headerText: "H1 - Init packet magic header"
textFieldText: serverInitPacketMagicHeader textField.text: serverInitPacketMagicHeader
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -233,7 +233,7 @@ PageType {
enabled: false enabled: false
headerText: "H2 - Response packet magic header" headerText: "H2 - Response packet magic header"
textFieldText: serverResponsePacketMagicHeader textField.text: serverResponsePacketMagicHeader
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -244,7 +244,7 @@ PageType {
enabled: false enabled: false
headerText: "H3 - Underload packet magic header" headerText: "H3 - Underload packet magic header"
textFieldText: serverUnderloadPacketMagicHeader textField.text: serverUnderloadPacketMagicHeader
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -255,7 +255,7 @@ PageType {
enabled: false enabled: false
headerText: "H4 - Transport packet magic header" headerText: "H4 - Transport packet magic header"
textFieldText: serverTransportPacketMagicHeader textField.text: serverTransportPacketMagicHeader
} }
} }
} }

View file

@ -106,11 +106,11 @@ PageType {
enabled: delegateItem.isEnabled enabled: delegateItem.isEnabled
headerText: qsTr("VPN address subnet") headerText: qsTr("VPN address subnet")
textFieldText: subnetAddress textField.text: subnetAddress
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== subnetAddress) { if (textField.text !== subnetAddress) {
subnetAddress = textFieldText subnetAddress = textField.text
} }
} }
@ -125,13 +125,13 @@ PageType {
enabled: delegateItem.isEnabled enabled: delegateItem.isEnabled
headerText: qsTr("Port") headerText: qsTr("Port")
textFieldText: port textField.text: port
textField.maximumLength: 5 textField.maximumLength: 5
textField.validator: IntValidator { bottom: 1; top: 65535 } textField.validator: IntValidator { bottom: 1; top: 65535 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== port) { if (textField.text !== port) {
port = textFieldText port = textField.text
} }
} }
@ -144,16 +144,16 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
headerText: qsTr("Jc - Junk packet count") headerText: qsTr("Jc - Junk packet count")
textFieldText: serverJunkPacketCount textField.text: serverJunkPacketCount
textField.validator: IntValidator { bottom: 0 } textField.validator: IntValidator { bottom: 0 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText === "") { if (textField.text === "") {
textFieldText = "0" textField.text = "0"
} }
if (textFieldText !== serverJunkPacketCount) { if (textField.text !== serverJunkPacketCount) {
serverJunkPacketCount = textFieldText serverJunkPacketCount = textField.text
} }
} }
@ -166,12 +166,12 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
headerText: qsTr("Jmin - Junk packet minimum size") headerText: qsTr("Jmin - Junk packet minimum size")
textFieldText: serverJunkPacketMinSize textField.text: serverJunkPacketMinSize
textField.validator: IntValidator { bottom: 0 } textField.validator: IntValidator { bottom: 0 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== serverJunkPacketMinSize) { if (textField.text !== serverJunkPacketMinSize) {
serverJunkPacketMinSize = textFieldText serverJunkPacketMinSize = textField.text
} }
} }
@ -184,12 +184,12 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
headerText: qsTr("Jmax - Junk packet maximum size") headerText: qsTr("Jmax - Junk packet maximum size")
textFieldText: serverJunkPacketMaxSize textField.text: serverJunkPacketMaxSize
textField.validator: IntValidator { bottom: 0 } textField.validator: IntValidator { bottom: 0 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== serverJunkPacketMaxSize) { if (textField.text !== serverJunkPacketMaxSize) {
serverJunkPacketMaxSize = textFieldText serverJunkPacketMaxSize = textField.text
} }
} }
@ -202,12 +202,12 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
headerText: qsTr("S1 - Init packet junk size") headerText: qsTr("S1 - Init packet junk size")
textFieldText: serverInitPacketJunkSize textField.text: serverInitPacketJunkSize
textField.validator: IntValidator { bottom: 0 } textField.validator: IntValidator { bottom: 0 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== serverInitPacketJunkSize) { if (textField.text !== serverInitPacketJunkSize) {
serverInitPacketJunkSize = textFieldText serverInitPacketJunkSize = textField.text
} }
} }
@ -226,12 +226,12 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
headerText: qsTr("S2 - Response packet junk size") headerText: qsTr("S2 - Response packet junk size")
textFieldText: serverResponsePacketJunkSize textField.text: serverResponsePacketJunkSize
textField.validator: IntValidator { bottom: 0 } textField.validator: IntValidator { bottom: 0 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== serverResponsePacketJunkSize) { if (textField.text !== serverResponsePacketJunkSize) {
serverResponsePacketJunkSize = textFieldText serverResponsePacketJunkSize = textField.text
} }
} }
@ -250,12 +250,12 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
headerText: qsTr("H1 - Init packet magic header") headerText: qsTr("H1 - Init packet magic header")
textFieldText: serverInitPacketMagicHeader textField.text: serverInitPacketMagicHeader
textField.validator: IntValidator { bottom: 0 } textField.validator: IntValidator { bottom: 0 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== serverInitPacketMagicHeader) { if (textField.text !== serverInitPacketMagicHeader) {
serverInitPacketMagicHeader = textFieldText serverInitPacketMagicHeader = textField.text
} }
} }
@ -268,12 +268,12 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
headerText: qsTr("H2 - Response packet magic header") headerText: qsTr("H2 - Response packet magic header")
textFieldText: serverResponsePacketMagicHeader textField.text: serverResponsePacketMagicHeader
textField.validator: IntValidator { bottom: 0 } textField.validator: IntValidator { bottom: 0 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== serverResponsePacketMagicHeader) { if (textField.text !== serverResponsePacketMagicHeader) {
serverResponsePacketMagicHeader = textFieldText serverResponsePacketMagicHeader = textField.text
} }
} }
@ -286,12 +286,12 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
headerText: qsTr("H4 - Transport packet magic header") headerText: qsTr("H4 - Transport packet magic header")
textFieldText: serverTransportPacketMagicHeader textField.text: serverTransportPacketMagicHeader
textField.validator: IntValidator { bottom: 0 } textField.validator: IntValidator { bottom: 0 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== serverTransportPacketMagicHeader) { if (textField.text !== serverTransportPacketMagicHeader) {
serverTransportPacketMagicHeader = textFieldText serverTransportPacketMagicHeader = textField.text
} }
} }
@ -304,12 +304,12 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
headerText: qsTr("H3 - Underload packet magic header") headerText: qsTr("H3 - Underload packet magic header")
textFieldText: serverUnderloadPacketMagicHeader textField.text: serverUnderloadPacketMagicHeader
textField.validator: IntValidator { bottom: 0 } textField.validator: IntValidator { bottom: 0 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== serverUnderloadPacketMagicHeader) { if (textField.text !== serverUnderloadPacketMagicHeader) {
serverUnderloadPacketMagicHeader = textFieldText serverUnderloadPacketMagicHeader = textField.text
} }
} }

View file

@ -89,18 +89,18 @@ PageType {
Layout.topMargin: 32 Layout.topMargin: 32
headerText: qsTr("Disguised as traffic from") headerText: qsTr("Disguised as traffic from")
textFieldText: site textField.text: site
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== site) { if (textField.text !== site) {
var tmpText = textFieldText var tmpText = textField.text
tmpText = tmpText.toLocaleLowerCase() tmpText = tmpText.toLocaleLowerCase()
var indexHttps = tmpText.indexOf("https://") var indexHttps = tmpText.indexOf("https://")
if (indexHttps === 0) { if (indexHttps === 0) {
tmpText = textFieldText.substring(8) tmpText = textField.text.substring(8)
} else { } else {
site = textFieldText site = textField.text
} }
} }
} }
@ -113,13 +113,13 @@ PageType {
Layout.topMargin: 16 Layout.topMargin: 16
headerText: qsTr("Port") headerText: qsTr("Port")
textFieldText: port textField.text: port
textField.maximumLength: 5 textField.maximumLength: 5
textField.validator: IntValidator { bottom: 1; top: 65535 } textField.validator: IntValidator { bottom: 1; top: 65535 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== port) { if (textField.text !== port) {
port = textFieldText port = textField.text
} }
} }
} }

View file

@ -88,13 +88,13 @@ PageType {
Layout.topMargin: 32 Layout.topMargin: 32
headerText: qsTr("VPN address subnet") headerText: qsTr("VPN address subnet")
textFieldText: subnetAddress textField.text: subnetAddress
parentFlickable: fl parentFlickable: fl
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== subnetAddress) { if (textField.text !== subnetAddress) {
subnetAddress = textFieldText subnetAddress = textField.text
} }
} }
} }
@ -137,13 +137,13 @@ PageType {
enabled: isPortEditable enabled: isPortEditable
headerText: qsTr("Port") headerText: qsTr("Port")
textFieldText: port textField.text: port
textField.maximumLength: 5 textField.maximumLength: 5
textField.validator: IntValidator { bottom: 1; top: 65535 } textField.validator: IntValidator { bottom: 1; top: 65535 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== port) { if (textField.text !== port) {
port = textFieldText port = textField.text
} }
} }
} }

View file

@ -93,13 +93,13 @@ PageType {
enabled: isPortEditable enabled: isPortEditable
headerText: qsTr("Port") headerText: qsTr("Port")
textFieldText: port textField.text: port
textField.maximumLength: 5 textField.maximumLength: 5
textField.validator: IntValidator { bottom: 1; top: 65535 } textField.validator: IntValidator { bottom: 1; top: 65535 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== port) { if (textField.text !== port) {
port = textFieldText port = textField.text
} }
} }
} }

View file

@ -97,12 +97,12 @@ PageType {
Layout.topMargin: 40 Layout.topMargin: 40
headerText: qsTr("MTU") headerText: qsTr("MTU")
textFieldText: clientMtu textField.text: clientMtu
textField.validator: IntValidator { bottom: 576; top: 65535 } textField.validator: IntValidator { bottom: 576; top: 65535 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== clientMtu) { if (textField.text !== clientMtu) {
clientMtu = textFieldText clientMtu = textField.text
} }
} }
checkEmptyText: true checkEmptyText: true
@ -124,7 +124,7 @@ PageType {
enabled: false enabled: false
headerText: qsTr("Port") headerText: qsTr("Port")
textFieldText: port textField.text: port
} }
} }
} }

View file

@ -90,11 +90,11 @@ PageType {
enabled: delegateItem.isEnabled enabled: delegateItem.isEnabled
headerText: qsTr("VPN address subnet") headerText: qsTr("VPN address subnet")
textFieldText: subnetAddress textField.text: subnetAddress
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== subnetAddress) { if (textField.text !== subnetAddress) {
subnetAddress = textFieldText subnetAddress = textField.text
} }
} }
@ -109,13 +109,13 @@ PageType {
enabled: delegateItem.isEnabled enabled: delegateItem.isEnabled
headerText: qsTr("Port") headerText: qsTr("Port")
textFieldText: port textField.text: port
textField.maximumLength: 5 textField.maximumLength: 5
textField.validator: IntValidator { bottom: 1; top: 65535 } textField.validator: IntValidator { bottom: 1; top: 65535 }
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== port) { if (textField.text !== port) {
port = textFieldText port = textField.text
} }
} }

View file

@ -86,18 +86,18 @@ PageType {
Layout.topMargin: 32 Layout.topMargin: 32
headerText: qsTr("Disguised as traffic from") headerText: qsTr("Disguised as traffic from")
textFieldText: site textField.text: site
textField.onEditingFinished: { textField.onEditingFinished: {
if (textFieldText !== site) { if (textField.text !== site) {
var tmpText = textFieldText var tmpText = textField.text
tmpText = tmpText.toLocaleLowerCase() tmpText = tmpText.toLocaleLowerCase()
var indexHttps = tmpText.indexOf("https://") var indexHttps = tmpText.indexOf("https://")
if (indexHttps === 0) { if (indexHttps === 0) {
tmpText = textFieldText.substring(8) tmpText = textField.text.substring(8)
} else { } else {
site = textFieldText site = textField.text
} }
} }
} }

View file

@ -211,9 +211,9 @@ PageType {
port = tempPort port = tempPort
username = tempUsername username = tempUsername
password = tempPassword password = tempPassword
portTextField.textFieldText = port portTextField.textField.text = port
usernameTextField.textFieldText = username usernameTextField.textField.text = username
passwordTextField.textFieldText = password passwordTextField.textField.text = password
} }
} }
@ -231,14 +231,14 @@ PageType {
parentFlickable: fl parentFlickable: fl
headerText: qsTr("Port") headerText: qsTr("Port")
textFieldText: port textField.text: port
textField.maximumLength: 5 textField.maximumLength: 5
textField.validator: IntValidator { bottom: 1; top: 65535 } textField.validator: IntValidator { bottom: 1; top: 65535 }
textField.onEditingFinished: { textField.onEditingFinished: {
textFieldText = textField.text.replace(/^\s+|\s+$/g, '') textField.text = textField.text.replace(/^\s+|\s+$/g, '')
if (textFieldText !== port) { if (textField.text !== port) {
port = textFieldText port = textField.text
} }
} }
} }
@ -251,14 +251,14 @@ PageType {
parentFlickable: fl parentFlickable: fl
headerText: qsTr("Username") headerText: qsTr("Username")
textFieldPlaceholderText: "username" textField.placeholderText: "username"
textFieldText: username textField.text: username
textField.maximumLength: 32 textField.maximumLength: 32
textField.onEditingFinished: { textField.onEditingFinished: {
textFieldText = textField.text.replace(/^\s+|\s+$/g, '') textField.text = textField.text.replace(/^\s+|\s+$/g, '')
if (textFieldText !== username) { if (textField.text !== username) {
username = textFieldText username = textField.text
} }
} }
} }
@ -273,12 +273,12 @@ PageType {
parentFlickable: fl parentFlickable: fl
headerText: qsTr("Password") headerText: qsTr("Password")
textFieldPlaceholderText: "password" textField.placeholderText: "password"
textFieldText: password textField.text: password
textField.maximumLength: 32 textField.maximumLength: 32
textField.echoMode: hidePassword ? TextInput.Password : TextInput.Normal textField.echoMode: hidePassword ? TextInput.Password : TextInput.Normal
buttonImageSource: textFieldText !== "" ? (hidePassword ? "qrc:/images/controls/eye.svg" : "qrc:/images/controls/eye-off.svg") buttonImageSource: textField.text !== "" ? (hidePassword ? "qrc:/images/controls/eye.svg" : "qrc:/images/controls/eye-off.svg")
: "" : ""
clickedFunc: function() { clickedFunc: function() {
@ -286,9 +286,9 @@ PageType {
} }
textField.onFocusChanged: { textField.onFocusChanged: {
textFieldText = textField.text.replace(/^\s+|\s+$/g, '') textField.text = textField.text.replace(/^\s+|\s+$/g, '')
if (textFieldText !== password) { if (textField.text !== password) {
password = textFieldText password = textField.text
} }
} }
} }
@ -309,19 +309,19 @@ PageType {
portTextField.errorText = qsTr("The port must be in the range of 1 to 65535") portTextField.errorText = qsTr("The port must be in the range of 1 to 65535")
return return
} }
if (usernameTextField.textFieldText && passwordTextField.textFieldText === "") { if (usernameTextField.textField.text && passwordTextField.textField.text === "") {
passwordTextField.errorText = qsTr("Password cannot be empty") passwordTextField.errorText = qsTr("Password cannot be empty")
return return
} else if (usernameTextField.textFieldText === "" && passwordTextField.textFieldText) { } else if (usernameTextField.textField.text === "" && passwordTextField.textField.text) {
usernameTextField.errorText = qsTr("Username cannot be empty") usernameTextField.errorText = qsTr("Username cannot be empty")
return return
} }
PageController.goToPage(PageEnum.PageSetupWizardInstalling) PageController.goToPage(PageEnum.PageSetupWizardInstalling)
InstallController.updateContainer(Socks5ProxyConfigModel.getConfig()) InstallController.updateContainer(Socks5ProxyConfigModel.getConfig())
tempPort = portTextField.textFieldText tempPort = portTextField.textField.text
tempUsername = usernameTextField.textFieldText tempUsername = usernameTextField.textField.text
tempPassword = passwordTextField.textFieldText tempPassword = passwordTextField.textField.text
changeSettingsDrawer.closeTriggered() changeSettingsDrawer.closeTriggered()
} }
} }

View file

@ -87,7 +87,6 @@ PageType {
LabelWithButtonType { LabelWithButtonType {
id: backup id: backup
visible: !SettingsController.isOnTv()
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Backup") text: qsTr("Backup")
@ -99,9 +98,7 @@ PageType {
} }
} }
DividerType { DividerType {}
visible: !SettingsController.isOnTv()
}
LabelWithButtonType { LabelWithButtonType {
id: about id: about

View file

@ -15,62 +15,101 @@ import "../Components"
PageType { PageType {
id: root id: root
FlickableType { property list<QtObject> labelsModel: [
id: fl regionObject,
anchors.top: parent.top priceObject,
anchors.bottom: parent.bottom endDateObject,
contentHeight: content.height speedObject
]
ColumnLayout { QtObject {
id: content id: regionObject
anchors.top: parent.top readonly property string title: qsTr("For the region")
anchors.left: parent.left readonly property string contentKey: "region"
anchors.right: parent.right readonly property string objectImageSource: "qrc:/images/controls/map-pin.svg"
}
QtObject {
id: priceObject
readonly property string title: qsTr("Price")
readonly property string contentKey: "price"
readonly property string objectImageSource: "qrc:/images/controls/tag.svg"
}
QtObject {
id: endDateObject
readonly property string title: qsTr("Valid until")
readonly property string contentKey: "endDate"
readonly property string objectImageSource: "qrc:/images/controls/history.svg"
}
QtObject {
id: speedObject
readonly property string title: qsTr("Speed")
readonly property string contentKey: "speed"
readonly property string objectImageSource: "qrc:/images/controls/gauge.svg"
}
ListView {
id: listView
anchors.fill: parent
property bool isFocusable: true
Keys.onTabPressed: {
FocusController.nextKeyTabItem()
}
Keys.onBacktabPressed: {
FocusController.previousKeyTabItem()
}
Keys.onUpPressed: {
FocusController.nextKeyUpItem()
}
Keys.onDownPressed: {
FocusController.nextKeyDownItem()
}
Keys.onLeftPressed: {
FocusController.nextKeyLeftItem()
}
Keys.onRightPressed: {
FocusController.nextKeyRightItem()
}
ScrollBar.vertical: ScrollBarType {}
model: labelsModel
clip: true
reuseItems: true
delegate: ColumnLayout {
width: listView.width
spacing: 0 spacing: 0
LabelWithImageType { LabelWithImageType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.margins: 16 Layout.margins: 16
imageSource: "qrc:/images/controls/map-pin.svg" imageSource: objectImageSource
leftText: qsTr("For the region") leftText: title
rightText: ApiServicesModel.getSelectedServiceData("region") rightText: ApiServicesModel.getSelectedServiceData(contentKey)
}
LabelWithImageType {
Layout.fillWidth: true
Layout.margins: 16
imageSource: "qrc:/images/controls/tag.svg"
leftText: qsTr("Price")
rightText: ApiServicesModel.getSelectedServiceData("price")
}
LabelWithImageType {
property bool showSubscriptionEndDate: ServersModel.getProcessedServerData("isCountrySelectionAvailable")
Layout.fillWidth: true
Layout.margins: 16
imageSource: "qrc:/images/controls/history.svg"
leftText: showSubscriptionEndDate ? qsTr("Valid until") : qsTr("Work period")
rightText: showSubscriptionEndDate ? ApiServicesModel.getSelectedServiceData("endDate")
: ApiServicesModel.getSelectedServiceData("workPeriod")
visible: rightText !== "" visible: rightText !== ""
} }
LabelWithImageType {
Layout.fillWidth: true
Layout.margins: 16
imageSource: "qrc:/images/controls/gauge.svg"
leftText: qsTr("Speed")
rightText: ApiServicesModel.getSelectedServiceData("speed")
} }
footer: ColumnLayout {
width: listView.width
spacing: 0
ParagraphTextType { ParagraphTextType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.rightMargin: 16 Layout.rightMargin: 16
@ -88,6 +127,8 @@ PageType {
return text.replace("%1", LanguageModel.getCurrentSiteUrl()) return text.replace("%1", LanguageModel.getCurrentSiteUrl())
} }
visible: text !== ""
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.NoButton acceptedButtons: Qt.NoButton

View file

@ -252,7 +252,7 @@ PageType {
Layout.fillWidth: true Layout.fillWidth: true
textFieldPlaceholderText: qsTr("application name") textField.placeholderText: qsTr("application name")
buttonImageSource: "qrc:/images/controls/plus.svg" buttonImageSource: "qrc:/images/controls/plus.svg"
rightButtonClickedOnEnter: true rightButtonClickedOnEnter: true

View file

@ -67,7 +67,7 @@ PageType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("Primary DNS") headerText: qsTr("Primary DNS")
textFieldText: SettingsController.primaryDns textField.text: SettingsController.primaryDns
textField.validator: RegularExpressionValidator { textField.validator: RegularExpressionValidator {
regularExpression: InstallController.ipAddressRegExp() regularExpression: InstallController.ipAddressRegExp()
} }
@ -79,7 +79,7 @@ PageType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("Secondary DNS") headerText: qsTr("Secondary DNS")
textFieldText: SettingsController.secondaryDns textField.text: SettingsController.secondaryDns
textField.validator: RegularExpressionValidator { textField.validator: RegularExpressionValidator {
regularExpression: InstallController.ipAddressRegExp() regularExpression: InstallController.ipAddressRegExp()
} }
@ -105,9 +105,9 @@ PageType {
var yesButtonFunction = function() { var yesButtonFunction = function() {
SettingsController.primaryDns = "1.1.1.1" SettingsController.primaryDns = "1.1.1.1"
primaryDns.textFieldText = SettingsController.primaryDns primaryDns.textField.text = SettingsController.primaryDns
SettingsController.secondaryDns = "1.0.0.1" SettingsController.secondaryDns = "1.0.0.1"
secondaryDns.textFieldText = SettingsController.secondaryDns secondaryDns.textField.text = SettingsController.secondaryDns
PageController.showNotificationMessage(qsTr("Settings have been reset")) PageController.showNotificationMessage(qsTr("Settings have been reset"))
} }
var noButtonFunction = function() { var noButtonFunction = function() {
@ -125,11 +125,11 @@ PageType {
text: qsTr("Save") text: qsTr("Save")
clickedFunc: function() { clickedFunc: function() {
if (primaryDns.textFieldText !== SettingsController.primaryDns) { if (primaryDns.textField.text !== SettingsController.primaryDns) {
SettingsController.primaryDns = primaryDns.textFieldText SettingsController.primaryDns = primaryDns.textField.text
} }
if (secondaryDns.textFieldText !== SettingsController.secondaryDns) { if (secondaryDns.textField.text !== SettingsController.secondaryDns) {
SettingsController.secondaryDns = secondaryDns.textFieldText SettingsController.secondaryDns = secondaryDns.textField.text
} }
PageController.showNotificationMessage(qsTr("Settings saved")) PageController.showNotificationMessage(qsTr("Settings saved"))
} }

View file

@ -137,6 +137,8 @@ PageType {
Layout.topMargin: -8 Layout.topMargin: -8
Layout.bottomMargin: -8 Layout.bottomMargin: -8
visible: !GC.isMobile()
text: qsTr("Open logs folder") text: qsTr("Open logs folder")
leftImageSource: "qrc:/images/controls/folder-open.svg" leftImageSource: "qrc:/images/controls/folder-open.svg"
isSmallLeftImage: true isSmallLeftImage: true

View file

@ -142,7 +142,7 @@ PageType {
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("Server name") headerText: qsTr("Server name")
textFieldText: root.processedServer.name textField.text: root.processedServer.name
textField.maximumLength: 30 textField.maximumLength: 30
checkEmptyText: true checkEmptyText: true
} }
@ -155,12 +155,12 @@ PageType {
text: qsTr("Save") text: qsTr("Save")
clickedFunc: function() { clickedFunc: function() {
if (serverName.textFieldText === "") { if (serverName.textField.text === "") {
return return
} }
if (serverName.textFieldText !== root.processedServer.name) { if (serverName.textField.text !== root.processedServer.name) {
ServersModel.setProcessedServerData("name", serverName.textFieldText); ServersModel.setProcessedServerData("name", serverName.textField.text);
} }
serverNameEditDrawer.closeTriggered() serverNameEditDrawer.closeTriggered()
} }

View file

@ -274,13 +274,13 @@ PageType {
Layout.fillWidth: true Layout.fillWidth: true
rightButtonClickedOnEnter: true rightButtonClickedOnEnter: true
textFieldPlaceholderText: qsTr("website or IP") textField.placeholderText: qsTr("website or IP")
buttonImageSource: "qrc:/images/controls/plus.svg" buttonImageSource: "qrc:/images/controls/plus.svg"
clickedFunc: function() { clickedFunc: function() {
PageController.showBusyIndicator(true) PageController.showBusyIndicator(true)
SitesController.addSite(textFieldText) SitesController.addSite(textField.text)
textFieldText = "" textField.text = ""
PageController.showBusyIndicator(false) PageController.showBusyIndicator(false)
} }
} }
@ -338,7 +338,6 @@ PageType {
LabelWithButtonType { LabelWithButtonType {
id: exportSitesButton id: exportSitesButton
enabled: !SettingsController.isOnTv()
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Save site list") text: qsTr("Save site list")
@ -362,9 +361,7 @@ PageType {
} }
} }
DividerType { DividerType {}
enabled: !SettingsController.isOnTv()
}
} }
} }

View file

@ -163,12 +163,12 @@ PageType {
Layout.rightMargin: 16 Layout.rightMargin: 16
Layout.leftMargin: 16 Layout.leftMargin: 16
visible: textKey.textFieldText !== "" visible: textKey.textField.text !== ""
text: qsTr("Continue") text: qsTr("Continue")
clickedFunc: function() { clickedFunc: function() {
if (ImportController.extractConfigFromData(textKey.textFieldText)) { if (ImportController.extractConfigFromData(textKey.textField.text)) {
PageController.goToPage(PageEnum.PageSetupWizardViewConfig) PageController.goToPage(PageEnum.PageSetupWizardViewConfig)
} }
} }
@ -217,6 +217,8 @@ PageType {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
implicitHeight: 32 implicitHeight: 32
visible: Qt.platform.os !== "ios"
defaultColor: AmneziaStyle.color.transparent defaultColor: AmneziaStyle.color.transparent
hoveredColor: AmneziaStyle.color.translucentWhite hoveredColor: AmneziaStyle.color.translucentWhite
pressedColor: AmneziaStyle.color.sheerWhite pressedColor: AmneziaStyle.color.sheerWhite
@ -330,7 +332,7 @@ PageType {
property string title: qsTr("I have nothing") property string title: qsTr("I have nothing")
property string description: qsTr("") property string description: qsTr("")
property string imageSource: "qrc:/images/controls/help-circle.svg" property string imageSource: "qrc:/images/controls/help-circle.svg"
property bool isVisible: PageController.isStartPageVisible() property bool isVisible: PageController.isStartPageVisible() && Qt.platform.os !== "ios"
property var handler: function() { property var handler: function() {
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl()) Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl())
} }

View file

@ -82,24 +82,19 @@ PageType {
reuseItems: true reuseItems: true
delegate: ColumnLayout { delegate: ColumnLayout {
property alias textField: _textField.textField
width: listView.width width: listView.width
TextFieldWithHeaderType { TextFieldWithHeaderType {
id: _textField id: delegate
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 16 Layout.leftMargin: 16
Layout.rightMargin: 16 Layout.rightMargin: 16
property bool hidePassword: hideText
headerText: title headerText: title
textField.echoMode: hideText ? TextInput.Password : TextInput.Normal textField.echoMode: hideContent ? TextInput.Password : TextInput.Normal
buttonImageSource: imageSource textField.placeholderText: placeholderContent
textFieldPlaceholderText: placeholderText textField.text: textField.text
textField.text: textFieldText
rightButtonClickedOnEnter: true rightButtonClickedOnEnter: true
@ -108,17 +103,12 @@ PageType {
} }
textField.onFocusChanged: { textField.onFocusChanged: {
var _currentIndex = listView.currentIndex textField.text = textField.text.replace(/^\s+|\s+$/g, '')
var _currentItem = listView.itemAtIndex(_currentIndex).children[0]
listView.model[_currentIndex].textFieldText = _currentItem.textFieldText.replace(/^\s+|\s+$/g, '')
} }
textField.onTextChanged: { textField.onTextChanged: {
var _currentIndex = listView.currentIndex if (hideContent) {
textFieldText = textField.text buttonImageSource = textField.text !== "" ? (hideContent ? "qrc:/images/controls/eye.svg" : "qrc:/images/controls/eye-off.svg") : ""
if (_currentIndex === vars.secretDataIndex) {
buttonImageSource = textFieldText !== "" ? (hideText ? "qrc:/images/controls/eye.svg" : "qrc:/images/controls/eye-off.svg") : ""
} }
} }
} }
@ -143,9 +133,9 @@ PageType {
} }
InstallController.setShouldCreateServer(true) InstallController.setShouldCreateServer(true)
var _hostname = listView.itemAtIndex(vars.hostnameIndex).children[0].textFieldText var _hostname = listView.itemAtIndex(vars.hostnameIndex).children[0].textField.text
var _username = listView.itemAtIndex(vars.usernameIndex).children[0].textFieldText var _username = listView.itemAtIndex(vars.usernameIndex).children[0].textField.text
var _secretData = listView.itemAtIndex(vars.secretDataIndex).children[0].textFieldText var _secretData = listView.itemAtIndex(vars.secretDataIndex).children[0].textField.text
InstallController.setProcessedServerCredentials(_hostname, _username, _secretData) InstallController.setProcessedServerCredentials(_hostname, _username, _secretData)
@ -194,23 +184,23 @@ PageType {
function isCredentialsFilled() { function isCredentialsFilled() {
var hasEmptyField = false var hasEmptyField = false
var _hostname = listView.itemAtIndex(vars.hostnameIndex).children[0] var hostnameItem = listView.itemAtIndex(vars.hostnameIndex).children[0]
if (_hostname.textFieldText === "") { if (hostnameItem.textField.text === "") {
_hostname.errorText = qsTr("Ip address cannot be empty") hostnameItem.errorText = qsTr("Ip address cannot be empty")
hasEmptyField = true hasEmptyField = true
} else if (!_hostname.textField.acceptableInput) { } else if (!hostnameItem.textField.acceptableInput) {
_hostname.errorText = qsTr("Enter the address in the format 255.255.255.255:88") hostnameItem.errorText = qsTr("Enter the address in the format 255.255.255.255:88")
} }
var _username = listView.itemAtIndex(vars.usernameIndex).children[0] var usernameItem = listView.itemAtIndex(vars.usernameIndex).children[0]
if (_username.textFieldText === "") { if (usernameItem.textField.text === "") {
_username.errorText = qsTr("Login cannot be empty") usernameItem.errorText = qsTr("Login cannot be empty")
hasEmptyField = true hasEmptyField = true
} }
var _secretData = listView.itemAtIndex(vars.secretDataIndex).children[0] var secretDataItem = listView.itemAtIndex(vars.secretDataIndex).children[0]
if (_secretData.textFieldText === "") { if (secretDataItem.textField.text === "") {
_secretData.errorText = qsTr("Password/private key cannot be empty") secretDataItem.errorText = qsTr("Password/private key cannot be empty")
hasEmptyField = true hasEmptyField = true
} }
@ -218,46 +208,37 @@ PageType {
} }
property list<QtObject> inputFields: [ property list<QtObject> inputFields: [
hostname, hostnameObject,
username, usernameObject,
secretData secretDataObject
] ]
QtObject { QtObject {
id: hostname id: hostnameObject
property string title: qsTr("Server IP address [:port]") property string title: qsTr("Server IP address [:port]")
readonly property string placeholderText: qsTr("255.255.255.255:22") readonly property string placeholderContent: qsTr("255.255.255.255:22")
property string textFieldText: "" property bool hideContent: false
property bool hideText: false
property string imageSource: ""
readonly property var clickedHandler: function() {
console.debug(">>> Server IP address text field was clicked!!!")
clicked()
}
}
QtObject {
id: username
property string title: qsTr("SSH Username")
readonly property string placeholderText: "root"
property string textFieldText: ""
property bool hideText: false
property string imageSource: ""
readonly property var clickedHandler: undefined readonly property var clickedHandler: undefined
} }
QtObject { QtObject {
id: secretData id: usernameObject
property string title: qsTr("SSH Username")
readonly property string placeholderContent: "root"
property bool hideContent: false
readonly property var clickedHandler: undefined
}
QtObject {
id: secretDataObject
property string title: qsTr("Password or SSH private key") property string title: qsTr("Password or SSH private key")
readonly property string placeholderText: "" readonly property string placeholderContent: ""
property string textFieldText: "" property bool hideContent: true
property bool hideText: true
property string imageSource: textFieldText !== "" ? (hideText ? "qrc:/images/controls/eye.svg" : "qrc:/images/controls/eye-off.svg") : ""
readonly property var clickedHandler: function() { readonly property var clickedHandler: function() {
hideText = !hideText hideContent = !hideContent
} }
} }

View file

@ -257,7 +257,7 @@ PageType {
} }
PageController.goToPage(PageEnum.PageSetupWizardInstalling); PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.install(dockerContainer, port.textFieldText, transportProtoSelector.currentIndex) InstallController.install(dockerContainer, port.textField.text, transportProtoSelector.currentIndex)
} }
} }
@ -267,7 +267,7 @@ PageType {
if (ProtocolProps.defaultPort(defaultContainerProto) < 0) { if (ProtocolProps.defaultPort(defaultContainerProto) < 0) {
port.visible = false port.visible = false
} else { } else {
port.textFieldText = ProtocolProps.getPortForInstall(defaultContainerProto) port.textField.text = ProtocolProps.getPortForInstall(defaultContainerProto)
} }
transportProtoSelector.currentIndex = ProtocolProps.defaultTransportProto(defaultContainerProto) transportProtoSelector.currentIndex = ProtocolProps.defaultTransportProto(defaultContainerProto)

View file

@ -51,7 +51,7 @@ PageType {
Layout.leftMargin: 16 Layout.leftMargin: 16
headerText: qsTr("Key") headerText: qsTr("Key")
textFieldPlaceholderText: "vpn://" textField.placeholderText: "vpn://"
buttonText: qsTr("Insert") buttonText: qsTr("Insert")
clickedFunc: function() { clickedFunc: function() {
@ -75,7 +75,7 @@ PageType {
text: qsTr("Continue") text: qsTr("Continue")
clickedFunc: function() { clickedFunc: function() {
if (ImportController.extractConfigFromData(textKey.textFieldText)) { if (ImportController.extractConfigFromData(textKey.textField.text)) {
PageController.goToPage(PageEnum.PageSetupWizardViewConfig) PageController.goToPage(PageEnum.PageSetupWizardViewConfig)
} }
} }

View file

@ -51,25 +51,25 @@ PageType {
switch (type) { switch (type) {
case PageShare.ConfigType.AmneziaConnection: { case PageShare.ConfigType.AmneziaConnection: {
ExportController.generateConnectionConfig(clientNameTextField.textFieldText); ExportController.generateConnectionConfig(clientNameTextField.textField.text);
break; break;
} }
case PageShare.ConfigType.OpenVpn: { case PageShare.ConfigType.OpenVpn: {
ExportController.generateOpenVpnConfig(clientNameTextField.textFieldText) ExportController.generateOpenVpnConfig(clientNameTextField.textField.text)
shareConnectionDrawer.configCaption = qsTr("Save OpenVPN config") shareConnectionDrawer.configCaption = qsTr("Save OpenVPN config")
shareConnectionDrawer.configExtension = ".ovpn" shareConnectionDrawer.configExtension = ".ovpn"
shareConnectionDrawer.configFileName = "amnezia_for_openvpn" shareConnectionDrawer.configFileName = "amnezia_for_openvpn"
break break
} }
case PageShare.ConfigType.WireGuard: { case PageShare.ConfigType.WireGuard: {
ExportController.generateWireGuardConfig(clientNameTextField.textFieldText) ExportController.generateWireGuardConfig(clientNameTextField.textField.text)
shareConnectionDrawer.configCaption = qsTr("Save WireGuard config") shareConnectionDrawer.configCaption = qsTr("Save WireGuard config")
shareConnectionDrawer.configExtension = ".conf" shareConnectionDrawer.configExtension = ".conf"
shareConnectionDrawer.configFileName = "amnezia_for_wireguard" shareConnectionDrawer.configFileName = "amnezia_for_wireguard"
break break
} }
case PageShare.ConfigType.Awg: { case PageShare.ConfigType.Awg: {
ExportController.generateAwgConfig(clientNameTextField.textFieldText) ExportController.generateAwgConfig(clientNameTextField.textField.text)
shareConnectionDrawer.configCaption = qsTr("Save AmneziaWG config") shareConnectionDrawer.configCaption = qsTr("Save AmneziaWG config")
shareConnectionDrawer.configExtension = ".conf" shareConnectionDrawer.configExtension = ".conf"
shareConnectionDrawer.configFileName = "amnezia_for_awg" shareConnectionDrawer.configFileName = "amnezia_for_awg"
@ -90,7 +90,7 @@ PageType {
break break
} }
case PageShare.ConfigType.Xray: { case PageShare.ConfigType.Xray: {
ExportController.generateXrayConfig(clientNameTextField.textFieldText) ExportController.generateXrayConfig(clientNameTextField.textField.text)
shareConnectionDrawer.configCaption = qsTr("Save XRay config") shareConnectionDrawer.configCaption = qsTr("Save XRay config")
shareConnectionDrawer.configExtension = ".json" shareConnectionDrawer.configExtension = ".json"
shareConnectionDrawer.configFileName = "amnezia_for_xray" shareConnectionDrawer.configFileName = "amnezia_for_xray"
@ -296,7 +296,7 @@ PageType {
visible: accessTypeSelector.currentIndex === 0 visible: accessTypeSelector.currentIndex === 0
headerText: qsTr("User name") headerText: qsTr("User name")
textFieldText: "New client" textField.text: "New client"
textField.maximumLength: 20 textField.maximumLength: 20
checkEmptyText: true checkEmptyText: true
@ -525,7 +525,7 @@ PageType {
parentFlickable: a parentFlickable: a
clickedFunc: function(){ clickedFunc: function(){
if (clientNameTextField.textFieldText !== "") { if (clientNameTextField.textField.text !== "") {
ExportController.generateConfig(root.connectionTypesModel[exportTypeSelector.currentIndex].type) ExportController.generateConfig(root.connectionTypesModel[exportTypeSelector.currentIndex].type)
} }
} }
@ -555,14 +555,14 @@ PageType {
id: searchTextField id: searchTextField
Layout.fillWidth: true Layout.fillWidth: true
textFieldPlaceholderText: qsTr("Search") textField.placeholderText: qsTr("Search")
Keys.onEscapePressed: { Keys.onEscapePressed: {
root.isSearchBarVisible = false root.isSearchBarVisible = false
} }
function navigateTo() { function navigateTo() {
if (searchTextField.textFieldText === "") { if (searchTextField.textField.text === "") {
root.isSearchBarVisible = false root.isSearchBarVisible = false
} }
} }
@ -601,7 +601,7 @@ PageType {
sourceModel: ClientManagementModel sourceModel: ClientManagementModel
filters: RegExpFilter { filters: RegExpFilter {
roleName: "clientName" roleName: "clientName"
pattern: ".*" + searchTextField.textFieldText + ".*" pattern: ".*" + searchTextField.textField.text + ".*"
caseSensitivity: Qt.CaseInsensitive caseSensitivity: Qt.CaseInsensitive
} }
} }
@ -765,7 +765,7 @@ PageType {
id: clientNameEditor id: clientNameEditor
Layout.fillWidth: true Layout.fillWidth: true
headerText: qsTr("Client name") headerText: qsTr("Client name")
textFieldText: clientName textField.text: clientName
textField.maximumLength: 20 textField.maximumLength: 20
checkEmptyText: true checkEmptyText: true
} }
@ -778,14 +778,14 @@ PageType {
text: qsTr("Save") text: qsTr("Save")
clickedFunc: function() { clickedFunc: function() {
if (clientNameEditor.textFieldText === "") { if (clientNameEditor.textField.text === "") {
return return
} }
if (clientNameEditor.textFieldText !== clientName) { if (clientNameEditor.textField.text !== clientName) {
PageController.showBusyIndicator(true) PageController.showBusyIndicator(true)
ExportController.renameClient(index, ExportController.renameClient(index,
clientNameEditor.textFieldText, clientNameEditor.textField.text,
ContainersModel.getProcessedContainerIndex(), ContainersModel.getProcessedContainerIndex(),
ServersModel.getProcessedServerCredentials()) ServersModel.getProcessedServerCredentials())
PageController.showBusyIndicator(false) PageController.showBusyIndicator(false)

View file

@ -176,12 +176,12 @@ Window {
Connections { Connections {
target: privateKeyPassphraseDrawer target: privateKeyPassphraseDrawer
function onOpened() { function onOpened() {
passphrase.textFieldText = "" passphrase.textField.text = ""
passphrase.textField.forceActiveFocus() passphrase.textField.forceActiveFocus()
} }
function onAboutToHide() { function onAboutToHide() {
if (passphrase.textFieldText !== "") { if (passphrase.textField.text !== "") {
PageController.showBusyIndicator(true) PageController.showBusyIndicator(true)
} }
} }
@ -222,7 +222,7 @@ Window {
clickedFunc: function() { clickedFunc: function() {
privateKeyPassphraseDrawer.closeTriggered() privateKeyPassphraseDrawer.closeTriggered()
PageController.passphraseRequestDrawerClosed(passphrase.textFieldText) PageController.passphraseRequestDrawerClosed(passphrase.textField.text)
} }
} }
} }

View file

@ -215,10 +215,9 @@ ErrorCode VpnConnection::lastError() const
void VpnConnection::connectToVpn(int serverIndex, const ServerCredentials &credentials, DockerContainer container, void VpnConnection::connectToVpn(int serverIndex, const ServerCredentials &credentials, DockerContainer container,
const QJsonObject &vpnConfiguration) const QJsonObject &vpnConfiguration)
{ {
qDebug() << QString("ConnectToVpn, Server index is %1, container is %2, route mode is") qDebug() << QString("Trying to connect to VPN, server index is %1, container is %2")
.arg(serverIndex) .arg(serverIndex)
.arg(ContainerProps::containerToString(container)) .arg(ContainerProps::containerToString(container));
<< m_settings->routeMode();
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) #if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
if (!m_IpcClient) { if (!m_IpcClient) {
m_IpcClient = new IpcClient(this); m_IpcClient = new IpcClient(this);
@ -341,26 +340,26 @@ void VpnConnection::appendSplitTunnelingConfig()
} }
} }
Settings::RouteMode routeMode = Settings::RouteMode::VpnAllSites; Settings::RouteMode sitesRouteMode = Settings::RouteMode::VpnAllSites;
QJsonArray sitesJsonArray; QJsonArray sitesJsonArray;
if (m_settings->isSitesSplitTunnelingEnabled()) { if (m_settings->isSitesSplitTunnelingEnabled()) {
routeMode = m_settings->routeMode(); sitesRouteMode = m_settings->routeMode();
if (allowSiteBasedSplitTunneling) { if (allowSiteBasedSplitTunneling) {
auto sites = m_settings->getVpnIps(routeMode); auto sites = m_settings->getVpnIps(sitesRouteMode);
for (const auto &site : sites) { for (const auto &site : sites) {
sitesJsonArray.append(site); sitesJsonArray.append(site);
} }
// Allow traffic to Amnezia DNS // Allow traffic to Amnezia DNS
if (routeMode == Settings::VpnOnlyForwardSites) { if (sitesRouteMode == Settings::VpnOnlyForwardSites) {
sitesJsonArray.append(m_vpnConfiguration.value(config_key::dns1).toString()); sitesJsonArray.append(m_vpnConfiguration.value(config_key::dns1).toString());
sitesJsonArray.append(m_vpnConfiguration.value(config_key::dns2).toString()); sitesJsonArray.append(m_vpnConfiguration.value(config_key::dns2).toString());
} }
} }
} }
m_vpnConfiguration.insert(config_key::splitTunnelType, routeMode); m_vpnConfiguration.insert(config_key::splitTunnelType, sitesRouteMode);
m_vpnConfiguration.insert(config_key::splitTunnelSites, sitesJsonArray); m_vpnConfiguration.insert(config_key::splitTunnelSites, sitesJsonArray);
Settings::AppsRouteMode appsRouteMode = Settings::AppsRouteMode::VpnAllApps; Settings::AppsRouteMode appsRouteMode = Settings::AppsRouteMode::VpnAllApps;
@ -376,6 +375,13 @@ void VpnConnection::appendSplitTunnelingConfig()
m_vpnConfiguration.insert(config_key::appSplitTunnelType, appsRouteMode); m_vpnConfiguration.insert(config_key::appSplitTunnelType, appsRouteMode);
m_vpnConfiguration.insert(config_key::splitTunnelApps, appsJsonArray); m_vpnConfiguration.insert(config_key::splitTunnelApps, appsJsonArray);
qDebug() << QString("Site split tunneling is %1, route mode is %2")
.arg(m_settings->isSitesSplitTunnelingEnabled() ? "enabled" : "disabled")
.arg(sitesRouteMode);
qDebug() << QString("App split tunneling is %1, route mode is %2")
.arg(m_settings->isAppsSplitTunnelingEnabled() ? "enabled" : "disabled")
.arg(appsRouteMode);
} }
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID