Compare commits

..

105 Commits

Author SHA1 Message Date
Cyril Anisimov
25a24bf38c focusControl => FocusControl 2024-12-30 18:10:25 +01:00
Cyril Anisimov
5e492e8392 remove debug output from focusControl 2024-12-30 18:05:31 +01:00
Cyril Anisimov
b25d911328 remove debug output from ListViewFocusController 2024-12-30 18:04:05 +01:00
Cyril Anisimov
caf29fb982 remove debug output from FocusController 2024-12-30 18:03:26 +01:00
Cyril Anisimov
32ef1eae84 fix PageDevMenu 2024-12-30 00:19:11 +01:00
Cyril Anisimov
b0fdbe6c4f fix PageSettingsAppSplitTunneling 2024-12-29 22:11:35 +01:00
Cyril Anisimov
dccfcde6f6 fix PageProtocolCloakSettings 2024-12-29 22:04:00 +01:00
Cyril Anisimov
26ba520022 fix ListViewWithLabelsType 2024-12-29 22:01:41 +01:00
Cyril Anisimov
0f98fc955f remove comments and clean up 2024-12-29 21:19:56 +01:00
Cyril Anisimov
2c1f3eaf3a refactor PageSetupWizardProtocols 2024-12-29 20:26:22 +01:00
Cyril Anisimov
867ad8ee3c fix focus movement on dynamic delegates in listView 2024-12-29 00:34:20 +01:00
Cyril Anisimov
f8f4d75cb7 Merge commit 'b88ab8e432fbd2ab5002856cd83ef57181a6d7fa' into improve_navigation_cpp 2024-12-23 09:36:55 +01:00
Cyril Anisimov
13e680f6e1 fix PageSetupWizardApiServicesList 2024-12-22 16:38:07 +01:00
Cyril Anisimov
8767f487b8 fix ScrollBarType 2024-12-22 16:28:13 +01:00
Cyril Anisimov
0cdd2ff826 fix CMakeLists.txt 2024-12-20 15:35:40 +01:00
Cyril Anisimov
c973b8868b rename focusControl to qmlUtils 2024-12-20 15:30:20 +01:00
Cyril Anisimov
53aa14a2ee fix back button on SelectLanguageDrawer 2024-12-20 02:26:05 +01:00
Cyril Anisimov
b29b5962d2 I have nothing is visible only on start screen 2024-12-20 02:17:50 +01:00
Cyril Anisimov
441a2f6df6 Restore from backup is visible only on start screen 2024-12-20 02:15:48 +01:00
Cyril Anisimov
fa64c8d68d fix focus movement in ServersListView 2024-12-20 02:05:28 +01:00
Cyril Anisimov
ae31bafeb9 remove arrow from Close application item 2024-12-19 00:22:59 +01:00
Cyril Anisimov
14d67503a8 add printSectionName method to listViewController 2024-12-19 00:00:36 +01:00
Cyril Anisimov
1029142b47 refactor focusConroller according to focusControl 2024-12-18 23:59:14 +01:00
Cyril Anisimov
7670d9dace refactor listViewFocusController acoording to focusControl 2024-12-18 23:57:08 +01:00
Cyril Anisimov
2266702a0b add focusControl with utility functions for
focus control
2024-12-18 23:47:52 +01:00
Cyril Anisimov
11d20974f0 format FocusController 2024-12-16 22:12:15 +01:00
Cyril Anisimov
a57e94e4f2 format ListViewFocusController 2024-12-16 22:12:00 +01:00
Cyril Anisimov
9620a24d6a remove manual focus control on PageShare 2024-12-15 23:23:15 +01:00
Cyril Anisimov
62be292833 Fix list view focus moving on PageShare 2024-12-15 23:14:52 +01:00
Cyril Anisimov
10e91b06f4 PageShare readonly properties 2024-12-15 23:12:59 +01:00
Cyril Anisimov
3a62f1f20b fix hide/unhide password 2024-12-14 23:44:15 +01:00
Cyril Anisimov
3021066180 refactor SwitcherType 2024-12-14 19:34:24 +01:00
Cyril Anisimov
378db1a9e5 make unchangable properties readonly 2024-12-14 19:33:54 +01:00
Cyril Anisimov
906cf7b939 fix split tunneling settings 2024-12-14 19:32:46 +01:00
Cyril Anisimov
8bc31b60a1 fix checked item in lists 2024-12-14 19:29:35 +01:00
Cyril Anisimov
149c9d12d3 Merge commit '367789bda28f33a11a72d61b222453c5b502299e' into improve_navigation_cpp 2024-12-14 18:38:41 +01:00
Cyril Anisimov
b33b97802e update logging settings page 2024-12-14 18:01:34 +01:00
Cyril Anisimov
d18f50a3e0 Update select language list 2024-12-13 22:27:21 +01:00
Cyril Anisimov
ef2ffce47a Fix selection in language change list 2024-12-13 22:14:27 +01:00
Cyril Anisimov
53f41408b8 Scrollbar is on if the content is larger than a screen 2024-12-13 22:09:37 +01:00
albexk
5b9ba8c027 fix: get rid of the assign function call 2024-12-09 20:56:58 +03:00
Cyril Anisimov
882c288d92 make minor fixes and clean up 2024-12-09 01:53:48 +01:00
Cyril Anisimov
ea39447708 fix focus behavior on new page/popup 2024-12-09 01:35:10 +01:00
Cyril Anisimov
3cc70790bd add setDelegateIndex method to listViewFocusController 2024-12-09 01:32:11 +01:00
Cyril Anisimov
f331c11f51 refactor credentials setup page to handle the focus navigation 2024-12-09 01:30:11 +01:00
Cyril Anisimov
39cbe6de28 update initial config page 2024-12-09 01:28:57 +01:00
Cyril Anisimov
87d00116e1 add ScrollBarType 2024-12-06 22:59:12 +01:00
Cyril Anisimov
f992252c6e Merge commit into improve_navigation_cpp 2024-12-02 11:10:30 +01:00
albexk
c9205afbd4 chore: bump version code 2024-11-25 14:08:25 +03:00
albexk
09b1f322ba fix: hide UI elements that use file saving 2024-11-25 13:56:14 +03:00
albexk
4d2d7e4071 fix: add the touch emulation method for Android TV 2024-11-25 12:33:34 +03:00
albexk
c72d76aec7 Merge branch 'improve_navigation_cpp' into feature/android-tv 2024-11-25 12:20:31 +03:00
albexk
50bd364f29 Merge branch 'dev' into feature/android-tv
# Conflicts:
#	CMakeLists.txt
2024-11-25 12:19:52 +03:00
albexk
3eeab2f2e7 fix: null uri processing 2024-11-25 12:17:22 +03:00
albexk
2987e03a86 fix: add the touch emulation method for Android TV 2024-11-25 12:17:22 +03:00
albexk
392cacaabc refactor: make TvFilePicker activity more sustainable 2024-11-25 12:17:22 +03:00
albexk
51092e91cf fix: change the banner format for TV 2024-11-25 12:17:22 +03:00
albexk
d02a6dfb22 fix: add a workaround to open files on Android TV due to lack of SAF 2024-11-25 12:17:22 +03:00
Nethius
4e1862a802 chore: minor fixes (#1235) 2024-11-25 12:15:36 +03:00
albexk
53e766f6d3 Fix connection check for AWG/WG 2024-11-25 12:15:36 +03:00
albexk
341d6f569b fix(android): add CHANGE_NETWORK_STATE permission for all Android versions 2024-11-25 12:15:36 +03:00
albexk
a5abab8caf fix: add separate method for reading files to fix file reading on Android TV 2024-11-25 12:15:36 +03:00
albexk
7df050371e Fix importing files on TVs 2024-11-25 12:15:36 +03:00
albexk
65870ad5c9 Add mandatory requirement for android.software.leanback. 2024-11-25 12:15:36 +03:00
albexk
940806a6fa Bump version 2024-11-25 12:15:36 +03:00
Cyril Anisimov
0620b4536a update popup 2024-11-21 19:11:57 +01:00
Cyril Anisimov
d956be901d refactor page logging settings for focus navigation 2024-11-21 19:11:57 +01:00
Cyril Anisimov
942805cca2 fix focus move on qr code on share page 2024-11-21 19:11:57 +01:00
Cyril Anisimov
ed6fc27e52 fix focus navigation in dynamic delegate of list view 2024-11-21 19:11:57 +01:00
Cyril Anisimov
416421cba7 fix crash on return with esc key 2024-11-21 19:11:57 +01:00
Cyril Anisimov
45b8235a81 update config page for scrolling with tab 2024-11-21 19:11:57 +01:00
Cyril Anisimov
a92f706524 fix focus on notification 2024-11-21 19:11:57 +01:00
Cyril Anisimov
5e9202f6ac refactor focusController to make the logic more
straightforward
2024-11-21 19:11:57 +01:00
Cyril Anisimov
dc6c1cdf49 refactor listViewFocusController 2024-11-21 19:11:57 +01:00
Cyril Anisimov
f020bdb6e8 fix drawer open close usage 2024-11-21 19:11:57 +01:00
Cyril Anisimov
88958c042f fix share details drawer 2024-11-21 19:11:57 +01:00
Cyril Anisimov
e4d21dc4d7 fix spawn signals on switch 2024-11-21 19:11:57 +01:00
Cyril Anisimov
2e896ed34f fix server list back button handler 2024-11-21 19:11:57 +01:00
Cyril Anisimov
163399816f minor fixes 2024-11-21 19:11:57 +01:00
Cyril Anisimov
3d7209ee7a fix focus move on list views with header and-or footer 2024-11-21 19:11:57 +01:00
Cyril Anisimov
42645a98f8 refactor about page for correct focus move 2024-11-21 19:11:57 +01:00
Cyril Anisimov
7c3d08d80e fix page share default server selection 2024-11-21 19:11:57 +01:00
Cyril Anisimov
c77e01fb37 fix server rename 2024-11-21 19:11:57 +01:00
Cyril Anisimov
b6c59b08a1 clean up page share 2024-11-21 19:11:56 +01:00
Cyril Anisimov
766e1c92fc fix focus on users on page share 2024-11-21 19:11:56 +01:00
Cyril Anisimov
21755cbd54 fix protocol settings focus move 2024-11-21 19:11:56 +01:00
Cyril Anisimov
dac45a9f7f fix crashes after ListView navigation 2024-11-21 19:11:56 +01:00
Cyril Anisimov
db5d289edc fix back navigation on default focus item 2024-11-21 19:11:56 +01:00
Cyril Anisimov
c962211068 fix PageSetupWizardProtocolSettings focus move 2024-11-21 19:11:56 +01:00
Cyril Anisimov
9cfa4c1389 fix drawer layout and focus move 2024-11-21 19:11:56 +01:00
Cyril Anisimov
2c9fa10b8b fix drawer radio buttons selection 2024-11-21 19:11:56 +01:00
Cyril Anisimov
626b9e1e76 fix reverse focus move on listView 2024-11-21 19:11:56 +01:00
Cyril Anisimov
ada3f9a7fa remove useless slots, logs, Drawer open and close 2024-11-21 19:11:56 +01:00
Cyril Anisimov
063851445a remove useless key navigation 2024-11-21 19:11:56 +01:00
Cyril Anisimov
852e90e317 update CardType for using with focus navigation 2024-11-21 19:11:56 +01:00
Cyril Anisimov
89ac585e07 fix ListView navigation 2024-11-21 19:11:56 +01:00
Cyril Anisimov
f3df9eb5f5 add ListViewFocusController 2024-11-21 19:11:56 +01:00
Cyril Anisimov
75f189e256 update pages 2024-11-21 19:11:56 +01:00
Cyril Anisimov
3c655d0051 update transitions 2024-11-21 19:11:56 +01:00
Cyril Anisimov
b4f4ec4ac9 add default focus item 2024-11-21 19:11:56 +01:00
Cyril Anisimov
f189f7b6af add reverse focus change to FocusController 2024-11-21 19:11:56 +01:00
Cyril Anisimov
78a4caa47e fixed language selector 2024-11-21 19:11:56 +01:00
Cyril Anisimov
01e31b4b4d add focus navigation to qml 2024-11-21 19:11:56 +01:00
Cyril Anisimov
cecee3769e add more key handlers 2024-11-21 19:11:55 +01:00
Cyril Anisimov
02bbcd3a31 add focusController class 2024-11-21 19:11:55 +01:00
43 changed files with 176 additions and 356 deletions

View File

@@ -11,7 +11,7 @@
<uses-feature android:name="android.hardware.camera.any" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<!-- for TV -->
<uses-feature android:name="android.software.leanback" android:required="false" />
<uses-feature android:name="android.software.leanback" android:required="true" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<!-- The following comment will be replaced upon deployment with default features based on the dependencies

View File

@@ -120,7 +120,7 @@ WireguardConfigurator::ConnectionData WireguardConfigurator::prepareWireguardCon
}
}
QString subnetIp = containerConfig.value(m_protocolName).toObject().value(config_key::subnet_address).toString(protocols::wireguard::defaultSubnetAddress);
QString subnetIp = containerConfig.value(config_key::subnet_address).toString(protocols::wireguard::defaultSubnetAddress);
{
QStringList l = subnetIp.split(".", Qt::SkipEmptyParts);
if (l.isEmpty()) {

View File

@@ -346,9 +346,7 @@ bool ServerController::isReinstallContainerRequired(DockerContainer container, c
}
if (container == DockerContainer::Awg) {
if ((oldProtoConfig.value(config_key::subnet_address).toString(protocols::wireguard::defaultSubnetAddress)
!= newProtoConfig.value(config_key::subnet_address).toString(protocols::wireguard::defaultSubnetAddress))
|| (oldProtoConfig.value(config_key::port).toString(protocols::awg::defaultPort)
if ((oldProtoConfig.value(config_key::port).toString(protocols::awg::defaultPort)
!= newProtoConfig.value(config_key::port).toString(protocols::awg::defaultPort))
|| (oldProtoConfig.value(config_key::junkPacketCount).toString(protocols::awg::defaultJunkPacketCount)
!= newProtoConfig.value(config_key::junkPacketCount).toString(protocols::awg::defaultJunkPacketCount))
@@ -372,10 +370,8 @@ bool ServerController::isReinstallContainerRequired(DockerContainer container, c
}
if (container == DockerContainer::WireGuard) {
if ((oldProtoConfig.value(config_key::subnet_address).toString(protocols::wireguard::defaultSubnetAddress)
!= newProtoConfig.value(config_key::subnet_address).toString(protocols::wireguard::defaultSubnetAddress))
|| (oldProtoConfig.value(config_key::port).toString(protocols::wireguard::defaultPort)
!= newProtoConfig.value(config_key::port).toString(protocols::wireguard::defaultPort)))
if (oldProtoConfig.value(config_key::port).toString(protocols::wireguard::defaultPort)
!= newProtoConfig.value(config_key::port).toString(protocols::wireguard::defaultPort))
return true;
}
@@ -611,8 +607,6 @@ ServerController::Vars ServerController::genVarsForScript(const ServerCredential
vars.append({ { "$SFTP_PASSWORD", sftpConfig.value(config_key::password).toString() } });
// Amnezia wireguard vars
vars.append({ { "$AWG_SUBNET_IP",
amneziaWireguarConfig.value(config_key::subnet_address).toString(protocols::wireguard::defaultSubnetAddress) } });
vars.append({ { "$AWG_SERVER_PORT", amneziaWireguarConfig.value(config_key::port).toString(protocols::awg::defaultPort) } });
vars.append({ { "$JUNK_PACKET_COUNT", amneziaWireguarConfig.value(config_key::junkPacketCount).toString() } });

View File

@@ -104,7 +104,7 @@ QJsonObject Deserialize(const QString &vmessStr, QString *alias, QString *errMes
server.users.first().security = "auto";
}
const auto getQueryValue = [&query](const QString &key, const QString &defaultValue) {
const static auto getQueryValue = [&query](const QString &key, const QString &defaultValue) {
if (query.hasQueryItem(key))
return query.queryItemValue(key, QUrl::FullyDecoded);
else

View File

@@ -1,5 +0,0 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18 13V19C18 19.5304 17.7893 20.0391 17.4142 20.4142C17.0391 20.7893 16.5304 21 16 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V8C3 7.46957 3.21071 6.96086 3.58579 6.58579C3.96086 6.21071 4.46957 6 5 6H11" stroke="#D7D8DB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M15 3H21V9" stroke="#D7D8DB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M10 14L21 3" stroke="#D7D8DB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 644 B

View File

@@ -196,8 +196,6 @@ QStringList LinuxFirewall::getDNSRules(const QStringList& servers)
result << QStringLiteral("-o amn0+ -d %1 -p tcp --dport 53 -j ACCEPT").arg(server);
result << QStringLiteral("-o tun0+ -d %1 -p udp --dport 53 -j ACCEPT").arg(server);
result << QStringLiteral("-o tun0+ -d %1 -p tcp --dport 53 -j ACCEPT").arg(server);
result << QStringLiteral("-o tun2+ -d %1 -p udp --dport 53 -j ACCEPT").arg(server);
result << QStringLiteral("-o tun2+ -d %1 -p tcp --dport 53 -j ACCEPT").arg(server);
}
return result;
}
@@ -279,7 +277,6 @@ void LinuxFirewall::install()
installAnchor(Both, QStringLiteral("200.allowVPN"), {
QStringLiteral("-o amn0+ -j ACCEPT"),
QStringLiteral("-o tun0+ -j ACCEPT"),
QStringLiteral("-o tun2+ -j ACCEPT"),
});
installAnchor(IPv4, QStringLiteral("120.blockNets"), {});

View File

@@ -1,6 +1,7 @@
#include "xrayprotocol.h"
#include "utilities.h"
#include "containers/containers_defs.h"
#include "core/networkUtilities.h"
#include <QCryptographicHash>
@@ -21,8 +22,9 @@ XrayProtocol::XrayProtocol(const QJsonObject &configuration, QObject *parent):
XrayProtocol::~XrayProtocol()
{
qDebug() << "XrayProtocol::~XrayProtocol()";
XrayProtocol::stop();
QThread::msleep(200);
m_xrayProcess.close();
}
ErrorCode XrayProtocol::start()
@@ -34,6 +36,10 @@ ErrorCode XrayProtocol::start()
return lastError();
}
if (Utils::processIsRunning(Utils::executable(xrayExecPath(), true))) {
Utils::killProcessByName(Utils::executable(xrayExecPath(), true));
}
#ifdef QT_DEBUG
m_xrayCfgFile.setAutoRemove(false);
#endif
@@ -48,16 +54,9 @@ ErrorCode XrayProtocol::start()
qDebug().noquote() << "XrayProtocol::start()"
<< xrayExecPath() << args.join(" ");
m_xrayProcess.setProcessChannelMode(QProcess::MergedChannels);
m_xrayProcess.setProgram(xrayExecPath());
if (Utils::processIsRunning(Utils::executable("xray", false))) {
qDebug().noquote() << "kill previos xray";
Utils::killProcessByName(Utils::executable("xray", false));
}
m_xrayProcess.setArguments(args);
connect(&m_xrayProcess, &QProcess::readyReadStandardOutput, this, [this]() {
@@ -69,9 +68,13 @@ ErrorCode XrayProtocol::start()
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;
setConnectionState(Vpn::ConnectionState::Disconnected);
if ((exitStatus != QProcess::NormalExit) || (exitCode != 0)) {
emit protocolError(amnezia::ErrorCode::XrayExecutableCrashed);
emit setConnectionState(Vpn::ConnectionState::Error);
if (exitStatus != QProcess::NormalExit) {
emit protocolError(amnezia::ErrorCode::XrayExecutableCrashed);
stop();
}
if (exitCode != 0) {
emit protocolError(amnezia::ErrorCode::InternalError);
stop();
}
});
@@ -174,14 +177,14 @@ void XrayProtocol::stop()
IpcClient::Interface()->StartRoutingIpv6();
#endif
qDebug() << "XrayProtocol::stop()";
m_xrayProcess.disconnect();
m_xrayProcess.kill();
m_xrayProcess.waitForFinished(3000);
m_xrayProcess.terminate();
if (m_t2sProcess) {
m_t2sProcess->stop();
}
setConnectionState(Vpn::ConnectionState::Disconnected);
#ifdef Q_OS_WIN
Utils::signalCtrl(m_xrayProcess.processId(), CTRL_C_EVENT);
#endif
}
QString XrayProtocol::xrayExecPath()

View File

@@ -21,7 +21,6 @@
<file>images/controls/edit-3.svg</file>
<file>images/controls/eye-off.svg</file>
<file>images/controls/eye.svg</file>
<file>images/controls/external-link.svg</file>
<file>images/controls/file-check-2.svg</file>
<file>images/controls/file-cog-2.svg</file>
<file>images/controls/folder-open.svg</file>
@@ -117,7 +116,6 @@
<file>server_scripts/xray/run_container.sh</file>
<file>server_scripts/xray/start.sh</file>
<file>server_scripts/xray/template.json</file>
<file>ui/qml/Components/AdLabel.qml</file>
<file>ui/qml/Components/ConnectButton.qml</file>
<file>ui/qml/Components/ConnectionTypeSelectionDrawer.qml</file>
<file>ui/qml/Components/HomeContainersListView.qml</file>

View File

@@ -12,7 +12,7 @@ echo $WIREGUARD_PSK > /opt/amnezia/awg/wireguard_psk.key
cat > /opt/amnezia/awg/wg0.conf <<EOF
[Interface]
PrivateKey = $WIREGUARD_SERVER_PRIVATE_KEY
Address = $AWG_SUBNET_IP/$WIREGUARD_SUBNET_CIDR
Address = $WIREGUARD_SUBNET_IP/$WIREGUARD_SUBNET_CIDR
ListenPort = $AWG_SERVER_PORT
Jc = $JUNK_PACKET_COUNT
Jmin = $JUNK_PACKET_MIN_SIZE

View File

@@ -17,12 +17,12 @@ iptables -A FORWARD -i wg0 -j ACCEPT
iptables -A OUTPUT -o wg0 -j ACCEPT
# Allow forwarding traffic only from the VPN.
iptables -A FORWARD -i wg0 -o eth0 -s $AWG_SUBNET_IP/$WIREGUARD_SUBNET_CIDR -j ACCEPT
iptables -A FORWARD -i wg0 -o eth1 -s $AWG_SUBNET_IP/$WIREGUARD_SUBNET_CIDR -j ACCEPT
iptables -A FORWARD -i wg0 -o eth0 -s $WIREGUARD_SUBNET_IP/$WIREGUARD_SUBNET_CIDR -j ACCEPT
iptables -A FORWARD -i wg0 -o eth1 -s $WIREGUARD_SUBNET_IP/$WIREGUARD_SUBNET_CIDR -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -s $AWG_SUBNET_IP/$WIREGUARD_SUBNET_CIDR -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s $AWG_SUBNET_IP/$WIREGUARD_SUBNET_CIDR -o eth1 -j MASQUERADE
iptables -t nat -A POSTROUTING -s $WIREGUARD_SUBNET_IP/$WIREGUARD_SUBNET_CIDR -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s $WIREGUARD_SUBNET_IP/$WIREGUARD_SUBNET_CIDR -o eth1 -j MASQUERADE
tail -f /dev/null

View File

@@ -538,13 +538,3 @@ void Settings::toggleDevGatewayEnv(bool enabled)
{
m_isDevGatewayEnv = enabled;
}
bool Settings::isHomeAdLabelVisible()
{
return value("Conf/homeAdLabelVisible", true).toBool();
}
void Settings::disableHomeAdLabel()
{
setValue("Conf/homeAdLabelVisible", false);
}

View File

@@ -222,9 +222,6 @@ public:
bool isDevGatewayEnv();
void toggleDevGatewayEnv(bool enabled);
bool isHomeAdLabelVisible();
void disableHomeAdLabel();
signals:
void saveLogsChanged(bool enabled);
void screenshotsEnabledChanged(bool enabled);

View File

@@ -10,15 +10,16 @@ FocusController::FocusController(QQmlApplicationEngine *engine, QObject *parent)
m_focusChain {},
m_focusedItem { nullptr },
m_rootObjects {},
m_defaultFocusItem { nullptr },
m_defaultFocusItem { QSharedPointer<QQuickItem>() },
m_lvfc { nullptr }
{
QObject::connect(m_engine, &QQmlApplicationEngine::objectCreated, this, [this](QObject *object, const QUrl &url) {
QQuickItem *newDefaultFocusItem = object->findChild<QQuickItem *>("defaultFocusItem");
if (newDefaultFocusItem && m_defaultFocusItem != newDefaultFocusItem) {
m_defaultFocusItem = newDefaultFocusItem;
}
});
QObject::connect(m_engine.get(), &QQmlApplicationEngine::objectCreated, this,
[this](QObject *object, const QUrl &url) {
QQuickItem *newDefaultFocusItem = object->findChild<QQuickItem *>("defaultFocusItem");
if (newDefaultFocusItem && m_defaultFocusItem != newDefaultFocusItem) {
m_defaultFocusItem.reset(newDefaultFocusItem);
}
});
QObject::connect(this, &FocusController::focusedItemChanged, this,
[this]() { m_focusedItem->forceActiveFocus(Qt::TabFocusReason); });
@@ -64,7 +65,7 @@ void FocusController::setFocusItem(QQuickItem *item)
void FocusController::setFocusOnDefaultItem()
{
setFocusItem(m_defaultFocusItem);
setFocusItem(m_defaultFocusItem.get());
}
void FocusController::pushRootObject(QObject *object)

View File

@@ -42,11 +42,11 @@ private:
void focusPreviousListViewItem();
void dropListView();
QQmlApplicationEngine *m_engine; // Pointer to engine to get root object
QList<QObject *> m_focusChain; // List of current objects to be focused
QQuickItem *m_focusedItem; // Pointer to the active focus item
QStack<QObject *> m_rootObjects; // Pointer to stack of roots for focus chain
QQuickItem *m_defaultFocusItem;
QSharedPointer<QQmlApplicationEngine> m_engine; // Pointer to engine to get root object
QList<QObject *> m_focusChain; // List of current objects to be focused
QQuickItem *m_focusedItem; // Pointer to the active focus item
QStack<QObject *> m_rootObjects;
QSharedPointer<QQuickItem> m_defaultFocusItem;
ListViewFocusController *m_lvfc; // ListView focus manager

View File

@@ -320,15 +320,4 @@ bool SettingsController::isOnTv()
#else
return false;
#endif
}
bool SettingsController::isHomeAdLabelVisible()
{
return m_settings->isHomeAdLabelVisible();
}
void SettingsController::disableHomeAdLabel()
{
m_settings->disableHomeAdLabel();
emit isHomeAdLabelVisibleChanged(false);
}
}

View File

@@ -29,8 +29,6 @@ public:
Q_PROPERTY(QString gatewayEndpoint READ getGatewayEndpoint WRITE setGatewayEndpoint NOTIFY gatewayEndpointChanged)
Q_PROPERTY(bool isDevGatewayEnv READ isDevGatewayEnv WRITE toggleDevGatewayEnv NOTIFY devGatewayEnvChanged)
Q_PROPERTY(bool isHomeAdLabelVisible READ isHomeAdLabelVisible NOTIFY isHomeAdLabelVisibleChanged)
public slots:
void toggleAmneziaDns(bool enable);
bool isAmneziaDnsEnabled();
@@ -91,9 +89,6 @@ public slots:
bool isOnTv();
bool isHomeAdLabelVisible();
void disableHomeAdLabel();
signals:
void primaryDnsChanged();
void secondaryDnsChanged();
@@ -117,8 +112,6 @@ signals:
void gatewayEndpointChanged(const QString &endpoint);
void devGatewayEnvChanged(bool enabled);
void isHomeAdLabelVisibleChanged(bool visible);
private:
QSharedPointer<ServersModel> m_serversModel;
QSharedPointer<ContainersModel> m_containersModel;

View File

@@ -70,7 +70,7 @@ QVariant ApiServicesModel::data(const QModelIndex &index, int role) const
.arg(speed);
} else if (serviceType == serviceType::amneziaFree){
QString description = tr("VPN to access blocked sites in regions with high levels of Internet censorship. ");
if (!isServiceAvailable) {
if (isServiceAvailable) {
description += tr("<p><a style=\"color: #EB5757;\">Not available in your region. If you have VPN enabled, disable it, return to the previous screen, and try again.</a>");
}
return description;
@@ -86,7 +86,7 @@ QVariant ApiServicesModel::data(const QModelIndex &index, int role) const
}
case IsServiceAvailableRole: {
if (serviceType == serviceType::amneziaFree) {
if (!isServiceAvailable) {
if (isServiceAvailable) {
return false;
}
}

View File

@@ -21,7 +21,6 @@ bool AwgConfigModel::setData(const QModelIndex &index, const QVariant &value, in
}
switch (role) {
case Roles::SubnetAddressRole: m_serverProtocolConfig.insert(config_key::subnet_address, value.toString()); break;
case Roles::PortRole: m_serverProtocolConfig.insert(config_key::port, value.toString()); break;
case Roles::ClientMtuRole: m_clientProtocolConfig.insert(config_key::mtu, value.toString()); break;
@@ -59,7 +58,6 @@ QVariant AwgConfigModel::data(const QModelIndex &index, int role) const
}
switch (role) {
case Roles::SubnetAddressRole: return m_serverProtocolConfig.value(config_key::subnet_address).toString();
case Roles::PortRole: return m_serverProtocolConfig.value(config_key::port).toString();
case Roles::ClientMtuRole: return m_clientProtocolConfig.value(config_key::mtu);
@@ -94,7 +92,6 @@ void AwgConfigModel::updateModel(const QJsonObject &config)
m_serverProtocolConfig.insert(config_key::transport_proto,
serverProtocolConfig.value(config_key::transport_proto).toString(defaultTransportProto));
m_serverProtocolConfig[config_key::last_config] = serverProtocolConfig.value(config_key::last_config);
m_serverProtocolConfig[config_key::subnet_address] = serverProtocolConfig.value(config_key::subnet_address).toString(protocols::wireguard::defaultSubnetAddress);
m_serverProtocolConfig[config_key::port] = serverProtocolConfig.value(config_key::port).toString(protocols::awg::defaultPort);
m_serverProtocolConfig[config_key::junkPacketCount] =
serverProtocolConfig.value(config_key::junkPacketCount).toString(protocols::awg::defaultJunkPacketCount);
@@ -171,7 +168,6 @@ QHash<int, QByteArray> AwgConfigModel::roleNames() const
{
QHash<int, QByteArray> roles;
roles[SubnetAddressRole] = "subnetAddress";
roles[PortRole] = "port";
roles[ClientMtuRole] = "clientMtu";
@@ -201,7 +197,6 @@ AwgConfig::AwgConfig(const QJsonObject &serverProtocolConfig)
clientJunkPacketMinSize = clientProtocolConfig.value(config_key::junkPacketMinSize).toString(protocols::awg::defaultJunkPacketMinSize);
clientJunkPacketMaxSize = clientProtocolConfig.value(config_key::junkPacketMaxSize).toString(protocols::awg::defaultJunkPacketMaxSize);
subnetAddress = serverProtocolConfig.value(config_key::subnet_address).toString(protocols::wireguard::defaultSubnetAddress);
port = serverProtocolConfig.value(config_key::port).toString(protocols::awg::defaultPort);
serverJunkPacketCount = serverProtocolConfig.value(config_key::junkPacketCount).toString(protocols::awg::defaultJunkPacketCount);
serverJunkPacketMinSize = serverProtocolConfig.value(config_key::junkPacketMinSize).toString(protocols::awg::defaultJunkPacketMinSize);
@@ -221,7 +216,7 @@ AwgConfig::AwgConfig(const QJsonObject &serverProtocolConfig)
bool AwgConfig::hasEqualServerSettings(const AwgConfig &other) const
{
if (subnetAddress != other.subnetAddress || port != other.port || serverJunkPacketCount != other.serverJunkPacketCount
if (port != other.port || serverJunkPacketCount != other.serverJunkPacketCount
|| serverJunkPacketMinSize != other.serverJunkPacketMinSize || serverJunkPacketMaxSize != other.serverJunkPacketMaxSize
|| serverInitPacketJunkSize != other.serverInitPacketJunkSize || serverResponsePacketJunkSize != other.serverResponsePacketJunkSize
|| serverInitPacketMagicHeader != other.serverInitPacketMagicHeader

View File

@@ -15,7 +15,6 @@ struct AwgConfig
{
AwgConfig(const QJsonObject &jsonConfig);
QString subnetAddress;
QString port;
QString clientMtu;
@@ -44,8 +43,7 @@ class AwgConfigModel : public QAbstractListModel
public:
enum Roles {
SubnetAddressRole = Qt::UserRole + 1,
PortRole,
PortRole = Qt::UserRole + 1,
ClientMtuRole,
ClientJunkPacketCountRole,

View File

@@ -21,7 +21,6 @@ bool WireGuardConfigModel::setData(const QModelIndex &index, const QVariant &val
}
switch (role) {
case Roles::SubnetAddressRole: m_serverProtocolConfig.insert(config_key::subnet_address, value.toString()); break;
case Roles::PortRole: m_serverProtocolConfig.insert(config_key::port, value.toString()); break;
case Roles::ClientMtuRole: m_clientProtocolConfig.insert(config_key::mtu, value.toString()); break;
}
@@ -37,7 +36,6 @@ QVariant WireGuardConfigModel::data(const QModelIndex &index, int role) const
}
switch (role) {
case Roles::SubnetAddressRole: return m_serverProtocolConfig.value(config_key::subnet_address).toString();
case Roles::PortRole: return m_serverProtocolConfig.value(config_key::port).toString();
case Roles::ClientMtuRole: return m_clientProtocolConfig.value(config_key::mtu);
}
@@ -58,7 +56,6 @@ void WireGuardConfigModel::updateModel(const QJsonObject &config)
m_serverProtocolConfig.insert(config_key::transport_proto,
serverProtocolConfig.value(config_key::transport_proto).toString(defaultTransportProto));
m_serverProtocolConfig[config_key::last_config] = serverProtocolConfig.value(config_key::last_config);
m_serverProtocolConfig[config_key::subnet_address] = serverProtocolConfig.value(config_key::subnet_address).toString(protocols::wireguard::defaultSubnetAddress);
m_serverProtocolConfig[config_key::port] = serverProtocolConfig.value(config_key::port).toString(protocols::wireguard::defaultPort);
auto lastConfig = m_serverProtocolConfig.value(config_key::last_config).toString();
@@ -99,7 +96,6 @@ QHash<int, QByteArray> WireGuardConfigModel::roleNames() const
{
QHash<int, QByteArray> roles;
roles[SubnetAddressRole] = "subnetAddress";
roles[PortRole] = "port";
roles[ClientMtuRole] = "clientMtu";
@@ -112,13 +108,12 @@ WgConfig::WgConfig(const QJsonObject &serverProtocolConfig)
QJsonObject clientProtocolConfig = QJsonDocument::fromJson(lastConfig.toUtf8()).object();
clientMtu = clientProtocolConfig[config_key::mtu].toString(protocols::wireguard::defaultMtu);
subnetAddress = serverProtocolConfig.value(config_key::subnet_address).toString(protocols::wireguard::defaultSubnetAddress);
port = serverProtocolConfig.value(config_key::port).toString(protocols::wireguard::defaultPort);
}
bool WgConfig::hasEqualServerSettings(const WgConfig &other) const
{
if (subnetAddress != other.subnetAddress || port != other.port) {
if (port != other.port) {
return false;
}
return true;

View File

@@ -10,7 +10,6 @@ struct WgConfig
{
WgConfig(const QJsonObject &jsonConfig);
QString subnetAddress;
QString port;
QString clientMtu;
@@ -25,8 +24,7 @@ class WireGuardConfigModel : public QAbstractListModel
public:
enum Roles {
SubnetAddressRole = Qt::UserRole + 1,
PortRole,
PortRole = Qt::UserRole + 1,
ClientMtuRole
};

View File

@@ -1,72 +0,0 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Shapes
import Qt5Compat.GraphicalEffects
import Style 1.0
import "../Config"
import "../Controls2"
import "../Controls2/TextTypes"
Rectangle {
id: root
property real contentHeight: ad.implicitHeight + ad.anchors.topMargin + ad.anchors.bottomMargin
border.width: 1
border.color: AmneziaStyle.color.goldenApricot
color: AmneziaStyle.color.transparent
radius: 13
visible: GC.isDesktop() && ServersModel.isDefaultServerFromApi
&& ServersModel.isDefaultServerDefaultContainerHasSplitTunneling && SettingsController.isHomeAdLabelVisible
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: function() {
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl() + "/premium")
}
}
RowLayout {
id: ad
anchors.fill: parent
anchors.margins: 16
Image {
source: "qrc:/images/controls/amnezia.svg"
sourceSize: Qt.size(36, 36)
layer {
effect: ColorOverlay {
color: AmneziaStyle.color.paleGray
}
}
}
CaptionTextType {
Layout.fillWidth: true
Layout.rightMargin: 10
Layout.leftMargin: 10
text: qsTr("Amnezia Premium - for access to any website")
color: AmneziaStyle.color.pearlGray
lineHeight: 18
font.pixelSize: 15
}
ImageButtonType {
image: "qrc:/images/controls/close.svg"
imageColor: AmneziaStyle.color.paleGray
onClicked: function() {
SettingsController.disableHomeAdLabel()
}
}
}
}

View File

@@ -12,7 +12,7 @@ Item {
readonly property string drawerExpandedStateName: "expanded"
readonly property string drawerCollapsedStateName: "collapsed"
readonly property bool isOpened: isExpandedStateActive() || (isCollapsedStateActive() && (dragArea.drag.active === true))
readonly property bool isOpened: isExpandedStateActive() || (isCollapsedStateActive && (dragArea.drag.active === true))
readonly property bool isClosed: isCollapsedStateActive() && (dragArea.drag.active === false)
property Component collapsedStateContent
@@ -123,7 +123,7 @@ Item {
id: background
anchors.fill: parent
color: root.isCollapsedStateActive() ? AmneziaStyle.color.transparent : AmneziaStyle.color.translucentMidnightBlack
color: root.isCollapsed ? AmneziaStyle.color.transparent : AmneziaStyle.color.translucentMidnightBlack
Behavior on color {
PropertyAnimation { duration: 200 }

View File

@@ -216,7 +216,9 @@ Item {
ColumnLayout {
id: header
anchors.fill: parent
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 16
BackButtonType {
@@ -224,21 +226,31 @@ Item {
backButtonImage: root.headerBackButtonImage
backButtonFunction: function() { menu.closeTriggered() }
}
}
Column {
id: col
anchors.top: header.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 16
spacing: 16
Header2Type {
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.bottomMargin: 16
Layout.fillWidth: true
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 16
anchors.rightMargin: 16
headerText: root.headerText
width: parent.width
}
Loader {
id: listViewLoader
sourceComponent: root.listView
Layout.fillHeight: true
}
}
}

View File

@@ -30,8 +30,6 @@ ListView {
property bool isFocusable: true
ScrollBar.vertical: ScrollBarType {}
ButtonGroup {
id: buttonGroup
}

View File

@@ -20,6 +20,7 @@ Item {
id: timer
interval: 200 // Milliseconds
onTriggered: {
console.debug(">>> PageType timer triggered")
FocusController.resetRootObject()
FocusController.setFocusOnDefaultItem()
}

View File

@@ -26,6 +26,5 @@ QtObject {
readonly property color softGoldenApricot: Qt.rgba(251/255, 178/255, 106/255, 0.3)
readonly property color mistyGray: Qt.rgba(215/255, 216/255, 219/255, 0.8)
readonly property color cloudyGray: Qt.rgba(215/255, 216/255, 219/255, 0.65)
readonly property color pearlGray: '#EAEAEC'
}
}

View File

@@ -1,7 +1,6 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import SortFilterProxyModel 0.2
@@ -43,18 +42,8 @@ PageType {
objectName: "homeColumnLayout"
anchors.fill: parent
anchors.topMargin: 12
anchors.bottomMargin: 16
AdLabel {
id: adLabel
Layout.fillWidth: true
Layout.preferredHeight: adLabel.contentHeight
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.bottomMargin: 22
}
anchors.topMargin: 34
anchors.bottomMargin: 34
BasicButtonType {
id: loggingButton
@@ -97,6 +86,7 @@ PageType {
objectName: "splitTunnelingButton"
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
Layout.bottomMargin: 34
leftPadding: 16
rightPadding: 16
@@ -266,11 +256,11 @@ PageType {
objectName: "rowLayoutLabel"
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.topMargin: 8
Layout.bottomMargin: drawer.isCollapsedStateActive ? 44 : ServersModel.isDefaultServerFromApi ? 61 : 16
Layout.bottomMargin: drawer.isCollapsed ? 44 : ServersModel.isDefaultServerFromApi ? 61 : 16
spacing: 0
BasicButtonType {
enabled: (ServersModel.defaultServerImagePathCollapsed !== "") && drawer.isCollapsedStateActive
enabled: (ServersModel.defaultServerImagePathCollapsed !== "") && drawer.isCollapsed
hoverEnabled: enabled
implicitHeight: 36
@@ -288,9 +278,8 @@ PageType {
buttonTextLabel.font.pixelSize: 13
buttonTextLabel.font.weight: 400
text: drawer.isCollapsedStateActive ? ServersModel.defaultServerDescriptionCollapsed : ServersModel.defaultServerDescriptionExpanded
text: drawer.isCollapsed ? ServersModel.defaultServerDescriptionCollapsed : ServersModel.defaultServerDescriptionExpanded
leftImageSource: ServersModel.defaultServerImagePathCollapsed
leftImageColor: ""
changeLeftImageSize: false
rightImageSource: hoverEnabled ? "qrc:/images/controls/chevron-down.svg" : ""
@@ -348,6 +337,7 @@ PageType {
objectName: "containersListView"
rootWidth: root.width
height: 500 // TODO: make calculated
Connections {
objectName: "rowLayoutConnections"

View File

@@ -36,13 +36,13 @@ PageType {
ListView {
id: listview
property bool isFocusable: true
anchors.top: backButtonLayout.bottom
anchors.bottom: parent.bottom
width: parent.width
property bool isFocusable: true
Keys.onTabPressed: {
FocusController.nextKeyTabItem()
}
@@ -76,7 +76,7 @@ PageType {
implicitWidth: listview.width
implicitHeight: col.implicitHeight
property alias vpnAddressSubnetTextField: vpnAddressSubnetTextField
property alias portTextField: portTextField
property bool isEnabled: ServersModel.isProcessedServerHasWriteAccess()
ColumnLayout {
@@ -97,30 +97,10 @@ PageType {
headerText: qsTr("AmneziaWG settings")
}
TextFieldWithHeaderType {
id: vpnAddressSubnetTextField
Layout.fillWidth: true
Layout.topMargin: 40
enabled: delegateItem.isEnabled
headerText: qsTr("VPN address subnet")
textFieldText: subnetAddress
textField.onEditingFinished: {
if (textFieldText !== subnetAddress) {
subnetAddress = textFieldText
}
}
checkEmptyText: true
}
TextFieldWithHeaderType {
id: portTextField
Layout.fillWidth: true
Layout.topMargin: 16
Layout.topMargin: 40
enabled: delegateItem.isEnabled
@@ -138,6 +118,26 @@ PageType {
checkEmptyText: true
}
TextFieldWithHeaderType {
id: mtuTextField
Layout.fillWidth: true
Layout.topMargin: 16
headerText: qsTr("MTU")
textFieldText: mtu
textField.validator: IntValidator { bottom: 576; top: 65535 }
textField.onEditingFinished: {
if (textFieldText === "") {
textFieldText = "0"
}
if (textFieldText !== mtu) {
mtu = textFieldText
}
}
checkEmptyText: true
}
TextFieldWithHeaderType {
id: junkPacketCountTextField
Layout.fillWidth: true
@@ -332,8 +332,7 @@ PageType {
junkPacketMaxSizeTextField.errorText === "" &&
junkPacketMinSizeTextField.errorText === "" &&
junkPacketCountTextField.errorText === "" &&
portTextField.errorText === "" &&
vpnAddressSubnetTextField.errorText === ""
portTextField.errorText === ""
text: qsTr("Save")

View File

@@ -176,6 +176,7 @@ PageType {
headerText: qsTr("Hash")
drawerParent: root
parentFlickable: fl
listView: ListViewWithRadioButtonType {
id: hashListView
@@ -224,6 +225,7 @@ PageType {
headerText: qsTr("Cipher")
drawerParent: root
parentFlickable: fl
listView: ListViewWithRadioButtonType {
id: cipherListView

View File

@@ -16,6 +16,8 @@ import "../Components"
PageType {
id: root
defaultActiveFocusItem: listview.currentItem.mtuTextField.textField
Item {
id: focusItem
onFocusChanged: {

View File

@@ -59,7 +59,7 @@ PageType {
delegate: Item {
id: delegateItem
property alias focusItemId: vpnAddressSubnetTextField
property alias focusItemId: portTextField.textField
property bool isEnabled: ServersModel.isProcessedServerHasWriteAccess()
implicitWidth: listview.width
@@ -82,29 +82,10 @@ PageType {
headerText: qsTr("WG settings")
}
TextFieldWithHeaderType {
id: vpnAddressSubnetTextField
Layout.fillWidth: true
Layout.topMargin: 40
enabled: delegateItem.isEnabled
headerText: qsTr("VPN address subnet")
textFieldText: subnetAddress
textField.onEditingFinished: {
if (textFieldText !== subnetAddress) {
subnetAddress = textFieldText
}
}
checkEmptyText: true
}
TextFieldWithHeaderType {
id: portTextField
Layout.fillWidth: true
Layout.topMargin: 16
Layout.topMargin: 40
enabled: delegateItem.isEnabled
@@ -122,14 +103,33 @@ PageType {
checkEmptyText: true
}
TextFieldWithHeaderType {
id: mtuTextField
Layout.fillWidth: true
Layout.topMargin: 16
headerText: qsTr("MTU")
textFieldText: mtu
textField.validator: IntValidator { bottom: 576; top: 65535 }
textField.onEditingFinished: {
if (textFieldText === "") {
textFieldText = "0"
}
if (textFieldText !== mtu) {
mtu = textFieldText
}
}
checkEmptyText: true
}
BasicButtonType {
id: saveButton
Layout.fillWidth: true
Layout.topMargin: 24
Layout.bottomMargin: 24
enabled: portTextField.errorText === "" &&
vpnAddressSubnetTextField.errorText === ""
enabled: portTextField.errorText === ""
text: qsTr("Save")

View File

@@ -18,13 +18,13 @@ PageType {
ListView {
id: menuContent
property bool isFocusable: true
property var selectedText
width: parent.width
height: parent.height
height: menuContent.contentItem.height
clip: true
interactive: true
interactive: false
model: ApiCountryModel
ButtonGroup {
@@ -34,8 +34,8 @@ PageType {
delegate: ColumnLayout {
id: content
width: menuContent.width
height: content.implicitHeight
implicitWidth: parent.width
implicitHeight: content.implicitHeight
RowLayout {
VerticalRadioButton {

View File

@@ -221,8 +221,15 @@ PageType {
SettingsController.clearSettings()
PageController.goToPageHome()
}
if (!GC.isMobile()) {
// root.defaultActiveFocusItem.forceActiveFocus()
}
}
var noButtonFunction = function() {
if (!GC.isMobile()) {
// root.defaultActiveFocusItem.forceActiveFocus()
}
}
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)

View File

@@ -109,8 +109,15 @@ PageType {
SettingsController.secondaryDns = "1.0.0.1"
secondaryDns.textFieldText = SettingsController.secondaryDns
PageController.showNotificationMessage(qsTr("Settings have been reset"))
if (!GC.isMobile()) {
// defaultActiveFocusItem.forceActiveFocus()
}
}
var noButtonFunction = function() {
if (!GC.isMobile()) {
// defaultActiveFocusItem.forceActiveFocus()
}
}
showQuestionDrawer(headerText, "", yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)

View File

@@ -206,32 +206,6 @@ PageType {
onClicked: { handler() }
}
}
footer: ColumnLayout {
width: listView.width
BasicButtonType {
id: siteLink2
Layout.topMargin: 24
Layout.bottomMargin: 16
Layout.alignment: Qt.AlignHCenter
implicitHeight: 32
defaultColor: AmneziaStyle.color.transparent
hoveredColor: AmneziaStyle.color.translucentWhite
pressedColor: AmneziaStyle.color.sheerWhite
disabledColor: AmneziaStyle.color.mutedGray
textColor: AmneziaStyle.color.goldenApricot
text: qsTr("Site Amnezia")
rightImageSource: "qrc:/images/controls/external-link.svg"
clickedFunc: function() {
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl())
}
}
}
}
property list<QtObject> variants: [

View File

@@ -355,7 +355,6 @@ PageType {
serverSelectorListView.selectedIndex = 0
}
serverSelectorListView.positionViewAtIndex(selectedIndex, ListView.Beginning)
serverSelectorListView.triggerCurrentItem()
}
@@ -411,7 +410,6 @@ PageType {
function onSeverSelectorIndexChanged() {
var defaultContainer = proxyContainersModel.mapFromSource(ServersModel.getProcessedServerData("defaultContainer"))
protocolSelectorListView.selectedIndex = defaultContainer
protocolSelectorListView.positionViewAtIndex(selectedIndex, ListView.Beginning)
protocolSelectorListView.triggerCurrentItem()
}
}
@@ -605,7 +603,6 @@ PageType {
}
clip: true
interactive: false
reuseItems: true
delegate: Item {
@@ -670,11 +667,7 @@ PageType {
ParagraphTextType {
color: AmneziaStyle.color.mutedGray
visible: creationDate
Layout.maximumWidth: parent.width
maximumLineCount: 2
wrapMode: Text.Wrap
elide: Qt.ElideRight
Layout.fillWidth: true
text: qsTr("Creation date: %1").arg(creationDate)
}
@@ -682,11 +675,7 @@ PageType {
ParagraphTextType {
color: AmneziaStyle.color.mutedGray
visible: latestHandshake
Layout.maximumWidth: parent.width
maximumLineCount: 2
wrapMode: Text.Wrap
elide: Qt.ElideRight
Layout.fillWidth: true
text: qsTr("Latest handshake: %1").arg(latestHandshake)
}
@@ -694,11 +683,7 @@ PageType {
ParagraphTextType {
color: AmneziaStyle.color.mutedGray
visible: dataReceived
Layout.maximumWidth: parent.width
maximumLineCount: 2
wrapMode: Text.Wrap
elide: Qt.ElideRight
Layout.fillWidth: true
text: qsTr("Data received: %1").arg(dataReceived)
}
@@ -706,11 +691,7 @@ PageType {
ParagraphTextType {
color: AmneziaStyle.color.mutedGray
visible: dataSent
Layout.maximumWidth: parent.width
maximumLineCount: 2
wrapMode: Text.Wrap
elide: Qt.ElideRight
Layout.fillWidth: true
text: qsTr("Data sent: %1").arg(dataSent)
}
@@ -718,9 +699,7 @@ PageType {
ParagraphTextType {
color: AmneziaStyle.color.mutedGray
visible: allowedIps
Layout.maximumWidth: parent.width
wrapMode: Text.Wrap
Layout.fillWidth: true
text: qsTr("Allowed IPs: %1").arg(allowedIps)
}

View File

@@ -348,7 +348,7 @@ PageType {
objectName: "settingsTabButton"
isSelected: tabBar.currentIndex === 2
image: "qrc:/images/controls/settings.svg"
image: "qrc:/images/controls/settings-2.svg"
clickedFunc: function () {
tabBarStackView.goToTabBarPage(PageEnum.PageSettings)
tabBar.currentIndex = 2

View File

@@ -194,13 +194,8 @@ bool Utils::processIsRunning(const QString &fileName, const bool fullFlag)
return false;
#else
QProcess process;
QStringList arguments;
if (fullFlag) {
arguments << "-f";
}
arguments << fileName;
process.setProcessChannelMode(QProcess::MergedChannels);
process.start("pgrep", arguments);
process.start("pgrep", QStringList({ fullFlag ? "-f" : "", fileName }));
process.waitForFinished();
if (process.exitStatus() == QProcess::NormalExit) {
if (fullFlag) {
@@ -253,7 +248,7 @@ bool Utils::killProcessByName(const QString &name)
#elif defined Q_OS_IOS || defined(Q_OS_ANDROID)
return false;
#else
return QProcess::execute("pkill", { name }) == 0;
QProcess::execute(QString("pkill %1").arg(name));
#endif
}

View File

@@ -228,8 +228,6 @@ bool IpcServer::enableKillSwitch(const QJsonObject &configStr, int vpnAdapterInd
#ifdef Q_OS_LINUX
// double-check + ensure our firewall is installed and enabled
if (!LinuxFirewall::isInstalled())
LinuxFirewall::install();
LinuxFirewall::setAnchorEnabled(LinuxFirewall::Both, QStringLiteral("000.allowLoopback"), true);
LinuxFirewall::setAnchorEnabled(LinuxFirewall::Both, QStringLiteral("100.blockAll"), blockAll);
LinuxFirewall::setAnchorEnabled(LinuxFirewall::IPv4, QStringLiteral("110.allowNets"), allowNets);

View File

@@ -11,6 +11,7 @@ IpcProcessTun2Socks::IpcProcessTun2Socks(QObject *parent) :
IpcProcessTun2SocksSource(parent),
m_t2sProcess(QSharedPointer<QProcess>(new QProcess()))
{
connect(m_t2sProcess.data(), &QProcess::stateChanged, this, &IpcProcessTun2Socks::stateChanged);
qDebug() << "IpcProcessTun2Socks::IpcProcessTun2Socks()";
}
@@ -22,10 +23,8 @@ IpcProcessTun2Socks::~IpcProcessTun2Socks()
void IpcProcessTun2Socks::start()
{
connect(m_t2sProcess.data(), &QProcess::stateChanged, this, &IpcProcessTun2Socks::stateChanged);
qDebug() << "IpcProcessTun2Socks::start()";
m_t2sProcess->setProgram(amnezia::permittedProcessPath(static_cast<amnezia::PermittedProcess>(amnezia::PermittedProcess::Tun2Socks)));
QString XrayConStr = "socks5://127.0.0.1:10808";
#ifdef Q_OS_WIN
@@ -42,11 +41,7 @@ void IpcProcessTun2Socks::start()
m_t2sProcess->setArguments(arguments);
if (Utils::processIsRunning(Utils::executable("tun2socks", false))) {
qDebug().noquote() << "kill previos tun2socks";
Utils::killProcessByName(Utils::executable("tun2socks", false));
}
Utils::killProcessByName(m_t2sProcess->program());
m_t2sProcess->start();
connect(m_t2sProcess.data(), &QProcess::readyReadStandardOutput, this, [this]() {
@@ -59,10 +54,12 @@ void IpcProcessTun2Socks::start()
connect(m_t2sProcess.data(), QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this](int exitCode, QProcess::ExitStatus exitStatus) {
qDebug().noquote() << "tun2socks finished, exitCode, exiStatus" << exitCode << exitStatus;
emit setConnectionState(Vpn::ConnectionState::Disconnected);
if ((exitStatus != QProcess::NormalExit) || (exitCode != 0)) {
emit setConnectionState(Vpn::ConnectionState::Error);
if (exitStatus != QProcess::NormalExit){
stop();
}
if (exitCode !=0 ){
stop();
}
});
m_t2sProcess->start();
@@ -72,8 +69,6 @@ void IpcProcessTun2Socks::start()
void IpcProcessTun2Socks::stop()
{
qDebug() << "IpcProcessTun2Socks::stop()";
m_t2sProcess->disconnect();
m_t2sProcess->kill();
m_t2sProcess->waitForFinished(3000);
m_t2sProcess->close();
}
#endif

View File

@@ -152,29 +152,21 @@ bool RouterLinux::routeDeleteList(const QString &gw, const QStringList &ips)
return cnt;
}
bool RouterLinux::isServiceActive(const QString &serviceName) {
QProcess process;
process.start("systemctl", { "is-active", "--quiet", serviceName });
process.waitForFinished();
return process.exitCode() == 0;
}
void RouterLinux::flushDns()
{
QProcess p;
p.setProcessChannelMode(QProcess::MergedChannels);
//check what the dns manager use
if (isServiceActive("nscd.service")) {
qDebug() << "Restarting nscd.service";
p.start("systemctl", { "restart", "nscd" });
} else if (isServiceActive("systemd-resolved.service")) {
qDebug() << "Restarting systemd-resolved.service";
p.start("systemctl", { "restart", "systemd-resolved" });
} else {
qDebug() << "No suitable DNS manager found.";
return;
if (QFileInfo::exists("/usr/bin/nscd")
|| QFileInfo::exists("/usr/sbin/nscd")
|| QFileInfo::exists("/usr/lib/systemd/system/nscd.service"))
{
p.start("systemctl restart nscd");
}
else
{
p.start("systemctl restart systemd-resolved");
}
p.waitForFinished();

View File

@@ -43,7 +43,6 @@ private:
RouterLinux(RouterLinux const &) = delete;
RouterLinux& operator= (RouterLinux const&) = delete;
bool isServiceActive(const QString &serviceName);
QList<Route> m_addedRoutes;
DnsUtilsLinux *m_dnsUtil;
};