Compare commits

..

1 Commits

Author SHA1 Message Date
Igor Sorokin abd0ee899b Fix: no username autocapitalization (https://trello.com/c/T2ot7oWb) 2024-02-18 16:31:12 +03:00
57 changed files with 3213 additions and 4759 deletions
+7 -7
View File
@@ -14,8 +14,8 @@ jobs:
runs-on: ubuntu-20.04
env:
QT_VERSION: 6.6.2
QIF_VERSION: 4.7
QT_VERSION: 6.5.1
QIF_VERSION: 4.6
steps:
- name: 'Install Qt'
@@ -72,8 +72,8 @@ jobs:
runs-on: windows-latest
env:
QT_VERSION: 6.6.2
QIF_VERSION: 4.7
QT_VERSION: 6.5.1
QIF_VERSION: 4.6
BUILD_ARCH: 64
steps:
@@ -134,7 +134,7 @@ jobs:
runs-on: macos-13
env:
QT_VERSION: 6.6.2
QT_VERSION: 6.5.2
CC: cc
CXX: c++
@@ -227,7 +227,7 @@ jobs:
env:
# Keep compat with MacOS 10.15 aka Catalina by Qt 6.4
QT_VERSION: 6.4.3
QIF_VERSION: 4.7
QIF_VERSION: 4.6
steps:
- name: 'Setup xcode'
@@ -286,7 +286,7 @@ jobs:
env:
ANDROID_BUILD_PLATFORM: android-34
QT_VERSION: 6.6.2
QT_VERSION: 6.6.1
QT_MODULES: 'qtremoteobjects qt5compat qtimageformats qtshadertools'
steps:
-3
View File
@@ -131,6 +131,3 @@ client/3rd/ShadowSocks/ss_ios.xcconfig
# UML generated pics
out/
# CMake files
CMakeFiles/
-9
View File
@@ -15,15 +15,6 @@ set(PACKAGES
Core5Compat Concurrent LinguistTools
)
execute_process(
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
COMMAND git rev-parse --short HEAD
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_definitions(-DGIT_COMMIT_HASH="${GIT_COMMIT_HASH}")
if(IOS)
set(PACKAGES ${PACKAGES} Multimedia)
endif()
+1 -7
View File
@@ -286,16 +286,10 @@ void AmneziaApplication::initModels()
m_containersModel.reset(new ContainersModel(this));
m_engine->rootContext()->setContextProperty("ContainersModel", m_containersModel.get());
m_defaultServerContainersModel.reset(new ContainersModel(this));
m_engine->rootContext()->setContextProperty("DefaultServerContainersModel", m_defaultServerContainersModel.get());
m_serversModel.reset(new ServersModel(m_settings, this));
m_engine->rootContext()->setContextProperty("ServersModel", m_serversModel.get());
connect(m_serversModel.get(), &ServersModel::containersUpdated, m_containersModel.get(),
&ContainersModel::updateModel);
connect(m_serversModel.get(), &ServersModel::defaultServerContainersUpdated, m_defaultServerContainersModel.get(),
&ContainersModel::updateModel);
m_serversModel->resetModel();
m_languageModel.reset(new LanguageModel(m_settings, this));
m_engine->rootContext()->setContextProperty("LanguageModel", m_languageModel.get());
@@ -339,7 +333,7 @@ void AmneziaApplication::initModels()
connect(m_configurator.get(), &VpnConfigurator::newVpnConfigCreated, this,
[this](const QString &clientId, const QString &clientName, const DockerContainer container,
ServerCredentials credentials) {
m_serversModel->reloadDefaultServerContainerConfig();
m_serversModel->reloadContainerConfig();
m_clientManagementModel->appendClient(clientId, clientName, container, credentials);
emit m_configurator->clientModelUpdated();
});
-1
View File
@@ -92,7 +92,6 @@ private:
QCommandLineParser m_parser;
QSharedPointer<ContainersModel> m_containersModel;
QSharedPointer<ContainersModel> m_defaultServerContainersModel;
QSharedPointer<ServersModel> m_serversModel;
QSharedPointer<LanguageModel> m_languageModel;
QSharedPointer<ProtocolsModel> m_protocolsModel;
@@ -1,6 +0,0 @@
<svg width="19" height="18" viewBox="0 0 19 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="0.5" width="18" height="18" rx="5" fill="white"/>
<path d="M8.49219 13.5L8.49219 9.44141L14.0191 4.99484" stroke="#0E0E11" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M4.47363 5.49805L6.98828 8.0127" stroke="#0E0E11" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M14.4727 9.5L14.4727 4.5033L9.50195 4.5033" stroke="#0E0E11" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 511 B

-3
View File
@@ -124,10 +124,7 @@ void LocalSocketController::activate(const QJsonObject &rawConfig) {
// json.insert("hopindex", QJsonValue((double)hop.m_hopindex));
json.insert("privateKey", wgConfig.value(amnezia::config_key::client_priv_key));
json.insert("deviceIpv4Address", wgConfig.value(amnezia::config_key::client_ip));
// todo review wg ipv6
#ifndef Q_OS_WINDOWS
json.insert("deviceIpv6Address", "dead::1");
#endif
json.insert("serverPublicKey", wgConfig.value(amnezia::config_key::server_pub_key));
json.insert("serverPskKey", wgConfig.value(amnezia::config_key::psk_key));
json.insert("serverIpv4AddrIn", wgConfig.value(amnezia::config_key::hostName));
@@ -175,7 +175,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
return
}
guard let wgConfigStr = try? JSONDecoder().decode(WGConfig.self, from: wgConfig).str,
guard let wgConfigStr = try? JSONDecoder().decode(WGConfig.self, from: wgConfig).wg,
let tunnelConfiguration = try? TunnelConfiguration(fromWgQuickConfig: wgConfigStr)
else {
wg_log(.error, message: "Can't parse WireGuard config")
+26 -28
View File
@@ -1,23 +1,22 @@
import Foundation
struct WGConfigData: Decodable {
let initPacketMagicHeader, responsePacketMagicHeader: String?
let underloadPacketMagicHeader, transportPacketMagicHeader: String?
let junkPacketCount, junkPacketMinSize, junkPacketMaxSize: String?
let initPacketJunkSize, responsePacketJunkSize: String?
let h1, h2, h3, h4: String?
let jc, jmax, jmin: String?
let s1, s2: String?
var settings: String {
junkPacketCount == nil ? "" :
jc == nil ? "" :
"""
Jc = \(junkPacketCount!)
Jmin = \(junkPacketMinSize!)
Jmax = \(junkPacketMaxSize!)
S1 = \(initPacketJunkSize!)
S2 = \(responsePacketJunkSize!)
H1 = \(initPacketMagicHeader!)
H2 = \(responsePacketMagicHeader!)
H3 = \(underloadPacketMagicHeader!)
H4 = \(transportPacketMagicHeader!)
Jc = \(jc!)
Jmin = \(jmin!)
Jmax = \(jmax!)
S1 = \(s1!)
S2 = \(s2!)
H1 = \(h1!)
H2 = \(h2!)
H3 = \(h3!)
H4 = \(h4!)
"""
}
@@ -34,10 +33,9 @@ struct WGConfigData: Decodable {
var persistentKeepAlive: String
enum CodingKeys: String, CodingKey {
case initPacketMagicHeader = "H1", responsePacketMagicHeader = "H2"
case underloadPacketMagicHeader = "H3", transportPacketMagicHeader = "H4"
case junkPacketCount = "Jc", junkPacketMinSize = "Jmin", junkPacketMaxSize = "Jmax"
case initPacketJunkSize = "S1", responsePacketJunkSize = "S2"
case h1 = "H1", h2 = "H2", h3 = "H3", h4 = "H4"
case jc = "Jc", jmax = "Jmax", jmin = "Jmin"
case s1 = "S1", s2 = "S2"
case clientIP = "client_ip" // "10.8.1.16"
case clientPrivateKey = "client_priv_key"
@@ -53,15 +51,15 @@ struct WGConfigData: Decodable {
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.initPacketMagicHeader = try container.decodeIfPresent(String.self, forKey: .initPacketMagicHeader)
self.responsePacketMagicHeader = try container.decodeIfPresent(String.self, forKey: .responsePacketMagicHeader)
self.underloadPacketMagicHeader = try container.decodeIfPresent(String.self, forKey: .underloadPacketMagicHeader)
self.transportPacketMagicHeader = try container.decodeIfPresent(String.self, forKey: .transportPacketMagicHeader)
self.junkPacketCount = try container.decodeIfPresent(String.self, forKey: .junkPacketCount)
self.junkPacketMinSize = try container.decodeIfPresent(String.self, forKey: .junkPacketMinSize)
self.junkPacketMaxSize = try container.decodeIfPresent(String.self, forKey: .junkPacketMaxSize)
self.initPacketJunkSize = try container.decodeIfPresent(String.self, forKey: .initPacketJunkSize)
self.responsePacketJunkSize = try container.decodeIfPresent(String.self, forKey: .responsePacketJunkSize)
self.h1 = try container.decodeIfPresent(String.self, forKey: .h1)
self.h2 = try container.decodeIfPresent(String.self, forKey: .h2)
self.h3 = try container.decodeIfPresent(String.self, forKey: .h3)
self.h4 = try container.decodeIfPresent(String.self, forKey: .h4)
self.jc = try container.decodeIfPresent(String.self, forKey: .jc)
self.jmax = try container.decodeIfPresent(String.self, forKey: .jmax)
self.jmin = try container.decodeIfPresent(String.self, forKey: .jmin)
self.s1 = try container.decodeIfPresent(String.self, forKey: .s1)
self.s2 = try container.decodeIfPresent(String.self, forKey: .s2)
self.clientIP = try container.decode(String.self, forKey: .clientIP)
self.clientPrivateKey = try container.decode(String.self, forKey: .clientPrivateKey)
self.clientPublicKey = try container.decode(String.self, forKey: .clientPublicKey)
@@ -117,7 +115,7 @@ struct WGConfig: Decodable {
self.splitTunnelType = try container.decode(Int.self, forKey: .splitTunnelType)
}
var str: String {
var wg: String {
"""
[Interface]
Address = \(data.clientIP)/32
-2
View File
@@ -224,8 +224,6 @@
<file>ui/qml/Pages2/PageShareFullAccess.qml</file>
<file>images/controls/close.svg</file>
<file>images/controls/search.svg</file>
<file>ui/qml/Components/HomeSplitTunnelingDrawer.qml</file>
<file>images/controls/split-tunneling.svg</file>
<file>ui/qml/Controls2/DrawerType2.qml</file>
</qresource>
</RCC>
+120 -196
View File
@@ -92,7 +92,7 @@
<context>
<name>ExportController</name>
<message>
<location filename="../ui/controllers/exportController.cpp" line="39"/>
<location filename="../ui/controllers/exportController.cpp" line="38"/>
<source>Access error!</source>
<translation>خطأ في الوصول!</translation>
</message>
@@ -100,60 +100,16 @@
<context>
<name>HomeContainersListView</name>
<message>
<location filename="../ui/qml/Components/HomeContainersListView.qml" line="59"/>
<location filename="../ui/qml/Components/HomeContainersListView.qml" line="58"/>
<source>Unable change protocol while there is an active connection</source>
<translation>قم بتغيير البروتوكول عند تواجد اتصال</translation>
</message>
<message>
<location filename="../ui/qml/Components/HomeContainersListView.qml" line="68"/>
<location filename="../ui/qml/Components/HomeContainersListView.qml" line="67"/>
<source>The selected protocol is not supported on the current platform</source>
<translation>البروتوكول المحدد غير مدعوم علي المنصة الحالية</translation>
</message>
</context>
<context>
<name>HomeSplitTunnelingDrawer</name>
<message>
<location filename="../ui/qml/Components/HomeSplitTunnelingDrawer.qml" line="32"/>
<source>Split tunneling</source>
<translation type="unfinished">تقسيم الانفاق</translation>
</message>
<message>
<location filename="../ui/qml/Components/HomeSplitTunnelingDrawer.qml" line="33"/>
<source>Allows you to connect to some sites or applications through a VPN connection and bypass others</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Components/HomeSplitTunnelingDrawer.qml" line="42"/>
<source>Split tunneling on the server</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Components/HomeSplitTunnelingDrawer.qml" line="43"/>
<source>Enabled
Can&apos;t be disabled for current server</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Components/HomeSplitTunnelingDrawer.qml" line="62"/>
<source>Site-based split tunneling</source>
<translation type="unfinished">انقسام الانفاق القائم علي الموقع</translation>
</message>
<message>
<location filename="../ui/qml/Components/HomeSplitTunnelingDrawer.qml" line="63"/>
<source>Enabled</source>
<translation type="unfinished">مٌفعل</translation>
</message>
<message>
<location filename="../ui/qml/Components/HomeSplitTunnelingDrawer.qml" line="63"/>
<source>Disabled</source>
<translation type="unfinished">مٌعطل</translation>
</message>
<message>
<location filename="../ui/qml/Components/HomeSplitTunnelingDrawer.qml" line="79"/>
<source>App-based split tunneling</source>
<translation type="unfinished">انقسام الانفاق القائم علي التطبيق</translation>
</message>
</context>
<context>
<name>ImportController</name>
<message>
@@ -314,27 +270,17 @@ Already installed containers were found on the server. All installed containers
<context>
<name>PageHome</name>
<message>
<location filename="../ui/qml/Pages2/PageHome.qml" line="61"/>
<source>Split tunneling enabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageHome.qml" line="61"/>
<source>Split tunneling disabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageHome.qml" line="224"/>
<location filename="../ui/qml/Pages2/PageHome.qml" line="184"/>
<source>VPN protocol</source>
<translation>بروتوكول VPN</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageHome.qml" line="272"/>
<location filename="../ui/qml/Pages2/PageHome.qml" line="229"/>
<source>Servers</source>
<translation>الخوادم</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageHome.qml" line="360"/>
<location filename="../ui/qml/Pages2/PageHome.qml" line="331"/>
<source>Unable change server while there is an active connection</source>
<translation>لا يمكن تغير الخادم بينما هناك اتصال مفعل</translation>
</message>
@@ -1051,11 +997,6 @@ And if you don&apos;t like the app, all the more support it - the donation will
<source>https://amnezia.org</source>
<translation></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsAbout.qml" line="178"/>
<source>Software version: %1</source>
<translation>%1 :إصدار البرنامج</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsAbout.qml" line="194"/>
<source>Check for updates</source>
@@ -1094,66 +1035,56 @@ And if you don&apos;t like the app, all the more support it - the donation will
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="93"/>
<source>Auto connect</source>
<translation type="unfinished">الاتصال التلقائي</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="94"/>
<source>Connect to VPN on app start</source>
<translation type="unfinished">اتصل ب ال VPN عند تشغيل التطبيق</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="114"/>
<source>Start minimized</source>
<translation>ابدأ ب الحجم الادني</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="115"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="94"/>
<source>Launch application minimized</source>
<translation>تشغيل التطبيق في الحد الادني</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="132"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="111"/>
<source>Language</source>
<translation>اللغة</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="147"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="126"/>
<source>Logging</source>
<translation>تسجيل</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="148"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="127"/>
<source>Enabled</source>
<translation>مٌفعل</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="148"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="127"/>
<source>Disabled</source>
<translation>مٌعطل</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="161"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="140"/>
<source>Reset settings and remove all data from the application</source>
<translation>إعادة ضبط الاعدادات ومسح جميع البيانات من التطبيق</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="166"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="144"/>
<source>Reset settings and remove all data from the application?</source>
<translation>إعادة ضبط الاعدادات ومسح جميع البيانات من التطبيق؟</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="167"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="145"/>
<source>All settings will be reset to default. All installed AmneziaVPN services will still remain on the server.</source>
<translation>سيتم ضبط الاعدادات الافتراضية. جميع خدمات AmneziaVPN المٌثبتة ستبقي علي الخادم.</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="168"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="146"/>
<source>Continue</source>
<translation>واصل</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="169"/>
<location filename="../ui/qml/Pages2/PageSettingsApplication.qml" line="147"/>
<source>Cancel</source>
<translation>إلغاء</translation>
</message>
@@ -1208,7 +1139,7 @@ And if you don&apos;t like the app, all the more support it - the donation will
<message>
<location filename="../ui/qml/Pages2/PageSettingsBackup.qml" line="122"/>
<source>Restore from backup</source>
<translation>استرجاع من ملف يحتوي علي نسخة احتياطية</translation>
<translation>استرجاع من ملف احتياطي</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsBackup.qml" line="125"/>
@@ -1244,20 +1175,22 @@ And if you don&apos;t like the app, all the more support it - the donation will
<translation>الاتصال</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="50"/>
<source>Auto connect</source>
<translation type="vanished">الاتصال التلقائي</translation>
<translation>الاتصال التلقائي</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="51"/>
<source>Connect to VPN on app start</source>
<translation type="vanished">اتصل ب ال VPN عند تشغيل التطبيق</translation>
<translation>اتصل ب ال VPN عند تشغيل التطبيق</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="65"/>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="86"/>
<source>When AmneziaDNS is not used or installed</source>
<translation>عندما يكون AmneziaDNS غير مٌثبت او غير مستخدم</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="99"/>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="120"/>
<source>Allows you to use the VPN only for certain Apps</source>
<translation>يسمح لك بأستخدام ال VPN علي تطبيقات معينة</translation>
</message>
@@ -1266,32 +1199,32 @@ And if you don&apos;t like the app, all the more support it - the donation will
<translation type="obsolete">استخدم AmneziaDNS إذا كان مٌثبت علي الخادم</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="48"/>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="69"/>
<source>Use AmneziaDNS</source>
<translation>استخدم AmneziaDNS</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="49"/>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="70"/>
<source>If AmneziaDNS is installed on the server</source>
<translation>في حالة كان AmneziaDNS مٌثبت علي الخادم</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="64"/>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="85"/>
<source>DNS servers</source>
<translation>خوادم DNS</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="80"/>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="101"/>
<source>Site-based split tunneling</source>
<translation>انقسام الانفاق القائم علي الموقع</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="81"/>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="102"/>
<source>Allows you to select which sites you want to access through the VPN</source>
<translation>يسمح لك بتحديد اي موقع تريد الوصول له عن طريق ال VPN</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="98"/>
<location filename="../ui/qml/Pages2/PageSettingsConnection.qml" line="119"/>
<source>App-based split tunneling</source>
<translation>انقسام الانفاق القائم علي التطبيق</translation>
</message>
@@ -1311,62 +1244,62 @@ And if you don&apos;t like the app, all the more support it - the donation will
<context>
<name>PageSettingsDns</name>
<message>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="39"/>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="37"/>
<source>Default server does not support custom dns</source>
<translation>الخادم الافتراضي لا يدعم DNS مخصص</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="57"/>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="55"/>
<source>DNS servers</source>
<translation>خوادم ال DNS</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="62"/>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="60"/>
<source>If AmneziaDNS is not used or installed</source>
<translation>AmneziaVPN ليس مٌستخدم او مٌثبت</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="69"/>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="67"/>
<source>Primary DNS</source>
<translation>الرئيسي DNS</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="83"/>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="81"/>
<source>Secondary DNS</source>
<translation>الثانوي DNS</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="103"/>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="101"/>
<source>Restore default</source>
<translation>استعادة الافتراضي</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="106"/>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="104"/>
<source>Restore default DNS settings?</source>
<translation>قم بأعادة ضبط إعدادات ال DNS الافتراضية؟</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="107"/>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="105"/>
<source>Continue</source>
<translation>واصل</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="108"/>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="106"/>
<source>Cancel</source>
<translation>إلغاء</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="115"/>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="113"/>
<source>Settings have been reset</source>
<translation>لم يتم إعادة ضبط الإعدادات</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="129"/>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="127"/>
<source>Save</source>
<translation>احفظ</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="138"/>
<location filename="../ui/qml/Pages2/PageSettingsDns.qml" line="136"/>
<source>Settings saved</source>
<translation>تم حفظ الإعدادات</translation>
</message>
@@ -1406,7 +1339,7 @@ And if you don&apos;t like the app, all the more support it - the donation will
<message>
<location filename="../ui/qml/Pages2/PageSettingsLogging.qml" line="128"/>
<source>Save logs to file</source>
<translation>احفظ السجلات في ملف</translation>
<translation>احفظ السجلات لملف</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsLogging.qml" line="146"/>
@@ -1553,27 +1486,27 @@ And if you don&apos;t like the app, all the more support it - the donation will
<context>
<name>PageSettingsServerInfo</name>
<message>
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="105"/>
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="109"/>
<source>Server name</source>
<translation>اسم الخادم</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="118"/>
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="122"/>
<source>Save</source>
<translation>احفظ</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="155"/>
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="153"/>
<source>Protocols</source>
<translation>البروتوكولات</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="161"/>
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="159"/>
<source>Services</source>
<translation>الخدمات</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="165"/>
<location filename="../ui/qml/Pages2/PageSettingsServerInfo.qml" line="163"/>
<source>Data</source>
<translation>البيانات</translation>
</message>
@@ -1642,100 +1575,95 @@ And if you don&apos;t like the app, all the more support it - the donation will
<translation type="obsolete">قسم نفق الموقع</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="36"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="31"/>
<source>Default server does not support split tunneling function</source>
<translation>السرفر الافتراضي لا يدعم ميزة تقسيم الانفاق</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="74"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="66"/>
<source>Addresses from the list should not be accessed via VPN</source>
<translation>لا يجب الولوج للعنواين المذكورة هنا من خلال ال VPN</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="106"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="98"/>
<source>Split tunneling</source>
<translation>تقسيم الانفاق</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="138"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="130"/>
<source>Mode</source>
<translation>وضع</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="216"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="208"/>
<source>Remove </source>
<translation>احذف </translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="217"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="209"/>
<source>Continue</source>
<translation>واصل</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="218"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="210"/>
<source>Cancel</source>
<translation>إلغاء</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="69"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="61"/>
<source>Only the sites listed here will be accessed through the VPN</source>
<translation>سيتم الولوج للمواقع المذكورة هنا فقط عن طريق ال VPN</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="33"/>
<source>Cannot change split tunneling settings during active connection</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="262"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="254"/>
<source>website or IP</source>
<translation>موقع او IP</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="303"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="295"/>
<source>Import / Export Sites</source>
<translation></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="309"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="301"/>
<source>Import</source>
<translation>استرد</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="321"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="313"/>
<source>Save site list</source>
<translation>احفظ قائمة المواقع</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="328"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="320"/>
<source>Save sites</source>
<translation>احفظ المواقع</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="329"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="398"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="413"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="321"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="390"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="405"/>
<source>Sites files (*.json)</source>
<translation></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="388"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="380"/>
<source>Import a list of sites</source>
<translation>استرد قائمة من المواقع</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="394"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="386"/>
<source>Replace site list</source>
<translation>تبديل قائمة المواقع</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="397"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="412"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="389"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="404"/>
<source>Open sites file</source>
<translation>افتح ملف المواقع</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="409"/>
<location filename="../ui/qml/Pages2/PageSettingsSplitTunneling.qml" line="401"/>
<source>Add imported sites to existing ones</source>
<translation>إضافة المواقع المستردة للمواقع الموجودة</translation>
</message>
@@ -2009,8 +1937,7 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<message>
<location filename="../ui/qml/Pages2/PageSetupWizardTextKey.qml" line="42"/>
<source>A line that starts with vpn://...</source>
<translatorcomment>يجب ان تٌكتب بهذه الطريقة حتي بوجود الخطأ كي تظهر بشكل صحيح داخل التطبيق</translatorcomment>
<translation>سطر يبدأ ب ...//:vpn</translation>
<translation>سطر يبدأ ب vpn://...</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageSetupWizardTextKey.qml" line="53"/>
@@ -2059,138 +1986,128 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<context>
<name>PageShare</name>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="58"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="54"/>
<source>Save OpenVPN config</source>
<translation>احفظ تكوين OpenVPN</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="65"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="61"/>
<source>Save WireGuard config</source>
<translation>احفظ تكوين WireGuard</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="72"/>
<source>Save AmneziaWG config</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="79"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="68"/>
<source>Save ShadowSocks config</source>
<translation>احفظ تكوين ShadowSocks</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="86"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="75"/>
<source>Save Cloak config</source>
<translation>احفظ تكوين Cloak</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="111"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="100"/>
<source>For the AmneziaVPN app</source>
<translation>AmneziaVPN من اجل تطبيق</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="116"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="105"/>
<source>OpenVpn native format</source>
<translation>تنسيق OpenVpn الاصلي</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="121"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="110"/>
<source>WireGuard native format</source>
<translation>تنسيق WireGuard الاصلي</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="126"/>
<source>AmneziaWG native format</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="131"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="115"/>
<source>ShadowSocks native format</source>
<translation>تنسيق ShadowSocks الاصلي</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="136"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="120"/>
<source>Cloak native format</source>
<translation>تنسيق Cloak الاصلي</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="161"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="145"/>
<source>Share VPN Access</source>
<translation>شارك اتصال VPN</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="190"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="174"/>
<source>Share full access to the server and VPN</source>
<translation>شارك ولوج كامل للخادم و ال VPN</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="191"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="175"/>
<source>Use for your own devices, or share with those you trust to manage the server.</source>
<translation>استخدمه للأجهزة الخاصة بك، أو شاركه مع من تثق بهم لإدارة الخادم.</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="243"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="504"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="227"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="486"/>
<source>Users</source>
<translation>المستخدمين</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="263"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="247"/>
<source>Share VPN access without the ability to manage the server</source>
<translation>شارك اتصال VPN بدون القدرة علي إدارة الخادم</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="520"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="502"/>
<source>Search</source>
<translation>ابحث</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="604"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="586"/>
<source>Creation date: </source>
<translation>تاريخ الإنشاء: </translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="618"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="600"/>
<source>Rename</source>
<translation>إعادة التسمية</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="650"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="632"/>
<source>Client name</source>
<translation>اسم العميل</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="663"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="645"/>
<source>Save</source>
<translation>احفظ</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="695"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="677"/>
<source>Revoke</source>
<translation>سحب وإبطال</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="698"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="680"/>
<source>Revoke the config for a user - %1?</source>
<translation>سحب وإبطال للمستخدم - %1?</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="699"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="681"/>
<source>The user will no longer be able to connect to your server.</source>
<translation>المستخدم لن يكون قادر علي الاتصال بعد الان.</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="700"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="682"/>
<source>Continue</source>
<translation>واصل</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="701"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="683"/>
<source>Cancel</source>
<translation>إلغاء</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="232"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="216"/>
<source>Connection</source>
<translation>الاتصال</translation>
</message>
@@ -2203,13 +2120,13 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<translation type="obsolete">الخوادم</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="295"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="296"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="279"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="280"/>
<source>Server</source>
<translation>خادم</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="45"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="44"/>
<source>File with connection settings to </source>
<translation>ملف بإعدادات إلي </translation>
</message>
@@ -2218,35 +2135,35 @@ It&apos;s okay as long as it&apos;s from someone you trust.</source>
<translation type="obsolete">البروتوكولات</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="348"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="349"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="332"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="333"/>
<source>Protocol</source>
<translation>بروتوكول</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="44"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="43"/>
<source>Connection to </source>
<translation>اتصال إلي </translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="37"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="36"/>
<source>Config revoked</source>
<translation>تم سحب وإبطال التكوين</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="274"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="258"/>
<source>User name</source>
<translation>اسم المستخدم</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="449"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="450"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="431"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="432"/>
<source>Connection format</source>
<translation>تنسيق الاتصال</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageShare.qml" line="198"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="487"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="182"/>
<location filename="../ui/qml/Pages2/PageShare.qml" line="469"/>
<source>Share</source>
<translation>شارك</translation>
</message>
@@ -3076,6 +2993,11 @@ While it offers a blend of security, stability, and speed, it&apos;s essential t
</context>
<context>
<name>SettingsController</name>
<message>
<location filename="../ui/controllers/settingsController.cpp" line="31"/>
<source>Software version</source>
<translation>إصدار البرنامج</translation>
</message>
<message>
<location filename="../ui/controllers/settingsController.cpp" line="139"/>
<source>Backup file is corrupted</source>
@@ -3111,18 +3033,20 @@ While it offers a blend of security, stability, and speed, it&apos;s essential t
<translation>انسخ</translation>
</message>
<message>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="167"/>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="177"/>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="115"/>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="140"/>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="181"/>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="191"/>
<source>Copied</source>
<translation>تم النسخ</translation>
</message>
<message>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="126"/>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="133"/>
<source>Copy config string</source>
<translation>انسخ نص التكوين</translation>
</message>
<message>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="141"/>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="155"/>
<source>Show connection settings</source>
<translation>اظهر إعدادات الاتصال</translation>
</message>
@@ -3131,7 +3055,7 @@ While it offers a blend of security, stability, and speed, it&apos;s essential t
<translation type="obsolete"></translation>
</message>
<message>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="305"/>
<location filename="../ui/qml/Components/ShareConnectionDrawer.qml" line="319"/>
<source>To read the QR code in the Amnezia app, select &quot;Add server&quot; &quot;I have data to connect&quot; &quot;QR code, key or settings file&quot;</source>
<translation>حتي تقرأ رمز ال QR في تطبيق Amnezia, اختار &quot;إضافة خادم&quot; - &quot;لدي بيانات الاتصال&quot; - &quot;رمز Qr, او مفتاح تعريف او ملف إعدادات&quot;</translation>
</message>
@@ -3215,7 +3139,7 @@ While it offers a blend of security, stability, and speed, it&apos;s essential t
<context>
<name>TextFieldWithHeaderType</name>
<message>
<location filename="../ui/qml/Controls2/TextFieldWithHeaderType.qml" line="108"/>
<location filename="../ui/qml/Controls2/TextFieldWithHeaderType.qml" line="106"/>
<source>The field can&apos;t be empty</source>
<translation>الحقل لا يمكن ان يكون فارغ</translation>
</message>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -136,7 +136,8 @@ void ApiController::updateServerConfigFromApi()
auto defaultContainer = apiConfig.value(config_key::defaultContainer).toString();
serverConfig.insert(config_key::defaultContainer, defaultContainer);
m_serversModel->editServer(serverConfig, m_serversModel->getDefaultServerIndex());
m_serversModel->editServer(serverConfig);
emit m_serversModel->defaultContainerChanged(ContainerProps::containerFromString(defaultContainer));
} else {
qDebug() << reply->error();
qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
@@ -163,5 +164,5 @@ void ApiController::clearApiConfig()
serverConfig.insert(config_key::defaultContainer, ContainerProps::containerToString(DockerContainer::None));
m_serversModel->editServer(serverConfig, m_serversModel->getDefaultServerIndex());
m_serversModel->editServer(serverConfig);
}
@@ -33,7 +33,7 @@ void ConnectionController::openConnection()
int serverIndex = m_serversModel->getDefaultServerIndex();
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
DockerContainer container = qvariant_cast<DockerContainer>(m_serversModel->data(serverIndex, ServersModel::Roles::DefaultContainerRole));
DockerContainer container = m_serversModel->getDefaultContainer(serverIndex);
const QJsonObject &containerConfig = m_containersModel->getContainerConfig(container);
if (container == DockerContainer::None) {
+7 -47
View File
@@ -8,7 +8,6 @@
#include <QImage>
#include <QStandardPaths>
#include "configurators/awg_configurator.h"
#include "configurators/cloak_configurator.h"
#include "configurators/openvpn_configurator.h"
#include "configurators/shadowsocks_configurator.h"
@@ -46,7 +45,7 @@ void ExportController::generateFullAccessConfig()
{
clearPreviousConfig();
int serverIndex = m_serversModel->getProcessedServerIndex();
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
QJsonObject config = m_settings->server(serverIndex);
QJsonArray containers = config.value(config_key::containers).toArray();
@@ -100,7 +99,7 @@ void ExportController::generateConnectionConfig(const QString &clientName)
{
clearPreviousConfig();
int serverIndex = m_serversModel->getProcessedServerIndex();
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
@@ -156,7 +155,7 @@ void ExportController::generateOpenVpnConfig(const QString &clientName)
{
clearPreviousConfig();
int serverIndex = m_serversModel->getProcessedServerIndex();
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
@@ -194,7 +193,7 @@ void ExportController::generateWireGuardConfig(const QString &clientName)
{
clearPreviousConfig();
int serverIndex = m_serversModel->getProcessedServerIndex();
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
@@ -229,50 +228,11 @@ void ExportController::generateWireGuardConfig(const QString &clientName)
emit exportConfigChanged();
}
void ExportController::generateAwgConfig(const QString &clientName)
{
clearPreviousConfig();
int serverIndex = m_serversModel->getProcessedServerIndex();
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
QJsonObject containerConfig = m_containersModel->getContainerConfig(container);
containerConfig.insert(config_key::container, ContainerProps::containerToString(container));
QString clientId;
ErrorCode errorCode = ErrorCode::NoError;
QString config = m_configurator->awgConfigurator->genAwgConfig(credentials, container, containerConfig,
clientId, &errorCode);
if (errorCode) {
emit exportErrorOccurred(errorString(errorCode));
return;
}
config = m_configurator->processConfigWithExportSettings(serverIndex, container, Proto::Awg, config);
auto configJson = QJsonDocument::fromJson(config.toUtf8()).object();
QStringList lines = configJson.value(config_key::config).toString().replace("\r", "").split("\n");
for (const QString &line : lines) {
m_config.append(line + "\n");
}
qrcodegen::QrCode qr = qrcodegen::QrCode::encodeText(m_config.toUtf8(), qrcodegen::QrCode::Ecc::LOW);
m_qrCodes << svgToBase64(QString::fromStdString(toSvgString(qr, 1)));
errorCode = m_clientManagementModel->appendClient(clientId, clientName, container, credentials);
if (errorCode) {
emit exportErrorOccurred(errorString(errorCode));
return;
}
emit exportConfigChanged();
}
void ExportController::generateShadowSocksConfig()
{
clearPreviousConfig();
int serverIndex = m_serversModel->getProcessedServerIndex();
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
@@ -308,7 +268,7 @@ void ExportController::generateCloakConfig()
{
clearPreviousConfig();
int serverIndex = m_serversModel->getProcessedServerIndex();
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
@@ -368,7 +328,7 @@ void ExportController::updateClientManagementModel(const DockerContainer contain
void ExportController::revokeConfig(const int row, const DockerContainer container, ServerCredentials credentials)
{
ErrorCode errorCode = m_clientManagementModel->revokeClient(row, container, credentials,
m_serversModel->getProcessedServerIndex());
m_serversModel->getCurrentlyProcessedServerIndex());
if (errorCode != ErrorCode::NoError) {
emit exportErrorOccurred(errorString(errorCode));
}
-1
View File
@@ -34,7 +34,6 @@ public slots:
void generateConnectionConfig(const QString &clientName);
void generateOpenVpnConfig(const QString &clientName);
void generateWireGuardConfig(const QString &clientName);
void generateAwgConfig(const QString &clientName);
void generateShadowSocksConfig();
void generateCloakConfig();
+14 -14
View File
@@ -176,7 +176,7 @@ void InstallController::installServer(DockerContainer container, QJsonObject &co
void InstallController::installContainer(DockerContainer container, QJsonObject &config)
{
int serverIndex = m_serversModel->getProcessedServerIndex();
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
ServerCredentials serverCredentials =
qvariant_cast<ServerCredentials>(m_serversModel->data(serverIndex, ServersModel::Roles::CredentialsRole));
@@ -238,7 +238,7 @@ bool InstallController::isServerAlreadyExists()
void InstallController::scanServerForInstalledContainers()
{
int serverIndex = m_serversModel->getProcessedServerIndex();
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
ServerCredentials serverCredentials =
qvariant_cast<ServerCredentials>(m_serversModel->data(serverIndex, ServersModel::Roles::CredentialsRole));
@@ -267,7 +267,7 @@ void InstallController::scanServerForInstalledContainers()
void InstallController::updateContainer(QJsonObject config)
{
int serverIndex = m_serversModel->getProcessedServerIndex();
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
ServerCredentials serverCredentials =
qvariant_cast<ServerCredentials>(m_serversModel->data(serverIndex, ServersModel::Roles::CredentialsRole));
@@ -283,8 +283,8 @@ void InstallController::updateContainer(QJsonObject config)
m_serversModel->updateContainerConfig(container, config);
m_protocolModel->updateModel(config);
auto defaultContainer = qvariant_cast<DockerContainer>(m_serversModel->data(serverIndex, ServersModel::Roles::DefaultContainerRole));
if ((serverIndex == m_serversModel->getDefaultServerIndex()) && (container == defaultContainer)) {
if ((serverIndex == m_serversModel->getDefaultServerIndex())
&& (container == m_serversModel->getDefaultContainer(serverIndex))) {
emit currentContainerUpdated();
} else {
emit updateContainerFinished(tr("Settings updated successfully"));
@@ -296,27 +296,27 @@ void InstallController::updateContainer(QJsonObject config)
emit installationErrorOccurred(errorString(errorCode));
}
void InstallController::rebootProcessedServer()
void InstallController::rebootCurrentlyProcessedServer()
{
int serverIndex = m_serversModel->getProcessedServerIndex();
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
QString serverName = m_serversModel->data(serverIndex, ServersModel::Roles::NameRole).toString();
m_serversModel->rebootServer();
emit rebootProcessedServerFinished(tr("Server '%1' was rebooted").arg(serverName));
emit rebootCurrentlyProcessedServerFinished(tr("Server '%1' was rebooted").arg(serverName));
}
void InstallController::removeProcessedServer()
void InstallController::removeCurrentlyProcessedServer()
{
int serverIndex = m_serversModel->getProcessedServerIndex();
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
QString serverName = m_serversModel->data(serverIndex, ServersModel::Roles::NameRole).toString();
m_serversModel->removeServer();
emit removeProcessedServerFinished(tr("Server '%1' was removed").arg(serverName));
emit removeCurrentlyProcessedServerFinished(tr("Server '%1' was removed").arg(serverName));
}
void InstallController::removeAllContainers()
{
int serverIndex = m_serversModel->getProcessedServerIndex();
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
QString serverName = m_serversModel->data(serverIndex, ServersModel::Roles::NameRole).toString();
ErrorCode errorCode = m_serversModel->removeAllContainers();
@@ -329,7 +329,7 @@ void InstallController::removeAllContainers()
void InstallController::removeCurrentlyProcessedContainer()
{
int serverIndex = m_serversModel->getProcessedServerIndex();
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
QString serverName = m_serversModel->data(serverIndex, ServersModel::Roles::NameRole).toString();
int container = m_containersModel->getCurrentlyProcessedContainerIndex();
@@ -377,7 +377,7 @@ void InstallController::mountSftpDrive(const QString &port, const QString &passw
QString mountPath;
QString cmd;
int serverIndex = m_serversModel->getProcessedServerIndex();
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
ServerCredentials serverCredentials =
qvariant_cast<ServerCredentials>(m_serversModel->data(serverIndex, ServersModel::Roles::CredentialsRole));
QString hostname = serverCredentials.hostName;
+4 -4
View File
@@ -30,8 +30,8 @@ public slots:
void updateContainer(QJsonObject config);
void removeProcessedServer();
void rebootProcessedServer();
void removeCurrentlyProcessedServer();
void rebootCurrentlyProcessedServer();
void removeAllContainers();
void removeCurrentlyProcessedContainer();
@@ -54,8 +54,8 @@ signals:
void scanServerFinished(bool isInstalledContainerFound);
void rebootProcessedServerFinished(const QString &finishedMessage);
void removeProcessedServerFinished(const QString &finishedMessage);
void rebootCurrentlyProcessedServerFinished(const QString &finishedMessage);
void removeCurrentlyProcessedServerFinished(const QString &finishedMessage);
void removeAllContainersFinished(const QString &finishedMessage);
void removeCurrentlyProcessedContainerFinished(const QString &finishedMessage);
+1 -1
View File
@@ -28,7 +28,7 @@ SettingsController::SettingsController(const QSharedPointer<ServersModel> &serve
m_sitesModel(sitesModel),
m_settings(settings)
{
m_appVersion = QString("%1 (%2, %3)").arg(QString(APP_VERSION), __DATE__, GIT_COMMIT_HASH);
m_appVersion = QString("%1: %2 (%3)").arg(tr("Software version"), QString(APP_VERSION), __DATE__);
#ifdef Q_OS_ANDROID
if (!m_settings->isScreenshotsEnabled()) {
+111 -144
View File
@@ -5,13 +5,19 @@
ServersModel::ServersModel(std::shared_ptr<Settings> settings, QObject *parent)
: m_settings(settings), QAbstractListModel(parent)
{
connect(this, &ServersModel::defaultServerIndexChanged, this, &ServersModel::defaultServerNameChanged);
m_servers = m_settings->serversArray();
m_defaultServerIndex = m_settings->defaultServerIndex();
m_currentlyProcessedServerIndex = m_defaultServerIndex;
connect(this, &ServersModel::defaultServerIndexChanged, this, &ServersModel::defaultServerNameChanged);
connect(this, &ServersModel::defaultContainerChanged, this, &ServersModel::defaultServerDescriptionChanged);
connect(this, &ServersModel::defaultServerIndexChanged, this, [this](const int serverIndex) {
auto defaultContainer = ContainerProps::containerFromString(m_servers.at(serverIndex).toObject().value(config_key::defaultContainer).toString());
emit ServersModel::defaultServerDefaultContainerChanged(defaultContainer);
emit ServersModel::defaultServerNameChanged();
updateDefaultServerContainersModel();
emit ServersModel::defaultContainerChanged(defaultContainer);
});
connect(this, &ServersModel::currentlyProcessedServerIndexChanged, this, [this](const int serverIndex) {
auto defaultContainer = ContainerProps::containerFromString(m_servers.at(serverIndex).toObject().value(config_key::defaultContainer).toString());
emit ServersModel::defaultContainerChanged(defaultContainer);
});
}
@@ -68,14 +74,16 @@ QVariant ServersModel::data(const QModelIndex &index, int role) const
return name;
}
case ServerDescriptionRole: {
auto description = getServerDescription(server, index.row());
return configVersion ? description : description + server.value(config_key::hostName).toString();
if (configVersion) {
return server.value(config_key::description).toString();
}
return server.value(config_key::hostName).toString();
}
case HostNameRole: return server.value(config_key::hostName).toString();
case CredentialsRole: return QVariant::fromValue(serverCredentials(index.row()));
case CredentialsLoginRole: return serverCredentials(index.row()).userName;
case IsDefaultRole: return index.row() == m_defaultServerIndex;
case IsCurrentlyProcessedRole: return index.row() == m_processedServerIndex;
case IsCurrentlyProcessedRole: return index.row() == m_currentlyProcessedServerIndex;
case HasWriteAccessRole: {
auto credentials = serverCredentials(index.row());
return (!credentials.userName.isEmpty() && !credentials.secretData.isEmpty());
@@ -87,13 +95,6 @@ QVariant ServersModel::data(const QModelIndex &index, int role) const
case DefaultContainerRole: {
return ContainerProps::containerFromString(server.value(config_key::defaultContainer).toString());
}
case IsServerFromApiRole: {
return server.value(config_key::configVersion).toInt();
}
case HasAmneziaDns: {
QString primaryDns = server.value(config_key::dns1).toString();
return primaryDns == protocols::dns::amneziaDnsIp;
}
}
return QVariant();
@@ -110,9 +111,8 @@ void ServersModel::resetModel()
beginResetModel();
m_servers = m_settings->serversArray();
m_defaultServerIndex = m_settings->defaultServerIndex();
m_processedServerIndex = m_defaultServerIndex;
m_currentlyProcessedServerIndex = m_defaultServerIndex;
endResetModel();
emit defaultServerIndexChanged(m_defaultServerIndex);
}
void ServersModel::setDefaultServerIndex(const int index)
@@ -132,7 +132,12 @@ const QString ServersModel::getDefaultServerName()
return qvariant_cast<QString>(data(m_defaultServerIndex, NameRole));
}
QString ServersModel::getServerDescription(const QJsonObject &server, const int index) const
const QString ServersModel::getDefaultServerHostName()
{
return qvariant_cast<QString>(data(m_defaultServerIndex, HostNameRole));
}
QString ServersModel::getDefaultServerDescription(const QJsonObject &server)
{
const auto configVersion = server.value(config_key::configVersion).toInt();
@@ -140,12 +145,13 @@ QString ServersModel::getServerDescription(const QJsonObject &server, const int
if (configVersion) {
return server.value(config_key::description).toString();
} else if (data(index, HasWriteAccessRole).toBool()) {
if (m_isAmneziaDnsEnabled && isAmneziaDnsContainerInstalled(index)) {
} else if (isDefaultServerHasWriteAccess()) {
if (m_isAmneziaDnsEnabled
&& isAmneziaDnsContainerInstalled(m_defaultServerIndex)) {
description += "Amnezia DNS | ";
}
} else {
if (data(index, HasAmneziaDns).toBool()) {
if (isDefaultServerConfigContainsAmneziaDns()) {
description += "Amnezia DNS | ";
}
}
@@ -156,7 +162,7 @@ const QString ServersModel::getDefaultServerDescriptionCollapsed()
{
const QJsonObject server = m_servers.at(m_defaultServerIndex).toObject();
const auto configVersion = server.value(config_key::configVersion).toInt();
auto description = getServerDescription(server, m_defaultServerIndex);
auto description = getDefaultServerDescription(server);
if (configVersion) {
return description;
}
@@ -170,7 +176,7 @@ const QString ServersModel::getDefaultServerDescriptionExpanded()
{
const QJsonObject server = m_servers.at(m_defaultServerIndex).toObject();
const auto configVersion = server.value(config_key::configVersion).toInt();
auto description = getServerDescription(server, m_defaultServerIndex);
auto description = getDefaultServerDescription(server);
if (configVersion) {
return description;
}
@@ -193,21 +199,26 @@ bool ServersModel::hasServerWithWriteAccess()
return false;
}
void ServersModel::setProcessedServerIndex(const int index)
void ServersModel::setCurrentlyProcessedServerIndex(const int index)
{
m_processedServerIndex = index;
m_currentlyProcessedServerIndex = index;
updateContainersModel();
emit processedServerIndexChanged(m_processedServerIndex);
emit currentlyProcessedServerIndexChanged(m_currentlyProcessedServerIndex);
}
int ServersModel::getProcessedServerIndex()
int ServersModel::getCurrentlyProcessedServerIndex()
{
return m_processedServerIndex;
return m_currentlyProcessedServerIndex;
}
const ServerCredentials ServersModel::getProcessedServerCredentials()
QString ServersModel::getCurrentlyProcessedServerHostName()
{
return serverCredentials(m_processedServerIndex);
return qvariant_cast<QString>(data(m_currentlyProcessedServerIndex, HostNameRole));
}
const ServerCredentials ServersModel::getCurrentlyProcessedServerCredentials()
{
return serverCredentials(m_currentlyProcessedServerIndex);
}
const ServerCredentials ServersModel::getServerCredentials(const int index)
@@ -217,17 +228,12 @@ const ServerCredentials ServersModel::getServerCredentials(const int index)
bool ServersModel::isDefaultServerCurrentlyProcessed()
{
return m_defaultServerIndex == m_processedServerIndex;
return m_defaultServerIndex == m_currentlyProcessedServerIndex;
}
bool ServersModel::isDefaultServerFromApi()
bool ServersModel::isCurrentlyProcessedServerHasWriteAccess()
{
return qvariant_cast<bool>(data(m_defaultServerIndex, IsServerFromApiRole));
}
bool ServersModel::isProcessedServerHasWriteAccess()
{
return qvariant_cast<bool>(data(m_processedServerIndex, HasWriteAccessRole));
return qvariant_cast<bool>(data(m_currentlyProcessedServerIndex, HasWriteAccessRole));
}
bool ServersModel::isDefaultServerHasWriteAccess()
@@ -243,42 +249,40 @@ void ServersModel::addServer(const QJsonObject &server)
endResetModel();
}
void ServersModel::editServer(const QJsonObject &server, const int serverIndex)
void ServersModel::editServer(const QJsonObject &server)
{
m_settings->editServer(serverIndex, server);
m_servers.replace(serverIndex, m_settings->serversArray().at(serverIndex));
emit dataChanged(index(serverIndex, 0), index(serverIndex, 0));
if (serverIndex == m_defaultServerIndex) {
updateDefaultServerContainersModel();
}
m_settings->editServer(m_currentlyProcessedServerIndex, server);
m_servers.replace(m_currentlyProcessedServerIndex, m_settings->serversArray().at(m_currentlyProcessedServerIndex));
emit dataChanged(index(m_currentlyProcessedServerIndex, 0), index(m_currentlyProcessedServerIndex, 0));
updateContainersModel();
if (serverIndex == m_defaultServerIndex) {
auto defaultContainer = qvariant_cast<DockerContainer>(getDefaultServerData("defaultContainer"));
emit defaultServerDefaultContainerChanged(defaultContainer);
}
}
void ServersModel::removeServer()
{
beginResetModel();
m_settings->removeServer(m_processedServerIndex);
m_settings->removeServer(m_currentlyProcessedServerIndex);
m_servers = m_settings->serversArray();
if (m_settings->defaultServerIndex() == m_processedServerIndex) {
if (m_settings->defaultServerIndex() == m_currentlyProcessedServerIndex) {
setDefaultServerIndex(0);
} else if (m_settings->defaultServerIndex() > m_processedServerIndex) {
} else if (m_settings->defaultServerIndex() > m_currentlyProcessedServerIndex) {
setDefaultServerIndex(m_settings->defaultServerIndex() - 1);
}
if (m_settings->serversCount() == 0) {
setDefaultServerIndex(-1);
}
setProcessedServerIndex(m_defaultServerIndex);
setCurrentlyProcessedServerIndex(m_defaultServerIndex);
endResetModel();
}
bool ServersModel::isDefaultServerConfigContainsAmneziaDns()
{
const QJsonObject server = m_servers.at(m_defaultServerIndex).toObject();
QString primaryDns = server.value(config_key::dns1).toString();
return primaryDns == protocols::dns::amneziaDnsIp;
}
QHash<int, QByteArray> ServersModel::roleNames() const
{
QHash<int, QByteArray> roles;
@@ -286,8 +290,6 @@ QHash<int, QByteArray> ServersModel::roleNames() const
roles[NameRole] = "serverName";
roles[NameRole] = "name";
roles[ServerDescriptionRole] = "serverDescription";
roles[CollapsedServerDescriptionRole] = "collapsedServerDescription";
roles[ExpandedServerDescriptionRole] = "expandedServerDescription";
roles[HostNameRole] = "hostName";
@@ -302,8 +304,6 @@ QHash<int, QByteArray> ServersModel::roleNames() const
roles[ContainsAmneziaDnsRole] = "containsAmneziaDns";
roles[DefaultContainerRole] = "defaultContainer";
roles[IsServerFromApiRole] = "isServerFromApi";
return roles;
}
@@ -322,29 +322,28 @@ ServerCredentials ServersModel::serverCredentials(int index) const
void ServersModel::updateContainersModel()
{
auto containers = m_servers.at(m_processedServerIndex).toObject().value(config_key::containers).toArray();
auto containers = m_servers.at(m_currentlyProcessedServerIndex).toObject().value(config_key::containers).toArray();
emit containersUpdated(containers);
}
void ServersModel::updateDefaultServerContainersModel()
{
auto containers = m_servers.at(m_defaultServerIndex).toObject().value(config_key::containers).toArray();
emit defaultServerContainersUpdated(containers);
}
QJsonObject ServersModel::getDefaultServerConfig()
{
return m_servers.at(m_defaultServerIndex).toObject();
}
void ServersModel::reloadDefaultServerContainerConfig()
QJsonObject ServersModel::getCurrentlyProcessedServerConfig()
{
QJsonObject server = m_servers.at(m_defaultServerIndex).toObject();
return m_servers.at(m_currentlyProcessedServerIndex).toObject();
}
void ServersModel::reloadContainerConfig()
{
QJsonObject server = m_servers.at(m_currentlyProcessedServerIndex).toObject();
auto container = ContainerProps::containerFromString(server.value(config_key::defaultContainer).toString());
auto containers = server.value(config_key::containers).toArray();
auto config = m_settings->containerConfig(m_defaultServerIndex, container);
auto config = m_settings->containerConfig(m_currentlyProcessedServerIndex, container);
for (auto i = 0; i < containers.size(); i++) {
auto c = ContainerProps::containerFromString(containers.at(i).toObject().value(config_key::container).toString());
if (c == container) {
@@ -354,13 +353,13 @@ void ServersModel::reloadDefaultServerContainerConfig()
}
server.insert(config_key::containers, containers);
editServer(server, m_defaultServerIndex);
editServer(server);
}
void ServersModel::updateContainerConfig(const int containerIndex, const QJsonObject config)
{
auto container = static_cast<DockerContainer>(containerIndex);
QJsonObject server = m_servers.at(m_processedServerIndex).toObject();
QJsonObject server = m_servers.at(m_currentlyProcessedServerIndex).toObject();
auto containers = server.value(config_key::containers).toArray();
for (auto i = 0; i < containers.size(); i++) {
@@ -378,25 +377,30 @@ void ServersModel::updateContainerConfig(const int containerIndex, const QJsonOb
server.insert(config_key::defaultContainer, ContainerProps::containerToString(container));
}
editServer(server, m_processedServerIndex);
editServer(server);
}
void ServersModel::addContainerConfig(const int containerIndex, const QJsonObject config)
{
auto container = static_cast<DockerContainer>(containerIndex);
QJsonObject server = m_servers.at(m_processedServerIndex).toObject();
QJsonObject server = m_servers.at(m_currentlyProcessedServerIndex).toObject();
auto containers = server.value(config_key::containers).toArray();
containers.push_back(config);
server.insert(config_key::containers, containers);
bool isDefaultContainerChanged = false;
auto defaultContainer = server.value(config_key::defaultContainer).toString();
if ((ContainerProps::containerFromString(defaultContainer) == DockerContainer::None || ContainerProps::containerService(container) != ServiceType::Other)) {
server.insert(config_key::defaultContainer, ContainerProps::containerToString(container));
isDefaultContainerChanged = true;
}
editServer(server, m_processedServerIndex);
editServer(server);
if (isDefaultContainerChanged) {
emit defaultContainerChanged(container);
}
}
void ServersModel::setDefaultContainer(const int serverIndex, const int containerIndex)
@@ -404,12 +408,18 @@ void ServersModel::setDefaultContainer(const int serverIndex, const int containe
auto container = static_cast<DockerContainer>(containerIndex);
QJsonObject s = m_servers.at(serverIndex).toObject();
s.insert(config_key::defaultContainer, ContainerProps::containerToString(container));
editServer(s, serverIndex); //check
editServer(s); //check
emit defaultContainerChanged(container);
}
const QString ServersModel::getDefaultServerDefaultContainerName()
DockerContainer ServersModel::getDefaultContainer(const int serverIndex)
{
auto defaultContainer = qvariant_cast<DockerContainer>(getDefaultServerData("defaultContainer"));
return qvariant_cast<DockerContainer>(data(serverIndex, DefaultContainerRole));
}
const QString ServersModel::getDefaultContainerName()
{
auto defaultContainer = getDefaultContainer(m_defaultServerIndex);
return ContainerProps::containerHumanNames().value(defaultContainer);
}
@@ -417,14 +427,15 @@ ErrorCode ServersModel::removeAllContainers()
{
ServerController serverController(m_settings);
ErrorCode errorCode =
serverController.removeAllContainers(m_settings->serverCredentials(m_processedServerIndex));
serverController.removeAllContainers(m_settings->serverCredentials(m_currentlyProcessedServerIndex));
if (errorCode == ErrorCode::NoError) {
QJsonObject s = m_servers.at(m_processedServerIndex).toObject();
QJsonObject s = m_servers.at(m_currentlyProcessedServerIndex).toObject();
s.insert(config_key::containers, {});
s.insert(config_key::defaultContainer, ContainerProps::containerToString(DockerContainer::None));
editServer(s, m_processedServerIndex);
editServer(s);
emit defaultContainerChanged(DockerContainer::None);
}
return errorCode;
}
@@ -432,7 +443,7 @@ ErrorCode ServersModel::removeAllContainers()
ErrorCode ServersModel::rebootServer()
{
ServerController serverController(m_settings);
auto credentials = m_settings->serverCredentials(m_processedServerIndex);
auto credentials = m_settings->serverCredentials(m_currentlyProcessedServerIndex);
ErrorCode errorCode = serverController.rebootServer(credentials);
return errorCode;
@@ -441,13 +452,13 @@ ErrorCode ServersModel::rebootServer()
ErrorCode ServersModel::removeContainer(const int containerIndex)
{
ServerController serverController(m_settings);
auto credentials = m_settings->serverCredentials(m_processedServerIndex);
auto credentials = m_settings->serverCredentials(m_currentlyProcessedServerIndex);
auto dockerContainer = static_cast<DockerContainer>(containerIndex);
ErrorCode errorCode = serverController.removeContainer(credentials, dockerContainer);
if (errorCode == ErrorCode::NoError) {
QJsonObject server = m_servers.at(m_processedServerIndex).toObject();
QJsonObject server = m_servers.at(m_currentlyProcessedServerIndex).toObject();
auto containers = server.value(config_key::containers).toArray();
for (auto it = containers.begin(); it != containers.end(); it++) {
@@ -469,37 +480,32 @@ ErrorCode ServersModel::removeContainer(const int containerIndex)
server.insert(config_key::defaultContainer, ContainerProps::containerToString(defaultContainer));
}
editServer(server, m_processedServerIndex);
editServer(server);
emit defaultContainerChanged(defaultContainer);
}
return errorCode;
}
void ServersModel::clearCachedProfiles()
{
const auto &containers = m_settings->containers(m_processedServerIndex);
const auto &containers = m_settings->containers(m_currentlyProcessedServerIndex);
for (DockerContainer container : containers.keys()) {
m_settings->clearLastConnectionConfig(m_processedServerIndex, container);
m_settings->clearLastConnectionConfig(m_currentlyProcessedServerIndex, container);
}
m_servers.replace(m_processedServerIndex, m_settings->server(m_processedServerIndex));
if (m_processedServerIndex == m_defaultServerIndex) {
updateDefaultServerContainersModel();
}
m_servers.replace(m_currentlyProcessedServerIndex, m_settings->server(m_currentlyProcessedServerIndex));
updateContainersModel();
}
void ServersModel::clearCachedProfile(const DockerContainer container)
{
m_settings->clearLastConnectionConfig(m_processedServerIndex, container);
m_settings->clearLastConnectionConfig(m_currentlyProcessedServerIndex, container);
m_servers.replace(m_processedServerIndex, m_settings->server(m_processedServerIndex));
if (m_processedServerIndex == m_defaultServerIndex) {
updateDefaultServerContainersModel();
}
m_servers.replace(m_currentlyProcessedServerIndex, m_settings->server(m_currentlyProcessedServerIndex));
updateContainersModel();
}
bool ServersModel::isAmneziaDnsContainerInstalled(const int serverIndex) const
bool ServersModel::isAmneziaDnsContainerInstalled(const int serverIndex)
{
QJsonObject server = m_servers.at(serverIndex).toObject();
auto containers = server.value(config_key::containers).toArray();
@@ -538,6 +544,16 @@ void ServersModel::toggleAmneziaDns(bool enabled)
emit defaultServerDescriptionChanged();
}
bool ServersModel::isDefaultServerFromApi()
{
return m_settings->server(m_defaultServerIndex).value(config_key::configVersion).toInt();
}
bool ServersModel::isCurrentlyProcessedServerFromApi()
{
return m_settings->server(m_currentlyProcessedServerIndex).value(config_key::configVersion).toInt();
}
bool ServersModel::isServerFromApiAlreadyExists(const quint16 crc)
{
for (const auto &server : qAsConst(m_servers)) {
@@ -548,52 +564,3 @@ bool ServersModel::isServerFromApiAlreadyExists(const quint16 crc)
return false;
}
QVariant ServersModel::getDefaultServerData(const QString roleString)
{
auto roles = roleNames();
for (auto it = roles.begin(); it != roles.end(); it++) {
if (QString(it.value()) == roleString) {
return data(m_defaultServerIndex, it.key());
}
}
return {};
}
void ServersModel::setDefaultServerData(const QString roleString, const QVariant &value)
{
}
QVariant ServersModel::getProcessedServerData(const QString roleString)
{
auto roles = roleNames();
for (auto it = roles.begin(); it != roles.end(); it++) {
if (QString(it.value()) == roleString) {
return data(m_processedServerIndex, it.key());
}
}
return {};
}
void ServersModel::setProcessedServerData(const QString roleString, const QVariant &value)
{
}
bool ServersModel::isDefaultServerDefaultContainerHasSplitTunneling()
{
auto server = m_servers.at(m_defaultServerIndex).toObject();
auto defaultContainer = ContainerProps::containerFromString(server.value(config_key::defaultContainer).toString());
auto containerConfig = server.value(config_key::containers).toArray().at(defaultContainer).toObject();
auto protocolConfig = containerConfig.value(ContainerProps::containerTypeToString(defaultContainer)).toObject();
if (defaultContainer == DockerContainer::Awg || defaultContainer == DockerContainer::WireGuard) {
return !(protocolConfig.value(config_key::last_config).toString().contains("AllowedIPs = 0.0.0.0/0, ::/0"));
} else if (defaultContainer == DockerContainer::Cloak || defaultContainer == DockerContainer::OpenVpn || defaultContainer == DockerContainer::ShadowSocks) {
return !(protocolConfig.value(config_key::last_config).toString().contains("redirect-gateway"));
}
return false;
}
+30 -38
View File
@@ -12,8 +12,7 @@ public:
enum Roles {
NameRole = Qt::UserRole + 1,
ServerDescriptionRole,
CollapsedServerDescriptionRole,
ExpandedServerDescriptionRole,
HostNameRole,
CredentialsRole,
@@ -26,11 +25,7 @@ public:
ContainsAmneziaDnsRole,
DefaultContainerRole,
IsServerFromApiRole,
HasAmneziaDns
DefaultContainerRole
};
ServersModel(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
@@ -45,43 +40,47 @@ public:
Q_PROPERTY(int defaultIndex READ getDefaultServerIndex WRITE setDefaultServerIndex NOTIFY defaultServerIndexChanged)
Q_PROPERTY(QString defaultServerName READ getDefaultServerName NOTIFY defaultServerNameChanged)
Q_PROPERTY(QString defaultServerDefaultContainerName READ getDefaultServerDefaultContainerName NOTIFY defaultServerDefaultContainerChanged)
Q_PROPERTY(QString defaultServerDescriptionCollapsed READ getDefaultServerDescriptionCollapsed NOTIFY defaultServerDefaultContainerChanged)
Q_PROPERTY(QString defaultServerDescriptionExpanded READ getDefaultServerDescriptionExpanded NOTIFY defaultServerDefaultContainerChanged)
Q_PROPERTY(bool isDefaultServerDefaultContainerHasSplitTunneling READ isDefaultServerDefaultContainerHasSplitTunneling NOTIFY defaultServerDefaultContainerChanged)
Q_PROPERTY(bool isDefaultServerFromApi READ isDefaultServerFromApi NOTIFY defaultServerIndexChanged)
Q_PROPERTY(QString defaultServerHostName READ getDefaultServerHostName NOTIFY defaultServerIndexChanged)
Q_PROPERTY(QString defaultContainerName READ getDefaultContainerName NOTIFY defaultContainerChanged)
Q_PROPERTY(QString defaultServerDescriptionCollapsed READ getDefaultServerDescriptionCollapsed NOTIFY defaultServerDescriptionChanged)
Q_PROPERTY(QString defaultServerDescriptionExpanded READ getDefaultServerDescriptionExpanded NOTIFY defaultServerDescriptionChanged)
Q_PROPERTY(int processedIndex READ getProcessedServerIndex WRITE setProcessedServerIndex NOTIFY processedServerIndexChanged)
Q_PROPERTY(int currentlyProcessedIndex READ getCurrentlyProcessedServerIndex WRITE setCurrentlyProcessedServerIndex
NOTIFY currentlyProcessedServerIndexChanged)
public slots:
void setDefaultServerIndex(const int index);
const int getDefaultServerIndex();
const QString getDefaultServerName();
const QString getDefaultServerHostName();
const QString getDefaultServerDescriptionCollapsed();
const QString getDefaultServerDescriptionExpanded();
const QString getDefaultServerDefaultContainerName();
bool isDefaultServerCurrentlyProcessed();
bool isDefaultServerFromApi();
bool isProcessedServerHasWriteAccess();
bool isCurrentlyProcessedServerHasWriteAccess();
bool isDefaultServerHasWriteAccess();
bool hasServerWithWriteAccess();
const int getServersCount();
void setProcessedServerIndex(const int index);
int getProcessedServerIndex();
void setCurrentlyProcessedServerIndex(const int index);
int getCurrentlyProcessedServerIndex();
const ServerCredentials getProcessedServerCredentials();
QString getCurrentlyProcessedServerHostName();
const ServerCredentials getCurrentlyProcessedServerCredentials();
const ServerCredentials getServerCredentials(const int index);
void addServer(const QJsonObject &server);
void editServer(const QJsonObject &server, const int serverIndex);
void editServer(const QJsonObject &server);
void removeServer();
QJsonObject getDefaultServerConfig();
bool isDefaultServerConfigContainsAmneziaDns();
bool isAmneziaDnsContainerInstalled(const int serverIndex);
void reloadDefaultServerContainerConfig();
QJsonObject getDefaultServerConfig();
QJsonObject getCurrentlyProcessedServerConfig();
void reloadContainerConfig();
void updateContainerConfig(const int containerIndex, const QJsonObject config);
void addContainerConfig(const int containerIndex, const QJsonObject config);
@@ -93,49 +92,42 @@ public slots:
ErrorCode rebootServer();
void setDefaultContainer(const int serverIndex, const int containerIndex);
DockerContainer getDefaultContainer(const int serverIndex);
const QString getDefaultContainerName();
QStringList getAllInstalledServicesName(const int serverIndex);
void toggleAmneziaDns(bool enabled);
bool isDefaultServerFromApi();
bool isCurrentlyProcessedServerFromApi();
bool isServerFromApiAlreadyExists(const quint16 crc);
QVariant getDefaultServerData(const QString roleString);
void setDefaultServerData(const QString roleString, const QVariant &value);
QVariant getProcessedServerData(const QString roleString);
void setProcessedServerData(const QString roleString, const QVariant &value);
bool isDefaultServerDefaultContainerHasSplitTunneling();
protected:
QHash<int, QByteArray> roleNames() const override;
signals:
void processedServerIndexChanged(const int index);
void currentlyProcessedServerIndexChanged(const int index);
void defaultServerIndexChanged(const int index);
void defaultServerNameChanged();
void defaultServerDescriptionChanged();
void containersUpdated(const QJsonArray &containers);
void defaultServerContainersUpdated(const QJsonArray &containers);
void defaultServerDefaultContainerChanged(const int containerIndex);
void defaultContainerChanged(const int containerIndex);
private:
ServerCredentials serverCredentials(int index) const;
void updateContainersModel();
void updateDefaultServerContainersModel();
QString getServerDescription(const QJsonObject &server, const int index) const;
bool isAmneziaDnsContainerInstalled(const int serverIndex) const;
QString getDefaultServerDescription(const QJsonObject &server);
QJsonArray m_servers;
std::shared_ptr<Settings> m_settings;
int m_defaultServerIndex;
int m_processedServerIndex;
int m_currentlyProcessedServerIndex;
bool m_isAmneziaDnsEnabled = m_settings->useAmneziaDns();
};
-1
View File
@@ -113,7 +113,6 @@ void SitesModel::toggleSplitTunneling(bool enabled)
m_settings->setRouteMode(Settings::RouteMode::VpnAllSites);
}
m_isSplitTunnelingEnabled = enabled;
emit splitTunnelingToggled();
}
QVector<QPair<QString, QString> > SitesModel::getCurrentSites()
-2
View File
@@ -22,7 +22,6 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
Q_PROPERTY(int routeMode READ getRouteMode WRITE setRouteMode NOTIFY routeModeChanged)
Q_PROPERTY(bool isTunnelingEnabled READ isSplitTunnelingEnabled NOTIFY splitTunnelingToggled)
public slots:
bool addSite(const QString &hostname, const QString &ip);
@@ -39,7 +38,6 @@ public slots:
signals:
void routeModeChanged();
void splitTunnelingToggled();
protected:
QHash<int, QByteArray> roleNames() const override;
+1 -1
View File
@@ -138,7 +138,7 @@ Button {
}
onClicked: {
ServersModel.setProcessedServerIndex(ServersModel.defaultIndex)
ServersModel.setCurrentlyProcessedServerIndex(ServersModel.defaultIndex)
ApiController.updateServerConfigFromApi()
}
}
@@ -15,7 +15,6 @@ ListView {
id: menuContent
property var rootWidth
property var selectedText
width: rootWidth
height: menuContent.contentItem.height
@@ -52,7 +51,7 @@ ListView {
showImage: !isInstalled
checkable: isInstalled && !ConnectionController.isConnected && isSupported
checked: proxyDefaultServerContainersModel.mapToSource(index) === ServersModel.getDefaultServerData("defaultContainer")
checked: proxyContainersModel.mapToSource(index) === ServersModel.getDefaultContainer(ServersModel.defaultIndex)
onClicked: {
if (ConnectionController.isConnected && isInstalled) {
@@ -62,14 +61,14 @@ ListView {
if (checked) {
containersDropDown.close()
ServersModel.setDefaultContainer(ServersModel.defaultIndex, proxyDefaultServerContainersModel.mapToSource(index))
ServersModel.setDefaultContainer(ServersModel.defaultIndex, proxyContainersModel.mapToSource(index))
} else {
if (!isSupported && isInstalled) {
PageController.showErrorMessage(qsTr("The selected protocol is not supported on the current platform"))
return
}
ContainersModel.setCurrentlyProcessedContainerIndex(proxyDefaultServerContainersModel.mapToSource(index))
ContainersModel.setCurrentlyProcessedContainerIndex(proxyContainersModel.mapToSource(index))
InstallController.setShouldCreateServer(false)
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
containersDropDown.close()
@@ -1,92 +0,0 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import PageEnum 1.0
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
DrawerType2 {
id: root
anchors.fill: parent
expandedHeight: parent.height * 0.7
expandedContent: ColumnLayout {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
spacing: 0
Header2Type {
Layout.fillWidth: true
Layout.topMargin: 24
Layout.rightMargin: 16
Layout.leftMargin: 16
Layout.bottomMargin: 16
headerText: qsTr("Split tunneling")
descriptionText: qsTr("Allows you to connect to some sites or applications through a VPN connection and bypass others")
}
LabelWithButtonType {
Layout.fillWidth: true
Layout.topMargin: 16
visible: ServersModel.isDefaultServerDefaultContainerHasSplitTunneling && ServersModel.getDefaultServerData("isServerFromApi")
text: qsTr("Split tunneling on the server")
descriptionText: qsTr("Enabled \nCan't be disabled for current server")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
// PageController.goToPage(PageEnum.PageSettingsSplitTunneling)
// root.close()
}
}
DividerType {
visible: ServersModel.isDefaultServerDefaultContainerHasSplitTunneling && ServersModel.getDefaultServerData("isServerFromApi")
}
LabelWithButtonType {
Layout.fillWidth: true
Layout.topMargin: 16
enabled: ! ServersModel.isDefaultServerDefaultContainerHasSplitTunneling || !ServersModel.getDefaultServerData("isServerFromApi")
text: qsTr("Site-based split tunneling")
descriptionText: enabled && SitesModel.isTunnelingEnabled ? qsTr("Enabled") : qsTr("Disabled")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
PageController.goToPage(PageEnum.PageSettingsSplitTunneling)
root.close()
}
}
DividerType {
}
LabelWithButtonType {
Layout.fillWidth: true
visible: false
text: qsTr("App-based split tunneling")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
// PageController.goToPage(PageEnum.PageSetupWizardConfigSource)
root.close()
}
}
DividerType {
visible: false
}
}
}
@@ -107,6 +107,13 @@ DrawerType2 {
text: qsTr("Copy")
imageSource: "qrc:/images/controls/copy.svg"
clickedFunc: function() {
configText.selectAll()
configText.copy()
configText.select(0, 0)
PageController.showNotificationMessage(qsTr("Copied"))
}
}
BasicButtonType {
@@ -125,6 +132,13 @@ DrawerType2 {
text: qsTr("Copy config string")
imageSource: "qrc:/images/controls/copy.svg"
clickedFunc: function() {
nativeConfigString.selectAll()
nativeConfigString.copy()
nativeConfigString.select(0, 0)
PageController.showNotificationMessage(qsTr("Copied"))
}
}
BasicButtonType {
@@ -187,7 +201,7 @@ DrawerType2 {
anchors.topMargin: 16
backButtonFunction: function() {
configContentDrawer.close()
configContentDrawer.open()
}
}
+1 -18
View File
@@ -21,8 +21,6 @@ Button {
property int borderFocusedWidth: 1
property string imageSource
property string rightImageSource
property string leftImageColor: textColor
property bool squareLeftSide: false
@@ -120,7 +118,7 @@ Button {
layer {
enabled: true
effect: ColorOverlay {
color: leftImageColor
color: textColor
}
}
}
@@ -133,21 +131,6 @@ Button {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
Image {
Layout.preferredHeight: 20
Layout.preferredWidth: 20
source: root.rightImageSource
visible: root.rightImageSource === "" ? false : true
layer {
enabled: true
effect: ColorOverlay {
color: textColor
}
}
}
}
}
-1
View File
@@ -84,7 +84,6 @@ Item {
id: emptyArea
anchors.fill: parent
enabled: root.isExpanded
visible: enabled
onClicked: {
root.close()
}
@@ -25,6 +25,7 @@ Item {
property string textFieldPlaceholderText
property bool textFieldEditable: true
property bool isAutoCapitalization: true
property string borderColor: "#2C2D30"
property string borderFocusedColor: "#d7d8db"
@@ -74,8 +75,6 @@ Item {
enabled: root.textFieldEditable
color: root.enabled ? root.textFieldTextColor : root.textFieldTextDisabledColor
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhSensitiveData | Qt.ImhNoPredictiveText
placeholderText: root.textFieldPlaceholderText
placeholderTextColor: "#494B50"
@@ -85,6 +84,7 @@ Item {
font.pixelSize: 16
font.weight: 400
font.family: "PT Root UI VF"
inputMethodHints: root.isAutoCapitalization ? Qt.ImhNone : Qt.ImhNoAutoUppercase
height: 24
Layout.fillWidth: true
+26 -54
View File
@@ -34,45 +34,8 @@ PageType {
anchors.bottomMargin: drawer.collapsedHeight
ConnectButton {
id: connectButton
anchors.centerIn: parent
}
BasicButtonType {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 34
leftPadding: 16
rightPadding: 16
implicitHeight: 36
defaultColor: "transparent"
hoveredColor: Qt.rgba(1, 1, 1, 0.08)
pressedColor: Qt.rgba(1, 1, 1, 0.12)
disabledColor: "#878B91"
textColor: "#878B91"
leftImageColor: "transparent"
borderWidth: 0
property bool isSplitTunnelingEnabled: SitesModel.isTunnelingEnabled ||
(ServersModel.isDefaultServerDefaultContainerHasSplitTunneling && ServersModel.getDefaultServerData("isServerFromApi"))
text: isSplitTunnelingEnabled ? qsTr("Split tunneling enabled") : qsTr("Split tunneling disabled")
imageSource: isSplitTunnelingEnabled ? "qrc:/images/controls/split-tunneling.svg" : ""
rightImageSource: "qrc:/images/controls/chevron-down.svg"
onClicked: {
homeSplitTunnelingDrawer.open()
}
HomeSplitTunnelingDrawer {
id: homeSplitTunnelingDrawer
parent: root
}
}
}
@@ -193,7 +156,7 @@ PageType {
LabelTextType {
id: expandedServersMenuDescription
Layout.bottomMargin: ServersModel.isDefaultServerFromApi ? 69 : 24
Layout.bottomMargin: 24
Layout.fillWidth: true
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
@@ -204,9 +167,6 @@ PageType {
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
spacing: 8
visible: !ServersModel.isDefaultServerFromApi
onVisibleChanged: expandedServersMenuDescription.Layout
DropDownType {
id: containersDropDown
@@ -219,12 +179,13 @@ PageType {
rootButtonTextTopMargin: 8
rootButtonTextBottomMargin: 8
text: ServersModel.defaultServerDefaultContainerName
text: ServersModel.defaultContainerName
textColor: "#0E0E11"
headerText: qsTr("VPN protocol")
headerBackButtonImage: "qrc:/images/controls/arrow-left.svg"
rootButtonClickedFunction: function() {
ServersModel.currentlyProcessedIndex = serversMenuContent.currentIndex
containersDropDown.open()
}
@@ -236,26 +197,22 @@ PageType {
Connections {
target: ServersModel
function onDefaultServerIndexChanged() {
function onCurrentlyProcessedServerIndexChanged() {
updateContainersModelFilters()
}
}
function updateContainersModelFilters() {
if (ServersModel.isDefaultServerHasWriteAccess()) {
proxyDefaultServerContainersModel.filters = ContainersModelFilters.getWriteAccessProtocolsListFilters()
if (ServersModel.isCurrentlyProcessedServerHasWriteAccess()) {
proxyContainersModel.filters = ContainersModelFilters.getWriteAccessProtocolsListFilters()
} else {
proxyDefaultServerContainersModel.filters = ContainersModelFilters.getReadAccessProtocolsListFilters()
proxyContainersModel.filters = ContainersModelFilters.getReadAccessProtocolsListFilters()
}
}
model: SortFilterProxyModel {
id: proxyDefaultServerContainersModel
sourceModel: DefaultServerContainersModel
sorters: [
RoleSorter { roleName: "isInstalled"; sortOrder: Qt.DescendingOrder }
]
id: proxyContainersModel
sourceModel: ContainersModel
}
Component.onCompleted: updateContainersModelFilters()
@@ -348,7 +305,21 @@ PageType {
Layout.fillWidth: true
text: name
descriptionText: serverDescription
descriptionText: {
var fullDescription = ""
if (hasWriteAccess) {
if (SettingsController.isAmneziaDnsEnabled()
&& ServersModel.isAmneziaDnsContainerInstalled(index)) {
fullDescription += "Amnezia DNS | "
}
} else {
if (containsAmneziaDns) {
fullDescription += "Amnezia DNS | "
}
}
return fullDescription += serverDescription
}
checked: index === serversMenuContent.currentIndex
checkable: !ConnectionController.isConnected
@@ -363,6 +334,7 @@ PageType {
serversMenuContent.currentIndex = index
ServersModel.currentlyProcessedIndex = index
ServersModel.defaultIndex = index
}
@@ -383,7 +355,7 @@ PageType {
z: 1
onClicked: function() {
ServersModel.processedIndex = index
ServersModel.currentlyProcessedIndex = index
PageController.goToPage(PageEnum.PageSettingsServerInfo)
drawer.close()
}
@@ -44,7 +44,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
enabled: ServersModel.isProcessedServerHasWriteAccess()
enabled: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
ListView {
@@ -43,7 +43,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
enabled: ServersModel.isProcessedServerHasWriteAccess()
enabled: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
ListView {
id: listview
@@ -44,7 +44,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
enabled: ServersModel.isProcessedServerHasWriteAccess()
enabled: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
ListView {
id: listview
+1 -1
View File
@@ -175,7 +175,7 @@ PageType {
width: parent.width
visible: ServersModel.isProcessedServerHasWriteAccess()
visible: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
text: qsTr("Remove ") + ContainersModel.getCurrentlyProcessedContainerName()
textColor: "#EB5757"
@@ -43,7 +43,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
enabled: ServersModel.isProcessedServerHasWriteAccess()
enabled: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
ListView {
id: listview
@@ -49,7 +49,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
enabled: ServersModel.isProcessedServerHasWriteAccess()
enabled: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
ListView {
id: listview
@@ -88,7 +88,7 @@ PageType {
Layout.topMargin: 32
text: qsTr("Host")
descriptionText: ServersModel.getProcessedServerData("HostName")
descriptionText: ServersModel.getCurrentlyProcessedServerHostName()
descriptionOnTop: true
+1 -1
View File
@@ -175,7 +175,7 @@ PageType {
horizontalAlignment: Text.AlignHCenter
text: qsTr("Software version: %1").arg(SettingsController.getAppVersion())
text: SettingsController.getAppVersion()
color: "#878B91"
}
@@ -84,27 +84,6 @@ PageType {
visible: !GC.isMobile()
}
SwitcherType {
visible: !GC.isMobile()
Layout.fillWidth: true
Layout.margins: 16
text: qsTr("Auto connect")
descriptionText: qsTr("Connect to VPN on app start")
checked: SettingsController.isAutoConnectEnabled()
onCheckedChanged: {
if (checked !== SettingsController.isAutoConnectEnabled()) {
SettingsController.toggleAutoConnect(checked)
}
}
}
DividerType {
visible: !GC.isMobile()
}
SwitcherType {
visible: !GC.isMobile()
@@ -41,6 +41,27 @@ PageType {
headerText: qsTr("Connection")
}
SwitcherType {
visible: !GC.isMobile()
Layout.fillWidth: true
Layout.margins: 16
text: qsTr("Auto connect")
descriptionText: qsTr("Connect to VPN on app start")
checked: SettingsController.isAutoConnectEnabled()
onCheckedChanged: {
if (checked !== SettingsController.isAutoConnectEnabled()) {
SettingsController.toggleAutoConnect(checked)
}
}
}
DividerType {
visible: !GC.isMobile()
}
SwitcherType {
Layout.fillWidth: true
Layout.margins: 16
+2 -4
View File
@@ -30,12 +30,10 @@ PageType {
anchors.bottom: parent.bottom
contentHeight: content.height
property var isServerFromApi: ServersModel.getDefaultServerData("isServerFromApi")
enabled: !isServerFromApi
enabled: !ServersModel.isDefaultServerFromApi()
Component.onCompleted: {
if (isServerFromApi) {
if (ServersModel.isDefaultServerFromApi()) {
PageController.showNotificationMessage(qsTr("Default server does not support custom dns"))
}
}
@@ -28,7 +28,7 @@ PageType {
PageController.showErrorMessage(message)
}
function onRemoveProcessedServerFinished(finishedMessage) {
function onRemoveCurrentlyProcessedServerFinished(finishedMessage) {
if (!ServersModel.getServersCount()) {
PageController.replaceStartPage()
} else {
@@ -38,7 +38,7 @@ PageType {
PageController.showNotificationMessage(finishedMessage)
}
function onRebootProcessedServerFinished(finishedMessage) {
function onRebootCurrentlyProcessedServerFinished(finishedMessage) {
PageController.showNotificationMessage(finishedMessage)
}
@@ -64,8 +64,8 @@ PageType {
Connections {
target: ServersModel
function onProcessedServerIndexChanged() {
content.isServerWithWriteAccess = ServersModel.isProcessedServerHasWriteAccess()
function onCurrentlyProcessedServerIndexChanged() {
content.isServerWithWriteAccess = ServersModel.isCurrentlyProcessedServerHasWriteAccess()
}
}
@@ -82,7 +82,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
property bool isServerWithWriteAccess: ServersModel.isProcessedServerHasWriteAccess()
property bool isServerWithWriteAccess: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
LabelWithButtonType {
visible: content.isServerWithWriteAccess
@@ -149,7 +149,7 @@ PageType {
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
ConnectionController.closeConnection()
}
InstallController.rebootProcessedServer()
InstallController.rebootCurrentlyProcessedServer()
PageController.showBusyIndicator(false)
}
var noButtonFunction = function() {
@@ -180,7 +180,7 @@ PageType {
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
ConnectionController.closeConnection()
}
InstallController.removeProcessedServer()
InstallController.removeCurrentlyProcessedServer()
PageController.showBusyIndicator(false)
}
var noButtonFunction = function() {
@@ -224,7 +224,7 @@ PageType {
}
LabelWithButtonType {
visible: ServersModel.getProcessedServerData("isServerFromApi")
visible: ServersModel.isCurrentlyProcessedServerFromApi()
Layout.fillWidth: true
text: qsTr("Reset API config")
@@ -249,7 +249,7 @@ PageType {
}
DividerType {
visible: ServersModel.getProcessedServerData("isServerFromApi")
visible: ServersModel.isCurrentlyProcessedServerFromApi()
}
}
}
@@ -63,7 +63,7 @@ PageType {
headerText: name
descriptionText: {
if (ServersModel.isProcessedServerHasWriteAccess()) {
if (ServersModel.isCurrentlyProcessedServerHasWriteAccess()) {
return credentialsLogin + " · " + hostName
} else {
return hostName
@@ -107,7 +107,7 @@ PageType {
width: parent.width
visible: ServersModel.isProcessedServerHasWriteAccess()
visible: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
text: qsTr("Remove ") + ContainersModel.getCurrentlyProcessedContainerName()
textColor: "#EB5757"
@@ -38,13 +38,13 @@ PageType {
Connections {
target: ServersModel
function onProcessedServerIndexChanged() {
function onCurrentlyProcessedServerIndexChanged() {
settingsContainersListView.updateContainersModelFilters()
}
}
function updateContainersModelFilters() {
if (ServersModel.isProcessedServerHasWriteAccess()) {
if (ServersModel.isCurrentlyProcessedServerHasWriteAccess()) {
proxyContainersModel.filters = ContainersModelFilters.getWriteAccessProtocolsListFilters()
} else {
proxyContainersModel.filters = ContainersModelFilters.getReadAccessProtocolsListFilters()
@@ -38,13 +38,13 @@ PageType {
Connections {
target: ServersModel
function onProcessedServerIndexChanged() {
function onCurrentlyProcessedServerIndexChanged() {
settingsContainersListView.updateContainersModelFilters()
}
}
function updateContainersModelFilters() {
if (ServersModel.isProcessedServerHasWriteAccess()) {
if (ServersModel.isCurrentlyProcessedServerHasWriteAccess()) {
proxyContainersModel.filters = ContainersModelFilters.getWriteAccessServicesListFilters()
} else {
proxyContainersModel.filters = ContainersModelFilters.getReadAccessServicesListFilters()
@@ -55,9 +55,6 @@ PageType {
model: SortFilterProxyModel {
id: proxyContainersModel
sourceModel: ContainersModel
sorters: [
RoleSorter { roleName: "isInstalled"; sortOrder: Qt.DescendingOrder }
]
}
Component.onCompleted: updateContainersModelFilters()
@@ -87,7 +87,7 @@ PageType {
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
ServersModel.processedIndex = index
ServersModel.currentlyProcessedIndex = index
PageController.goToPage(PageEnum.PageSettingsServerInfo)
}
}
@@ -20,23 +20,15 @@ import "../Components"
PageType {
id: root
property var isServerFromApi: ServersModel.getDefaultServerData("isServerFromApi")
defaultActiveFocusItem: website_ip_field.textField
property bool pageEnabled: {
return !ConnectionController.isConnected && !isServerFromApi
return !ConnectionController.isConnected && !ServersModel.isDefaultServerFromApi()
}
Component.onCompleted: {
if (ConnectionController.isConnected) {
PageController.showNotificationMessage(qsTr("Cannot change split tunneling settings during active connection"))
root.pageEnabled = false
} else if (ServersModel.isDefaultServerDefaultContainerHasSplitTunneling && isServerFromApi) {
if (ServersModel.isDefaultServerFromApi()) {
PageController.showNotificationMessage(qsTr("Default server does not support split tunneling function"))
root.pageEnabled = false
} else {
root.pageEnabled = true
}
}
@@ -114,7 +106,7 @@ PageType {
Layout.fillWidth: true
Layout.rightMargin: 16
checked: SitesModel.isTunnelingEnabled
checked: SitesModel.isSplitTunnelingEnabled()
onToggled: {
SitesModel.toggleSplitTunneling(checked)
selector.text = root.routeModesModel[getRouteModesModelIndex()].name
@@ -69,6 +69,7 @@ PageType {
Layout.fillWidth: true
headerText: qsTr("Login to connect via SSH")
textFieldPlaceholderText: "root"
isAutoCapitalization: false
KeyNavigation.tab: secretData.textField
}
@@ -26,7 +26,7 @@ PageType {
function onInstallContainerFinished(finishedMessage, isServiceInstall) {
if (!ConnectionController.isConnected && !isServiceInstall) {
ServersModel.setDefaultContainer(ServersModel.processedIndex, ContainersModel.getCurrentlyProcessedContainerIndex())
ServersModel.setDefaultContainer(ServersModel.currentlyProcessedIndex, ContainersModel.getCurrentlyProcessedContainerIndex())
}
PageController.closePage() // close installing page
@@ -42,7 +42,7 @@ PageType {
function onInstallServerFinished(finishedMessage) {
if (!ConnectionController.isConnected) {
ServersModel.setDefaultServerIndex(ServersModel.getServersCount() - 1);
ServersModel.processedIndex = ServersModel.defaultIndex
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
}
PageController.goToStartPage()
@@ -55,7 +55,7 @@ PageType {
function onServerAlreadyExists(serverIndex) {
PageController.goToStartPage()
ServersModel.processedIndex = serverIndex
ServersModel.currentlyProcessedIndex = serverIndex
PageController.goToPage(PageEnum.PageSettingsServerInfo, false)
PageController.showErrorMessage(qsTr("The server has already been added to the application"))
@@ -30,7 +30,7 @@ PageType {
function onImportFinished() {
if (!ConnectionController.isConnected) {
ServersModel.setDefaultServerIndex(ServersModel.getServersCount() - 1);
ServersModel.processedIndex = ServersModel.defaultIndex
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
}
PageController.goToStartPage()
+7 -25
View File
@@ -22,7 +22,6 @@ PageType {
AmneziaConnection,
OpenVpn,
WireGuard,
Awg,
ShadowSocks,
Cloak
}
@@ -32,7 +31,7 @@ PageType {
PageController.showBusyIndicator(true)
ExportController.revokeConfig(index,
ContainersModel.getCurrentlyProcessedContainerIndex(),
ServersModel.getProcessedServerCredentials())
ServersModel.getCurrentlyProcessedServerCredentials())
PageController.showBusyIndicator(false)
PageController.showNotificationMessage(qsTr("Config revoked"))
}
@@ -49,10 +48,7 @@ PageType {
PageController.showBusyIndicator(true)
switch (type) {
case PageShare.ConfigType.AmneziaConnection: {
ExportController.generateConnectionConfig(clientNameTextField.textFieldText);
break;
}
case PageShare.ConfigType.AmneziaConnection: ExportController.generateConnectionConfig(clientNameTextField.textFieldText); break;
case PageShare.ConfigType.OpenVpn: {
ExportController.generateOpenVpnConfig(clientNameTextField.textFieldText)
shareConnectionDrawer.configCaption = qsTr("Save OpenVPN config")
@@ -67,13 +63,6 @@ PageType {
shareConnectionDrawer.configFileName = "amnezia_for_wireguard"
break
}
case PageShare.ConfigType.Awg: {
ExportController.generateAwgConfig(clientNameTextField.textFieldText)
shareConnectionDrawer.configCaption = qsTr("Save AmneziaWG config")
shareConnectionDrawer.configExtension = ".conf"
shareConnectionDrawer.configFileName = "amnezia_for_awg"
break
}
case PageShare.ConfigType.ShadowSocks: {
ExportController.generateShadowSocksConfig()
shareConnectionDrawer.configCaption = qsTr("Save ShadowSocks config")
@@ -121,11 +110,6 @@ PageType {
property string name: qsTr("WireGuard native format")
property var type: PageShare.ConfigType.WireGuard
}
QtObject {
id: awgConnectionFormat
property string name: qsTr("AmneziaWG native format")
property var type: PageShare.ConfigType.Awg
}
QtObject {
id: shadowSocksConnectionFormat
property string name: qsTr("ShadowSocks native format")
@@ -246,7 +230,7 @@ PageType {
accessTypeSelector.currentIndex = 1
PageController.showBusyIndicator(true)
ExportController.updateClientManagementModel(ContainersModel.getCurrentlyProcessedContainerIndex(),
ServersModel.getProcessedServerCredentials())
ServersModel.getCurrentlyProcessedServerCredentials())
PageController.showBusyIndicator(false)
}
}
@@ -331,7 +315,7 @@ PageType {
function handler() {
serverSelector.text = selectedText
ServersModel.processedIndex = proxyServersModel.mapToSource(currentIndex)
ServersModel.currentlyProcessedIndex = proxyServersModel.mapToSource(currentIndex)
}
}
}
@@ -381,7 +365,7 @@ PageType {
target: serverSelector
function onSeverSelectorIndexChanged() {
var defaultContainer = proxyContainersModel.mapFromSource(ServersModel.getProcessedServerData("defaultContainer"))
var defaultContainer = proxyContainersModel.mapFromSource(ServersModel.getDefaultContainer(ServersModel.currentlyProcessedIndex))
protocolSelectorListView.currentIndex = defaultContainer
protocolSelectorListView.triggerCurrentItem()
}
@@ -404,7 +388,7 @@ PageType {
if (accessTypeSelector.currentIndex === 1) {
PageController.showBusyIndicator(true)
ExportController.updateClientManagementModel(ContainersModel.getCurrentlyProcessedContainerIndex(),
ServersModel.getProcessedServerCredentials())
ServersModel.getCurrentlyProcessedServerCredentials())
PageController.showBusyIndicator(false)
}
}
@@ -418,8 +402,6 @@ PageType {
root.connectionTypesModel.push(openVpnConnectionFormat)
} else if (index === ContainerProps.containerFromString("amnezia-wireguard")) {
root.connectionTypesModel.push(wireGuardConnectionFormat)
} else if (index === ContainerProps.containerFromString("amnezia-awg")) {
root.connectionTypesModel.push(awgConnectionFormat)
} else if (index === ContainerProps.containerFromString("amnezia-shadowsocks")) {
root.connectionTypesModel.push(openVpnConnectionFormat)
root.connectionTypesModel.push(shadowSocksConnectionFormat)
@@ -672,7 +654,7 @@ PageType {
ExportController.renameClient(index,
clientNameEditor.textFieldText,
ContainersModel.getCurrentlyProcessedContainerIndex(),
ServersModel.getProcessedServerCredentials())
ServersModel.getCurrentlyProcessedServerCredentials())
PageController.showBusyIndicator(false)
clientNameEditDrawer.close()
}
+1 -1
View File
@@ -111,7 +111,7 @@ PageType {
function handler() {
serverSelector.text = selectedText
ServersModel.processedIndex = proxyServersModel.mapToSource(currentIndex)
ServersModel.currentlyProcessedIndex = proxyServersModel.mapToSource(currentIndex)
}
}
}
+4 -5
View File
@@ -44,7 +44,6 @@ PageType {
function onClosePage() {
tabBar.isServerInfoShow = tabBarStackView.currentItem.objectName !== PageController.getPagePath(PageEnum.PageSettingsServerInfo)
&& tabBarStackView.currentItem.objectName !== PageController.getPagePath(PageEnum.PageSettingsSplitTunneling)
if (tabBarStackView.depth <= 1) {
return
@@ -61,7 +60,7 @@ PageType {
tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.Immediate)
}
tabBar.isServerInfoShow = page === PageEnum.PageSettingsServerInfo || PageEnum.PageSettingsSplitTunneling || tabBar.isServerInfoShow
tabBar.isServerInfoShow = page === PageEnum.PageSettingsServerInfo || tabBar.isServerInfoShow
}
function onGoToStartPage() {
@@ -109,7 +108,7 @@ PageType {
function onNoInstalledContainers() {
PageController.setTriggeredBtConnectButton(true)
ServersModel.processedIndex = ServersModel.getDefaultServerIndex()
ServersModel.currentlyProcessedIndex = ServersModel.getDefaultServerIndex()
InstallController.setShouldCreateServer(false)
PageController.goToPage(PageEnum.PageSetupWizardEasy)
}
@@ -137,7 +136,7 @@ PageType {
Component.onCompleted: {
var pagePath = PageController.getPagePath(PageEnum.PageHome)
ServersModel.processedIndex = ServersModel.defaultIndex
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
tabBarStackView.push(pagePath, { "objectName" : pagePath })
}
}
@@ -181,7 +180,7 @@ PageType {
image: "qrc:/images/controls/home.svg"
onClicked: {
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
ServersModel.processedIndex = ServersModel.defaultIndex
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
tabBar.previousIndex = 0
}
}
+1 -2
View File
@@ -146,8 +146,7 @@ if [ "${MAC_CERT_PW+x}" ]; then
fi
echo "Building DMG installer..."
# Allow Terminal to make changes in Privacy & Security > App Management
hdiutil create -size 256mb -volname AmneziaVPN -srcfolder $BUILD_DIR/installer/$APP_NAME.app -ov -format UDZO $DMG_FILENAME
hdiutil create -size 120mb -volname AmneziaVPN -srcfolder $BUILD_DIR/installer/$APP_NAME.app -ov -format UDZO $DMG_FILENAME
if [ "${MAC_CERT_PW+x}" ]; then
echo "Signing DMG installer..."