Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ab4f454c19 | |||
| e96dfe5800 | |||
| 768c51dbbe | |||
| 5acbdd7af6 |
@@ -358,7 +358,7 @@ jobs:
|
|||||||
- name: 'Setup xcode'
|
- name: 'Setup xcode'
|
||||||
uses: maxim-lobanov/setup-xcode@v1
|
uses: maxim-lobanov/setup-xcode@v1
|
||||||
with:
|
with:
|
||||||
xcode-version: '16.2.0'
|
xcode-version: '15.4.0'
|
||||||
|
|
||||||
- name: 'Install Qt'
|
- name: 'Install Qt'
|
||||||
uses: jurplel/install-qt-action@v3
|
uses: jurplel/install-qt-action@v3
|
||||||
@@ -402,67 +402,6 @@ jobs:
|
|||||||
path: deploy/build/client/AmneziaVPN.app
|
path: deploy/build/client/AmneziaVPN.app
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
Build-MacOS-NE:
|
|
||||||
runs-on: macos-latest
|
|
||||||
|
|
||||||
env:
|
|
||||||
QT_VERSION: 6.8.3
|
|
||||||
|
|
||||||
MAC_TEAM_ID: ${{ secrets.MAC_TEAM_ID }}
|
|
||||||
|
|
||||||
MAC_APP_CERT_CERT: ${{ secrets.MAC_APP_CERT_CERT }}
|
|
||||||
MAC_SIGNER_ID: ${{ secrets.MAC_SIGNER_ID }}
|
|
||||||
MAC_APP_CERT_PW: ${{ secrets.MAC_APP_CERT_PW }}
|
|
||||||
|
|
||||||
PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }}
|
|
||||||
PROD_S3_ENDPOINT: ${{ secrets.PROD_S3_ENDPOINT }}
|
|
||||||
DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }}
|
|
||||||
DEV_AGW_ENDPOINT: ${{ secrets.DEV_AGW_ENDPOINT }}
|
|
||||||
DEV_S3_ENDPOINT: ${{ secrets.DEV_S3_ENDPOINT }}
|
|
||||||
FREE_V2_ENDPOINT: ${{ secrets.FREE_V2_ENDPOINT }}
|
|
||||||
PREM_V1_ENDPOINT: ${{ secrets.PREM_V1_ENDPOINT }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: 'Setup xcode'
|
|
||||||
uses: maxim-lobanov/setup-xcode@v1
|
|
||||||
with:
|
|
||||||
xcode-version: '16.2.0'
|
|
||||||
|
|
||||||
- name: 'Install Qt'
|
|
||||||
uses: jurplel/install-qt-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.QT_VERSION }}
|
|
||||||
host: 'mac'
|
|
||||||
target: 'desktop'
|
|
||||||
arch: 'clang_64'
|
|
||||||
modules: 'qtremoteobjects qt5compat qtshadertools'
|
|
||||||
dir: ${{ runner.temp }}
|
|
||||||
setup-python: 'true'
|
|
||||||
set-env: 'true'
|
|
||||||
extra: '--external 7z --base ${{ env.QT_MIRROR }}'
|
|
||||||
|
|
||||||
|
|
||||||
- name: 'Get sources'
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: 'true'
|
|
||||||
fetch-depth: 10
|
|
||||||
|
|
||||||
- name: 'Setup ccache'
|
|
||||||
uses: hendrikmuhs/ccache-action@v1.2
|
|
||||||
|
|
||||||
- name: 'Build project'
|
|
||||||
run: |
|
|
||||||
export QT_BIN_DIR="${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/macos/bin"
|
|
||||||
bash deploy/build_macos_ne.sh
|
|
||||||
|
|
||||||
- name: 'Upload unpacked artifact'
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: AmneziaVPN_MacOS_unpacked
|
|
||||||
path: deploy/build/client/AmneziaVPN.app
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
|
|
||||||
Build-Android:
|
Build-Android:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)
|
||||||
|
|
||||||
set(PROJECT AmneziaVPN)
|
set(PROJECT AmneziaVPN)
|
||||||
set(AMNEZIAVPN_VERSION 4.8.10.0)
|
set(AMNEZIAVPN_VERSION 4.8.9.2)
|
||||||
|
|
||||||
project(${PROJECT} VERSION ${AMNEZIAVPN_VERSION}
|
project(${PROJECT} VERSION ${AMNEZIAVPN_VERSION}
|
||||||
DESCRIPTION "AmneziaVPN"
|
DESCRIPTION "AmneziaVPN"
|
||||||
@@ -12,7 +12,7 @@ string(TIMESTAMP CURRENT_DATE "%Y-%m-%d")
|
|||||||
set(RELEASE_DATE "${CURRENT_DATE}")
|
set(RELEASE_DATE "${CURRENT_DATE}")
|
||||||
|
|
||||||
set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH})
|
set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH})
|
||||||
set(APP_ANDROID_VERSION_CODE 2093)
|
set(APP_ANDROID_VERSION_CODE 2092)
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
set(MZ_PLATFORM_NAME "linux")
|
set(MZ_PLATFORM_NAME "linux")
|
||||||
@@ -32,19 +32,13 @@ set(QT_BUILD_TOOLS_WHEN_CROSS_COMPILING ON)
|
|||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE AND NOT IOS)
|
||||||
if(IOS)
|
set(CMAKE_OSX_ARCHITECTURES "x86_64")
|
||||||
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
|
||||||
elseif(MACOS_NE)
|
|
||||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
|
|
||||||
else()
|
|
||||||
set(CMAKE_OSX_ARCHITECTURES "x86_64")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(client)
|
add_subdirectory(client)
|
||||||
|
|
||||||
if(NOT IOS AND NOT ANDROID AND NOT MACOS_NE)
|
if(NOT IOS AND NOT ANDROID)
|
||||||
add_subdirectory(service)
|
add_subdirectory(service)
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/deploy/installer/config.cmake)
|
include(${CMAKE_SOURCE_DIR}/deploy/installer/config.cmake)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)
|
|||||||
set(PROJECT AmneziaVPN)
|
set(PROJECT AmneziaVPN)
|
||||||
project(${PROJECT})
|
project(${PROJECT})
|
||||||
|
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER "Autogen")
|
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER "Autogen")
|
||||||
set_property(GLOBAL PROPERTY AUTOMOC_TARGETS_FOLDER "Autogen")
|
set_property(GLOBAL PROPERTY AUTOMOC_TARGETS_FOLDER "Autogen")
|
||||||
@@ -52,9 +53,6 @@ endif()
|
|||||||
|
|
||||||
qt_standard_project_setup()
|
qt_standard_project_setup()
|
||||||
qt_add_executable(${PROJECT} MANUAL_FINALIZATION)
|
qt_add_executable(${PROJECT} MANUAL_FINALIZATION)
|
||||||
target_include_directories(${PROJECT} PUBLIC
|
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
|
||||||
)
|
|
||||||
|
|
||||||
if(WIN32 OR (APPLE AND NOT IOS) OR (LINUX AND NOT ANDROID))
|
if(WIN32 OR (APPLE AND NOT IOS) OR (LINUX AND NOT ANDROID))
|
||||||
qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_interface.rep)
|
qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_interface.rep)
|
||||||
@@ -112,15 +110,6 @@ include_directories(
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MACOS_NE)
|
|
||||||
message("MACOS_NE is ON")
|
|
||||||
add_definitions(-DQ_OS_MAC)
|
|
||||||
add_definitions(-DMACOS_NE)
|
|
||||||
message("Add macros for MacOS Network Extension")
|
|
||||||
else()
|
|
||||||
message("MACOS_NE is OFF")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include_directories(mozilla)
|
include_directories(mozilla)
|
||||||
include_directories(mozilla/shared)
|
include_directories(mozilla/shared)
|
||||||
include_directories(mozilla/models)
|
include_directories(mozilla/models)
|
||||||
@@ -150,7 +139,7 @@ if(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
cmake_policy(SET CMP0099 NEW)
|
cmake_policy(SET CMP0099 OLD)
|
||||||
cmake_policy(SET CMP0114 NEW)
|
cmake_policy(SET CMP0114 NEW)
|
||||||
|
|
||||||
if(NOT BUILD_OSX_APP_IDENTIFIER)
|
if(NOT BUILD_OSX_APP_IDENTIFIER)
|
||||||
@@ -169,6 +158,7 @@ if(APPLE)
|
|||||||
set(CMAKE_XCODE_GENERATE_SCHEME FALSE)
|
set(CMAKE_XCODE_GENERATE_SCHEME FALSE)
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM ${BUILD_VPN_DEVELOPMENT_TEAM})
|
set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM ${BUILD_VPN_DEVELOPMENT_TEAM})
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_GROUP_ID_IOS ${BUILD_IOS_GROUP_IDENTIFIER})
|
set(CMAKE_XCODE_ATTRIBUTE_GROUP_ID_IOS ${BUILD_IOS_GROUP_IDENTIFIER})
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(LINUX AND NOT ANDROID)
|
if(LINUX AND NOT ANDROID)
|
||||||
@@ -176,7 +166,8 @@ if(LINUX AND NOT ANDROID)
|
|||||||
link_directories(${CMAKE_CURRENT_LIST_DIR}/platforms/linux)
|
link_directories(${CMAKE_CURRENT_LIST_DIR}/platforms/linux)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32 OR (APPLE AND NOT IOS AND NOT MACOS_NE) OR (LINUX AND NOT ANDROID))
|
if(WIN32 OR (APPLE AND NOT IOS) OR (LINUX AND NOT ANDROID))
|
||||||
|
message("Client desktop build")
|
||||||
add_compile_definitions(AMNEZIA_DESKTOP)
|
add_compile_definitions(AMNEZIA_DESKTOP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -187,9 +178,7 @@ endif()
|
|||||||
if(IOS)
|
if(IOS)
|
||||||
include(cmake/ios.cmake)
|
include(cmake/ios.cmake)
|
||||||
include(cmake/ios-arch-fixup.cmake)
|
include(cmake/ios-arch-fixup.cmake)
|
||||||
elseif(APPLE AND MACOS_NE)
|
elseif(APPLE AND NOT IOS)
|
||||||
include(cmake/macos_ne.cmake)
|
|
||||||
elseif(APPLE)
|
|
||||||
include(cmake/osxtools.cmake)
|
include(cmake/osxtools.cmake)
|
||||||
include(cmake/macos.cmake)
|
include(cmake/macos.cmake)
|
||||||
endif()
|
endif()
|
||||||
@@ -210,7 +199,7 @@ elseif(APPLE AND NOT IOS)
|
|||||||
set(DEPLOY_PLATFORM_PATH "macos")
|
set(DEPLOY_PLATFORM_PATH "macos")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT IOS AND NOT ANDROID AND NOT MACOS_NE)
|
if(NOT IOS AND NOT ANDROID)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${PROJECT} POST_BUILD
|
TARGET ${PROJECT} POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E $<IF:$<CONFIG:Debug>,copy_directory,true>
|
COMMAND ${CMAKE_COMMAND} -E $<IF:$<CONFIG:Debug>,copy_directory,true>
|
||||||
@@ -225,6 +214,7 @@ if(NOT IOS AND NOT ANDROID AND NOT MACOS_NE)
|
|||||||
$<TARGET_FILE_DIR:${PROJECT}>
|
$<TARGET_FILE_DIR:${PROJECT}>
|
||||||
COMMAND_EXPAND_LISTS
|
COMMAND_EXPAND_LISTS
|
||||||
)
|
)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_sources(${PROJECT} PRIVATE ${SOURCES} ${HEADERS} ${RESOURCES} ${QRC} ${I18NQRC})
|
target_sources(${PROJECT} PRIVATE ${SOURCES} ${HEADERS} ${RESOURCES} ${QRC} ${I18NQRC})
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QEvent>
|
|
||||||
|
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "ui/controllers/pageController.h"
|
#include "ui/controllers/pageController.h"
|
||||||
@@ -22,8 +21,6 @@
|
|||||||
#include "platforms/ios/QRCodeReaderBase.h"
|
#include "platforms/ios/QRCodeReaderBase.h"
|
||||||
|
|
||||||
#include "protocols/qml_register_protocols.h"
|
#include "protocols/qml_register_protocols.h"
|
||||||
#include <QtQuick/QQuickWindow> // for QQuickWindow
|
|
||||||
#include <QWindow> // for qobject_cast<QWindow*>
|
|
||||||
|
|
||||||
AmneziaApplication::AmneziaApplication(int &argc, char *argv[]) : AMNEZIA_BASE_CLASS(argc, argv)
|
AmneziaApplication::AmneziaApplication(int &argc, char *argv[]) : AMNEZIA_BASE_CLASS(argc, argv)
|
||||||
{
|
{
|
||||||
@@ -51,17 +48,8 @@ AmneziaApplication::AmneziaApplication(int &argc, char *argv[]) : AMNEZIA_BASE_C
|
|||||||
|
|
||||||
AmneziaApplication::~AmneziaApplication()
|
AmneziaApplication::~AmneziaApplication()
|
||||||
{
|
{
|
||||||
if (m_vpnConnection) {
|
|
||||||
QMetaObject::invokeMethod(m_vpnConnection.get(), "disconnectFromVpn", Qt::QueuedConnection);
|
|
||||||
QMetaObject::invokeMethod(m_vpnConnection.get(), "deleteLater", Qt::QueuedConnection);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_vpnConnectionThread.quit();
|
m_vpnConnectionThread.quit();
|
||||||
|
m_vpnConnectionThread.wait(3000);
|
||||||
if (!m_vpnConnectionThread.wait(5000)) {
|
|
||||||
m_vpnConnectionThread.terminate();
|
|
||||||
m_vpnConnectionThread.wait();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_engine) {
|
if (m_engine) {
|
||||||
QObject::disconnect(m_engine, 0, 0, 0);
|
QObject::disconnect(m_engine, 0, 0, 0);
|
||||||
@@ -75,28 +63,15 @@ void AmneziaApplication::init()
|
|||||||
|
|
||||||
const QUrl url(QStringLiteral("qrc:/ui/qml/main2.qml"));
|
const QUrl url(QStringLiteral("qrc:/ui/qml/main2.qml"));
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
m_engine, &QQmlApplicationEngine::objectCreated, this,
|
m_engine, &QQmlApplicationEngine::objectCreated, this,
|
||||||
[this, url](QObject *obj, const QUrl &objUrl) {
|
[url](QObject *obj, const QUrl &objUrl) {
|
||||||
if (!obj && url == objUrl) {
|
if (!obj && url == objUrl)
|
||||||
QCoreApplication::exit(-1);
|
QCoreApplication::exit(-1);
|
||||||
return;
|
},
|
||||||
}
|
Qt::QueuedConnection);
|
||||||
// install filter on main window
|
|
||||||
if (auto win = qobject_cast<QQuickWindow*>(obj)) {
|
|
||||||
win->installEventFilter(this);
|
|
||||||
win->show();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Qt::QueuedConnection);
|
|
||||||
|
|
||||||
m_engine->rootContext()->setContextProperty("Debug", &Logger::Instance());
|
m_engine->rootContext()->setContextProperty("Debug", &Logger::Instance());
|
||||||
|
|
||||||
#ifdef MACOS_NE
|
|
||||||
m_engine->rootContext()->setContextProperty("IsMacOsNeBuild", true);
|
|
||||||
#else
|
|
||||||
m_engine->rootContext()->setContextProperty("IsMacOsNeBuild", false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_vpnConnection.reset(new VpnConnection(m_settings));
|
m_vpnConnection.reset(new VpnConnection(m_settings));
|
||||||
m_vpnConnection->moveToThread(&m_vpnConnectionThread);
|
m_vpnConnection->moveToThread(&m_vpnConnectionThread);
|
||||||
m_vpnConnectionThread.start();
|
m_vpnConnectionThread.start();
|
||||||
@@ -192,7 +167,7 @@ bool AmneziaApplication::parseCommands()
|
|||||||
|
|
||||||
QCommandLineOption c_cleanup { { "c", "cleanup" }, "Cleanup logs" };
|
QCommandLineOption c_cleanup { { "c", "cleanup" }, "Cleanup logs" };
|
||||||
m_parser.addOption(c_cleanup);
|
m_parser.addOption(c_cleanup);
|
||||||
|
|
||||||
m_parser.process(*this);
|
m_parser.process(*this);
|
||||||
|
|
||||||
if (m_parser.isSet(c_cleanup)) {
|
if (m_parser.isSet(c_cleanup)) {
|
||||||
@@ -204,8 +179,9 @@ bool AmneziaApplication::parseCommands()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
||||||
void AmneziaApplication::startLocalServer() {
|
void AmneziaApplication::startLocalServer()
|
||||||
|
{
|
||||||
const QString serverName("AmneziaVPNInstance");
|
const QString serverName("AmneziaVPNInstance");
|
||||||
QLocalServer::removeServer(serverName);
|
QLocalServer::removeServer(serverName);
|
||||||
|
|
||||||
@@ -222,22 +198,6 @@ void AmneziaApplication::startLocalServer() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool AmneziaApplication::eventFilter(QObject *watched, QEvent *event)
|
|
||||||
{
|
|
||||||
if (event->type() == QEvent::Close) {
|
|
||||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
|
||||||
quit();
|
|
||||||
#else
|
|
||||||
if (m_coreController && m_coreController->pageController()) {
|
|
||||||
m_coreController->pageController()->hideMainWindow();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return true; // eat the close
|
|
||||||
}
|
|
||||||
// call base QObject::eventFilter
|
|
||||||
return QObject::eventFilter(watched, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
QQmlApplicationEngine *AmneziaApplication::qmlEngine() const
|
QQmlApplicationEngine *AmneziaApplication::qmlEngine() const
|
||||||
{
|
{
|
||||||
return m_engine;
|
return m_engine;
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#else
|
#else
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#endif
|
#endif
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
#define amnApp (static_cast<AmneziaApplication *>(QCoreApplication::instance()))
|
#define amnApp (static_cast<AmneziaApplication *>(QCoreApplication::instance()))
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||||
#define AMNEZIA_BASE_CLASS QGuiApplication
|
#define AMNEZIA_BASE_CLASS QGuiApplication
|
||||||
#else
|
#else
|
||||||
#define AMNEZIA_BASE_CLASS QApplication
|
#define AMNEZIA_BASE_CLASS QApplication
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class AmneziaApplication : public AMNEZIA_BASE_CLASS
|
class AmneziaApplication : public AMNEZIA_BASE_CLASS
|
||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
void loadFonts();
|
void loadFonts();
|
||||||
bool parseCommands();
|
bool parseCommands();
|
||||||
|
|
||||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
||||||
void startLocalServer();
|
void startLocalServer();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -60,8 +60,6 @@ private:
|
|||||||
QThread m_vpnConnectionThread;
|
QThread m_vpnConnectionThread;
|
||||||
|
|
||||||
QNetworkAccessManager *m_nam;
|
QNetworkAccessManager *m_nam;
|
||||||
protected:
|
|
||||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AMNEZIA_APPLICATION_H
|
#endif // AMNEZIA_APPLICATION_H
|
||||||
|
|||||||
@@ -27,15 +27,9 @@ if(WIN32)
|
|||||||
set(OPENSSL_LIB_CRYPTO_PATH "${OPENSSL_ROOT_DIR}/windows/win32/libcrypto.lib")
|
set(OPENSSL_LIB_CRYPTO_PATH "${OPENSSL_ROOT_DIR}/windows/win32/libcrypto.lib")
|
||||||
endif()
|
endif()
|
||||||
elseif(APPLE AND NOT IOS)
|
elseif(APPLE AND NOT IOS)
|
||||||
if(MACOS_NE)
|
set(LIBSSH_LIB_PATH "${LIBSSH_ROOT_DIR}/macos/x86_64/libssh.a")
|
||||||
set(LIBSSH_LIB_PATH "${LIBSSH_ROOT_DIR}/macos/universal2/libssh.a")
|
set(ZLIB_LIB_PATH "${LIBSSH_ROOT_DIR}/macos/x86_64/libz.a")
|
||||||
set(ZLIB_LIB_PATH "${LIBSSH_ROOT_DIR}/macos/universal2/libz.a")
|
set(LIBSSH_INCLUDE_DIR "${LIBSSH_ROOT_DIR}/macos/x86_64")
|
||||||
set(LIBSSH_INCLUDE_DIR "${LIBSSH_ROOT_DIR}/macos/universal2")
|
|
||||||
else()
|
|
||||||
set(LIBSSH_LIB_PATH "${LIBSSH_ROOT_DIR}/macos/x86_64/libssh.a")
|
|
||||||
set(ZLIB_LIB_PATH "${LIBSSH_ROOT_DIR}/macos/x86_64/libz.a")
|
|
||||||
set(LIBSSH_INCLUDE_DIR "${LIBSSH_ROOT_DIR}/macos/x86_64")
|
|
||||||
endif()
|
|
||||||
set(OPENSSL_INCLUDE_DIR "${OPENSSL_ROOT_DIR}/macos/include")
|
set(OPENSSL_INCLUDE_DIR "${OPENSSL_ROOT_DIR}/macos/include")
|
||||||
set(OPENSSL_LIB_SSL_PATH "${OPENSSL_ROOT_DIR}/macos/lib/libssl.a")
|
set(OPENSSL_LIB_SSL_PATH "${OPENSSL_ROOT_DIR}/macos/lib/libssl.a")
|
||||||
set(OPENSSL_LIB_CRYPTO_PATH "${OPENSSL_ROOT_DIR}/macos/lib/libcrypto.a")
|
set(OPENSSL_LIB_CRYPTO_PATH "${OPENSSL_ROOT_DIR}/macos/lib/libcrypto.a")
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ set(LIBS ${LIBS}
|
|||||||
${FW_SECURITY}
|
${FW_SECURITY}
|
||||||
${FW_COREWLAN}
|
${FW_COREWLAN}
|
||||||
${FW_NETWORK}
|
${FW_NETWORK}
|
||||||
${FW_USER_NOTIFICATIONS}
|
${FW_USERNOTIFICATIONS}
|
||||||
${FW_NETWORK_EXTENSION}
|
${FW_NETWORK_EXTENSION}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -35,8 +35,6 @@ set(SOURCES ${SOURCES}
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/ui/macos_util.mm
|
${CMAKE_CURRENT_SOURCE_DIR}/ui/macos_util.mm
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set(ICON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/images/app.icns)
|
set(ICON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/images/app.icns)
|
||||||
set(MACOSX_BUNDLE_ICON_FILE app.icns)
|
set(MACOSX_BUNDLE_ICON_FILE app.icns)
|
||||||
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||||
@@ -55,3 +53,4 @@ execute_process(
|
|||||||
)
|
)
|
||||||
message("OSX_SDK_PATH is: ${OSX_SDK_PATH}")
|
message("OSX_SDK_PATH is: ${OSX_SDK_PATH}")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,168 +0,0 @@
|
|||||||
message("Client ==> MacOS NE build")
|
|
||||||
|
|
||||||
set_target_properties(${PROJECT} PROPERTIES MACOSX_BUNDLE TRUE)
|
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
|
|
||||||
|
|
||||||
set(APPLE_PROJECT_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH})
|
|
||||||
|
|
||||||
enable_language(OBJC)
|
|
||||||
enable_language(Swift)
|
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS ShaderTools Widgets)
|
|
||||||
# Link Qt Widgets for QWidget, QMenu, QAction etc.
|
|
||||||
set(LIBS ${LIBS} Qt6::ShaderTools Qt6::Widgets)
|
|
||||||
|
|
||||||
find_library(FW_AUTHENTICATIONSERVICES AuthenticationServices)
|
|
||||||
find_library(FW_AVFOUNDATION AVFoundation)
|
|
||||||
find_library(FW_FOUNDATION Foundation)
|
|
||||||
find_library(FW_STOREKIT StoreKit)
|
|
||||||
find_library(FW_SERVICEMGMT ServiceManagement)
|
|
||||||
find_library(FW_USERNOTIFICATIONS UserNotifications)
|
|
||||||
find_library(FW_NETWORKEXTENSION NetworkExtension)
|
|
||||||
|
|
||||||
set(LIBS ${LIBS}
|
|
||||||
${FW_AUTHENTICATIONSERVICES}
|
|
||||||
${FW_AVFOUNDATION}
|
|
||||||
${FW_FOUNDATION}
|
|
||||||
${FW_STOREKIT}
|
|
||||||
${FW_SERVICEMGMT}
|
|
||||||
${FW_USERNOTIFICATIONS}
|
|
||||||
${FW_NETWORKEXTENSION}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
set(HEADERS ${HEADERS}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/ios_controller.h
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/ios_controller_wrapper.h
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/iosnotificationhandler.h
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/QtAppDelegate.h
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/QtAppDelegate-C-Interface.h
|
|
||||||
)
|
|
||||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/ios_controller.h PROPERTIES OBJECTIVE_CPP_HEADER TRUE)
|
|
||||||
|
|
||||||
|
|
||||||
set(SOURCES ${SOURCES}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/ios_controller.mm
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/ios_controller_wrapper.mm
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/iosnotificationhandler.mm
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/iosglue.mm
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/QRCodeReaderBase.mm
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/QtAppDelegate.mm
|
|
||||||
)
|
|
||||||
|
|
||||||
set(ICON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/images/app.icns)
|
|
||||||
set(MACOSX_BUNDLE_ICON_FILE app.icns)
|
|
||||||
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
|
||||||
set(SOURCES ${SOURCES} ${ICON_FILE})
|
|
||||||
|
|
||||||
|
|
||||||
target_include_directories(${PROJECT} PRIVATE
|
|
||||||
${Qt6Gui_PRIVATE_INCLUDE_DIRS}
|
|
||||||
${Qt6Widgets_PRIVATE_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
set_target_properties(${PROJECT} PROPERTIES
|
|
||||||
XCODE_LINK_BUILD_PHASE_MODE KNOWN_LOCATION
|
|
||||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macos/app/Info.plist.in
|
|
||||||
MACOSX_BUNDLE_ICON_FILE "AppIcon"
|
|
||||||
MACOSX_BUNDLE_INFO_STRING "AmneziaVPN"
|
|
||||||
MACOSX_BUNDLE_BUNDLE_NAME "AmneziaVPN"
|
|
||||||
MACOSX_BUNDLE_BUNDLE_VERSION "${CMAKE_PROJECT_VERSION_TWEAK}"
|
|
||||||
MACOSX_BUNDLE_LONG_VERSION_STRING "${APPLE_PROJECT_VERSION}-${CMAKE_PROJECT_VERSION_TWEAK}"
|
|
||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING "${APPLE_PROJECT_VERSION}"
|
|
||||||
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${BUILD_IOS_APP_IDENTIFIER}"
|
|
||||||
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/macos/app/app.entitlements"
|
|
||||||
XCODE_ATTRIBUTE_MARKETING_VERSION "${APPLE_PROJECT_VERSION}"
|
|
||||||
XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION "${CMAKE_PROJECT_VERSION_TWEAK}"
|
|
||||||
XCODE_ATTRIBUTE_PRODUCT_NAME "AmneziaVPN"
|
|
||||||
XCODE_ATTRIBUTE_BUNDLE_INFO_STRING "AmneziaVPN"
|
|
||||||
XCODE_GENERATE_SCHEME TRUE
|
|
||||||
XCODE_ATTRIBUTE_ENABLE_BITCODE "NO"
|
|
||||||
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon"
|
|
||||||
XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2"
|
|
||||||
XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY "NO"
|
|
||||||
XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY "YES"
|
|
||||||
XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET "11.0"
|
|
||||||
|
|
||||||
XCODE_LINK_BUILD_PHASE_MODE KNOWN_LOCATION
|
|
||||||
XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks"
|
|
||||||
XCODE_EMBED_APP_EXTENSIONS AmneziaVPNNetworkExtension
|
|
||||||
)
|
|
||||||
|
|
||||||
if(DEPLOY)
|
|
||||||
set_target_properties(${PROJECT} PROPERTIES
|
|
||||||
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Apple Distribution"
|
|
||||||
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY[variant=Debug] "Apple Development"
|
|
||||||
XCODE_ATTRIBUTE_CODE_SIGN_STYLE Manual
|
|
||||||
XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER "distr macos.org.amnezia.AmneziaVPN"
|
|
||||||
XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER[variant=Debug] "dev macos.org.amnezia.AmneziaVPN"
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
set_target_properties(${PROJECT} PROPERTIES
|
|
||||||
XCODE_ATTRIBUTE_CODE_SIGN_STYLE Automatic
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_target_properties(${PROJECT} PROPERTIES
|
|
||||||
XCODE_ATTRIBUTE_SWIFT_VERSION "5.0"
|
|
||||||
XCODE_ATTRIBUTE_CLANG_ENABLE_MODULES "YES"
|
|
||||||
XCODE_ATTRIBUTE_SWIFT_PRECOMPILE_BRIDGING_HEADER "NO"
|
|
||||||
XCODE_ATTRIBUTE_SWIFT_OBJC_INTERFACE_HEADER_NAME "AmneziaVPN-Swift.h"
|
|
||||||
XCODE_ATTRIBUTE_SWIFT_OBJC_INTEROP_MODE "objcxx"
|
|
||||||
)
|
|
||||||
set_target_properties(${PROJECT} PROPERTIES
|
|
||||||
XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "X7UJ388FXK"
|
|
||||||
)
|
|
||||||
target_include_directories(${PROJECT} PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
|
||||||
target_compile_options(${PROJECT} PRIVATE
|
|
||||||
-DGROUP_ID=\"${BUILD_IOS_GROUP_IDENTIFIER}\"
|
|
||||||
-DVPN_NE_BUNDLEID=\"${BUILD_IOS_APP_IDENTIFIER}.network-extension\"
|
|
||||||
)
|
|
||||||
|
|
||||||
set(WG_APPLE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rd/amneziawg-apple/Sources)
|
|
||||||
|
|
||||||
target_sources(${PROJECT} PRIVATE
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardKitC/x25519.c
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/LogController.swift
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/Log.swift
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/LogRecord.swift
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/ScreenProtection.swift
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/VPNCController.swift
|
|
||||||
)
|
|
||||||
|
|
||||||
target_sources(${PROJECT} PRIVATE
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/macos/app/Images.xcassets
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ios/app/PrivacyInfo.xcprivacy
|
|
||||||
)
|
|
||||||
|
|
||||||
set_property(TARGET ${PROJECT} APPEND PROPERTY RESOURCE
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/macos/app/Images.xcassets
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ios/app/PrivacyInfo.xcprivacy
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(macos/networkextension)
|
|
||||||
add_dependencies(${PROJECT} AmneziaVPNNetworkExtension)
|
|
||||||
|
|
||||||
get_target_property(QtCore_location Qt6::Core LOCATION)
|
|
||||||
message("QtCore_location")
|
|
||||||
message(${QtCore_location})
|
|
||||||
|
|
||||||
get_filename_component(QT_BIN_DIR_DETECTED "${QtCore_location}/../../../../../bin" ABSOLUTE)
|
|
||||||
|
|
||||||
set_property(TARGET ${PROJECT} PROPERTY XCODE_EMBED_FRAMEWORKS
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/3rd-prebuilt/3rd-prebuilt/openvpn/apple/OpenVPNAdapter-macos/OpenVPNAdapter.framework"
|
|
||||||
)
|
|
||||||
|
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/3rd-prebuilt/3rd-prebuilt/openvpn/apple/OpenVPNAdapter-macos)
|
|
||||||
target_link_libraries("AmneziaVPNNetworkExtension" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/3rd-prebuilt/3rd-prebuilt/openvpn/apple/OpenVPNAdapter-macos/OpenVPNAdapter.framework")
|
|
||||||
|
|
||||||
add_custom_command(TARGET ${PROJECT} POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory
|
|
||||||
$<TARGET_BUNDLE_DIR:AmneziaVPN>/Contents/Frameworks
|
|
||||||
COMMAND /usr/bin/find "$<TARGET_BUNDLE_DIR:AmneziaVPN>/Contents/Frameworks/OpenVPNAdapter.framework" -name "*.sha256" -delete
|
|
||||||
COMMAND /usr/bin/codesign --force --sign "Apple Distribution"
|
|
||||||
"$<TARGET_BUNDLE_DIR:AmneziaVPN>/Contents/Frameworks/OpenVPNAdapter.framework/Versions/Current/OpenVPNAdapter"
|
|
||||||
COMMAND ${QT_BIN_DIR_DETECTED}/macdeployqt $<TARGET_BUNDLE_DIR:AmneziaVPN> -appstore-compliant -qmldir=${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
COMMENT "Signing OpenVPNAdapter framework"
|
|
||||||
)
|
|
||||||
@@ -39,7 +39,7 @@ set(HEADERS ${HEADERS}
|
|||||||
${CLIENT_ROOT_DIR}/mozilla/localsocketcontroller.h
|
${CLIENT_ROOT_DIR}/mozilla/localsocketcontroller.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT IOS AND NOT MACOS_NE)
|
if(NOT IOS)
|
||||||
set(HEADERS ${HEADERS}
|
set(HEADERS ${HEADERS}
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/QRCodeReaderBase.h
|
${CLIENT_ROOT_DIR}/platforms/ios/QRCodeReaderBase.h
|
||||||
)
|
)
|
||||||
@@ -89,26 +89,12 @@ set(SOURCES ${SOURCES}
|
|||||||
${CLIENT_ROOT_DIR}/mozilla/localsocketcontroller.cpp
|
${CLIENT_ROOT_DIR}/mozilla/localsocketcontroller.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT IOS AND NOT MACOS_NE)
|
if(NOT IOS)
|
||||||
set(SOURCES ${SOURCES}
|
set(SOURCES ${SOURCES}
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/QRCodeReaderBase.cpp
|
${CLIENT_ROOT_DIR}/platforms/ios/QRCodeReaderBase.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Include native macOS platform helpers (dock/status-item)
|
|
||||||
if(APPLE AND NOT IOS)
|
|
||||||
list(APPEND HEADERS
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/macos/macosutils.h
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/macos/macosstatusicon.h
|
|
||||||
${CLIENT_ROOT_DIR}/ui/macos_util.h
|
|
||||||
)
|
|
||||||
list(APPEND SOURCES
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/macos/macosutils.mm
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/macos/macosstatusicon.mm
|
|
||||||
${CLIENT_ROOT_DIR}/ui/macos_util.mm
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT ANDROID)
|
if(NOT ANDROID)
|
||||||
set(SOURCES ${SOURCES}
|
set(SOURCES ${SOURCES}
|
||||||
${CLIENT_ROOT_DIR}/ui/notificationhandler.cpp
|
${CLIENT_ROOT_DIR}/ui/notificationhandler.cpp
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ QString OpenVpnConfigurator::processConfigWithLocalSettings(const QPair<QString,
|
|||||||
|
|
||||||
// no redirect-gateway
|
// no redirect-gateway
|
||||||
} else if (m_settings->routeMode() == Settings::VpnAllExceptSites) {
|
} else if (m_settings->routeMode() == Settings::VpnAllExceptSites) {
|
||||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
||||||
config.append("\nredirect-gateway ipv6 !ipv4 bypass-dhcp\n");
|
config.append("\nredirect-gateway ipv6 !ipv4 bypass-dhcp\n");
|
||||||
// Prevent ipv6 leak
|
// Prevent ipv6 leak
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(MACOS_NE)
|
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#else
|
#else
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@@ -24,7 +24,7 @@ SshConfigurator::SshConfigurator(std::shared_ptr<Settings> settings, const QShar
|
|||||||
|
|
||||||
QString SshConfigurator::convertOpenSShKey(const QString &key)
|
QString SshConfigurator::convertOpenSShKey(const QString &key)
|
||||||
{
|
{
|
||||||
#if !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
#ifndef Q_OS_IOS
|
||||||
QProcess p;
|
QProcess p;
|
||||||
p.setProcessChannelMode(QProcess::MergedChannels);
|
p.setProcessChannelMode(QProcess::MergedChannels);
|
||||||
|
|
||||||
@@ -67,10 +67,9 @@ QString SshConfigurator::convertOpenSShKey(const QString &key)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEAD CODE.
|
|
||||||
void SshConfigurator::openSshTerminal(const ServerCredentials &credentials)
|
void SshConfigurator::openSshTerminal(const ServerCredentials &credentials)
|
||||||
{
|
{
|
||||||
#if !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
#ifndef Q_OS_IOS
|
||||||
QProcess *p = new QProcess();
|
QProcess *p = new QProcess();
|
||||||
p->setProcessChannelMode(QProcess::SeparateChannels);
|
p->setProcessChannelMode(QProcess::SeparateChannels);
|
||||||
|
|
||||||
@@ -102,7 +101,7 @@ QProcessEnvironment SshConfigurator::prepareEnv()
|
|||||||
pathEnvVar.clear();
|
pathEnvVar.clear();
|
||||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\cygwin;");
|
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\cygwin;");
|
||||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\openvpn;");
|
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\openvpn;");
|
||||||
#elif defined(Q_OS_MACX) && !defined(MACOS_NE)
|
#elif defined(Q_OS_MACX)
|
||||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "/Contents/MacOS");
|
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "/Contents/MacOS");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,6 @@ bool ContainerProps::isSupportedByCurrentPlatform(DockerContainer c)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
#elif defined(Q_OS_IOS)
|
#elif defined(Q_OS_IOS)
|
||||||
// Standard iOS build (without Network Extension limitations)
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case DockerContainer::WireGuard: return true;
|
case DockerContainer::WireGuard: return true;
|
||||||
case DockerContainer::OpenVpn: return true;
|
case DockerContainer::OpenVpn: return true;
|
||||||
@@ -270,23 +269,7 @@ bool ContainerProps::isSupportedByCurrentPlatform(DockerContainer c)
|
|||||||
case DockerContainer::Cloak: return true;
|
case DockerContainer::Cloak: return true;
|
||||||
case DockerContainer::SSXray: return true;
|
case DockerContainer::SSXray: return true;
|
||||||
// case DockerContainer::ShadowSocks: return true;
|
// case DockerContainer::ShadowSocks: return true;
|
||||||
default:
|
default: return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(MACOS_NE)
|
|
||||||
// macOS build using Network Extension – hide OpenVPN-based containers
|
|
||||||
switch (c) {
|
|
||||||
case DockerContainer::WireGuard: return true;
|
|
||||||
case DockerContainer::Awg: return true;
|
|
||||||
case DockerContainer::Xray: return true;
|
|
||||||
case DockerContainer::SSXray: return true;
|
|
||||||
case DockerContainer::OpenVpn:
|
|
||||||
case DockerContainer::Cloak:
|
|
||||||
case DockerContainer::ShadowSocks:
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace
|
|||||||
|
|
||||||
bool apiUtils::isSubscriptionExpired(const QString &subscriptionEndDate)
|
bool apiUtils::isSubscriptionExpired(const QString &subscriptionEndDate)
|
||||||
{
|
{
|
||||||
QDateTime now = QDateTime::currentDateTimeUtc();
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
QDateTime endDate = QDateTime::fromString(subscriptionEndDate, Qt::ISODateWithMs);
|
QDateTime endDate = QDateTime::fromString(subscriptionEndDate, Qt::ISODateWithMs);
|
||||||
return endDate < now;
|
return endDate < now;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ void CoreController::initSignalHandlers()
|
|||||||
|
|
||||||
void CoreController::initNotificationHandler()
|
void CoreController::initNotificationHandler()
|
||||||
{
|
{
|
||||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
#ifndef Q_OS_ANDROID
|
||||||
m_notificationHandler.reset(NotificationHandler::create(nullptr));
|
m_notificationHandler.reset(NotificationHandler::create(nullptr));
|
||||||
|
|
||||||
connect(m_vpnConnection.get(), &VpnConnection::connectionStateChanged, m_notificationHandler.get(),
|
connect(m_vpnConnection.get(), &VpnConnection::connectionStateChanged, m_notificationHandler.get(),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
#ifndef Q_OS_ANDROID
|
||||||
#include "ui/systemtray_notificationhandler.h"
|
#include "ui/systemtray_notificationhandler.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
#include "ui/models/services/socks5ProxyConfigModel.h"
|
#include "ui/models/services/socks5ProxyConfigModel.h"
|
||||||
#include "ui/models/sites_model.h"
|
#include "ui/models/sites_model.h"
|
||||||
|
|
||||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
#ifndef Q_OS_ANDROID
|
||||||
#include "ui/notificationhandler.h"
|
#include "ui/notificationhandler.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ private:
|
|||||||
QSharedPointer<VpnConnection> m_vpnConnection;
|
QSharedPointer<VpnConnection> m_vpnConnection;
|
||||||
QSharedPointer<QTranslator> m_translator;
|
QSharedPointer<QTranslator> m_translator;
|
||||||
|
|
||||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
#ifndef Q_OS_ANDROID
|
||||||
QScopedPointer<NotificationHandler> m_notificationHandler;
|
QScopedPointer<NotificationHandler> m_notificationHandler;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -60,9 +60,8 @@ ErrorCode GatewayController::get(const QString &endpoint, QByteArray &responseBo
|
|||||||
QNetworkRequest request;
|
QNetworkRequest request;
|
||||||
request.setTransferTimeout(m_requestTimeoutMsecs);
|
request.setTransferTimeout(m_requestTimeoutMsecs);
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
request.setRawHeader(QString("X-Client-Request-ID").toUtf8(), QUuid::createUuid().toString(QUuid::WithoutBraces).toUtf8());
|
|
||||||
|
|
||||||
request.setUrl(QString(endpoint).arg(m_proxyUrl.isEmpty() ? m_gatewayEndpoint : m_proxyUrl));
|
request.setUrl(QString(endpoint).arg(m_gatewayEndpoint));
|
||||||
|
|
||||||
// bypass killSwitch exceptions for API-gateway
|
// bypass killSwitch exceptions for API-gateway
|
||||||
#ifdef AMNEZIA_DESKTOP
|
#ifdef AMNEZIA_DESKTOP
|
||||||
@@ -123,9 +122,8 @@ ErrorCode GatewayController::post(const QString &endpoint, const QJsonObject api
|
|||||||
QNetworkRequest request;
|
QNetworkRequest request;
|
||||||
request.setTransferTimeout(m_requestTimeoutMsecs);
|
request.setTransferTimeout(m_requestTimeoutMsecs);
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
request.setRawHeader(QString("X-Client-Request-ID").toUtf8(), QUuid::createUuid().toString(QUuid::WithoutBraces).toUtf8());
|
|
||||||
|
|
||||||
request.setUrl(endpoint.arg(m_proxyUrl.isEmpty() ? m_gatewayEndpoint : m_proxyUrl));
|
request.setUrl(endpoint.arg(m_gatewayEndpoint));
|
||||||
|
|
||||||
// bypass killSwitch exceptions for API-gateway
|
// bypass killSwitch exceptions for API-gateway
|
||||||
#ifdef AMNEZIA_DESKTOP
|
#ifdef AMNEZIA_DESKTOP
|
||||||
@@ -346,14 +344,11 @@ void GatewayController::bypassProxy(const QString &endpoint, QNetworkReply *repl
|
|||||||
std::mt19937 generator(randomDevice());
|
std::mt19937 generator(randomDevice());
|
||||||
std::shuffle(proxyUrls.begin(), proxyUrls.end(), generator);
|
std::shuffle(proxyUrls.begin(), proxyUrls.end(), generator);
|
||||||
|
|
||||||
|
QEventLoop wait;
|
||||||
|
QList<QSslError> sslErrors;
|
||||||
QByteArray responseBody;
|
QByteArray responseBody;
|
||||||
|
|
||||||
auto bypassFunction = [this](const QString &endpoint, const QString &proxyUrl, QNetworkReply *reply,
|
for (const QString &proxyUrl : proxyUrls) {
|
||||||
std::function<QNetworkReply *(const QString &url)> requestFunction,
|
|
||||||
std::function<bool(QNetworkReply * reply, const QList<QSslError> &sslErrors)> replyProcessingFunction) {
|
|
||||||
QEventLoop wait;
|
|
||||||
QList<QSslError> sslErrors;
|
|
||||||
|
|
||||||
qDebug() << "go to the next proxy endpoint";
|
qDebug() << "go to the next proxy endpoint";
|
||||||
reply->deleteLater(); // delete the previous reply
|
reply->deleteLater(); // delete the previous reply
|
||||||
reply = requestFunction(endpoint.arg(proxyUrl));
|
reply = requestFunction(endpoint.arg(proxyUrl));
|
||||||
@@ -363,50 +358,6 @@ void GatewayController::bypassProxy(const QString &endpoint, QNetworkReply *repl
|
|||||||
wait.exec();
|
wait.exec();
|
||||||
|
|
||||||
if (replyProcessingFunction(reply, sslErrors)) {
|
if (replyProcessingFunction(reply, sslErrors)) {
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (m_proxyUrl.isEmpty()) {
|
|
||||||
QNetworkRequest request;
|
|
||||||
request.setTransferTimeout(1000);
|
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
|
||||||
|
|
||||||
QEventLoop wait;
|
|
||||||
QList<QSslError> sslErrors;
|
|
||||||
QNetworkReply *reply;
|
|
||||||
|
|
||||||
for (const QString &proxyUrl : proxyUrls) {
|
|
||||||
request.setUrl(proxyUrl + "lmbd-health");
|
|
||||||
reply = amnApp->networkManager()->get(request);
|
|
||||||
|
|
||||||
connect(reply, &QNetworkReply::finished, &wait, &QEventLoop::quit);
|
|
||||||
connect(reply, &QNetworkReply::sslErrors, [this, &sslErrors](const QList<QSslError> &errors) { sslErrors = errors; });
|
|
||||||
wait.exec();
|
|
||||||
|
|
||||||
if (reply->error() == QNetworkReply::NetworkError::NoError) {
|
|
||||||
reply->deleteLater();
|
|
||||||
|
|
||||||
m_proxyUrl = proxyUrl;
|
|
||||||
if (!m_proxyUrl.isEmpty()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
reply->deleteLater();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_proxyUrl.isEmpty()) {
|
|
||||||
if (bypassFunction(endpoint, m_proxyUrl, reply, requestFunction, replyProcessingFunction)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const QString &proxyUrl : proxyUrls) {
|
|
||||||
if (bypassFunction(endpoint, proxyUrl, reply, requestFunction, replyProcessingFunction)) {
|
|
||||||
m_proxyUrl = proxyUrl;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ private:
|
|||||||
QString m_gatewayEndpoint;
|
QString m_gatewayEndpoint;
|
||||||
bool m_isDevEnvironment = false;
|
bool m_isDevEnvironment = false;
|
||||||
bool m_isStrictKillSwitchEnabled = false;
|
bool m_isStrictKillSwitchEnabled = false;
|
||||||
|
|
||||||
inline static QString m_proxyUrl;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GATEWAYCONTROLLER_H
|
#endif // GATEWAYCONTROLLER_H
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ namespace amnezia
|
|||||||
ApiNotFoundError = 1109,
|
ApiNotFoundError = 1109,
|
||||||
ApiMigrationError = 1110,
|
ApiMigrationError = 1110,
|
||||||
ApiUpdateRequestError = 1111,
|
ApiUpdateRequestError = 1111,
|
||||||
ApiSubscriptionExpiredError = 1112,
|
|
||||||
|
|
||||||
// QFile errors
|
// QFile errors
|
||||||
OpenError = 1200,
|
OpenError = 1200,
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ QString errorString(ErrorCode code) {
|
|||||||
case (ErrorCode::ApiNotFoundError): errorMessage = QObject::tr("Error when retrieving configuration from API"); break;
|
case (ErrorCode::ApiNotFoundError): errorMessage = QObject::tr("Error when retrieving configuration from API"); break;
|
||||||
case (ErrorCode::ApiMigrationError): errorMessage = QObject::tr("A migration error has occurred. Please contact our technical support"); break;
|
case (ErrorCode::ApiMigrationError): errorMessage = QObject::tr("A migration error has occurred. Please contact our technical support"); break;
|
||||||
case (ErrorCode::ApiUpdateRequestError): errorMessage = QObject::tr("Please update the application to use this feature"); break;
|
case (ErrorCode::ApiUpdateRequestError): errorMessage = QObject::tr("Please update the application to use this feature"); break;
|
||||||
case (ErrorCode::ApiSubscriptionExpiredError): errorMessage = QObject::tr("Your Amnezia Premium subscription has expired.\n Please check your email for renewal instructions.\n If you haven't received an email, please contact our support."); break;
|
|
||||||
|
|
||||||
// QFile errors
|
// QFile errors
|
||||||
case(ErrorCode::OpenError): errorMessage = QObject::tr("QFile error: The file could not be opened"); break;
|
case(ErrorCode::OpenError): errorMessage = QObject::tr("QFile error: The file could not be opened"); break;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@@ -390,7 +390,7 @@ QString NetworkUtilities::getGatewayAndIface()
|
|||||||
close(sock);
|
close(sock);
|
||||||
return gateway_address;
|
return gateway_address;
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
|
||||||
QString gateway;
|
QString gateway;
|
||||||
int mib[] = {CTL_NET, PF_ROUTE, 0, 0, NET_RT_FLAGS, RTF_GATEWAY};
|
int mib[] = {CTL_NET, PF_ROUTE, 0, 0, NET_RT_FLAGS, RTF_GATEWAY};
|
||||||
int afinet_type[] = {AF_INET, AF_INET6};
|
int afinet_type[] = {AF_INET, AF_INET6};
|
||||||
|
|||||||
@@ -101,10 +101,10 @@ QString InterfaceConfig::toWgConf(const QMap<QString, QString>& extra) const {
|
|||||||
out << "MTU = " << m_deviceMTU << "\n";
|
out << "MTU = " << m_deviceMTU << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_primaryDnsServer.isEmpty()) {
|
if (!m_primaryDnsServer.isNull()) {
|
||||||
QStringList dnsServers;
|
QStringList dnsServers;
|
||||||
dnsServers.append(m_primaryDnsServer);
|
dnsServers.append(m_primaryDnsServer);
|
||||||
if (!m_secondaryDnsServer.isEmpty()) {
|
if (!m_secondaryDnsServer.isNull()) {
|
||||||
dnsServers.append(m_secondaryDnsServer);
|
dnsServers.append(m_secondaryDnsServer);
|
||||||
}
|
}
|
||||||
// If the DNS is not the Gateway, it's a user defined DNS
|
// If the DNS is not the Gateway, it's a user defined DNS
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 682 B After Width: | Height: | Size: 336 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 593 B |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 593 B |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 340 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 11 KiB |
@@ -1,68 +1,6 @@
|
|||||||
{
|
{
|
||||||
"images": [
|
"info" : {
|
||||||
{
|
"author" : "xcode",
|
||||||
"idiom": "mac",
|
"version" : 1
|
||||||
"size": "16x16",
|
|
||||||
"scale": "1x",
|
|
||||||
"filename": "16.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom": "mac",
|
|
||||||
"size": "16x16",
|
|
||||||
"scale": "2x",
|
|
||||||
"filename": "16@2x.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom": "mac",
|
|
||||||
"size": "32x32",
|
|
||||||
"scale": "1x",
|
|
||||||
"filename": "32.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom": "mac",
|
|
||||||
"size": "32x32",
|
|
||||||
"scale": "2x",
|
|
||||||
"filename": "32@2x.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom": "mac",
|
|
||||||
"size": "128x128",
|
|
||||||
"scale": "1x",
|
|
||||||
"filename": "128.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom": "mac",
|
|
||||||
"size": "128x128",
|
|
||||||
"scale": "2x",
|
|
||||||
"filename": "128@2x.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom": "mac",
|
|
||||||
"size": "256x256",
|
|
||||||
"scale": "1x",
|
|
||||||
"filename": "256.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom": "mac",
|
|
||||||
"size": "256x256",
|
|
||||||
"scale": "2x",
|
|
||||||
"filename": "256@2x.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom": "mac",
|
|
||||||
"size": "512x512",
|
|
||||||
"scale": "1x",
|
|
||||||
"filename": "512.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom": "mac",
|
|
||||||
"size": "512x512",
|
|
||||||
"scale": "2x",
|
|
||||||
"filename": "512@2x.png"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info": {
|
|
||||||
"version": 1,
|
|
||||||
"author": "xcode"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,172 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleAllowMixedLocalizations</key>
|
|
||||||
<true/>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>en</string>
|
|
||||||
<key>CFBundleDisplayName</key>
|
|
||||||
<string>${QT_INTERNAL_DOLLAR_VAR}{PRODUCT_NAME}</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>APPL</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
|
||||||
<key>NSHumanReadableCopyright</key>
|
|
||||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
|
||||||
<key>ITSAppUsesNonExemptEncryption</key>
|
|
||||||
<false/>
|
|
||||||
<key>LSApplicationCategoryType</key>
|
|
||||||
<string>public.app-category.utilities</string>
|
|
||||||
|
|
||||||
<key>LSMinimumSystemVersion</key>
|
|
||||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
|
||||||
<key>LSSupportsOpeningDocumentsInPlace</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.wireguard.ios.app_group_id</key>
|
|
||||||
<string>group.org.amnezia.AmneziaVPN</string>
|
|
||||||
<key>NSCameraUsageDescription</key>
|
|
||||||
<string>Amnezia VPN needs access to the camera for reading QR-codes.</string>
|
|
||||||
<key>NSAppTransportSecurity</key>
|
|
||||||
<dict>
|
|
||||||
<key>NSAllowsArbitraryLoads</key>
|
|
||||||
<false/>
|
|
||||||
<key>NSAllowsLocalNetworking</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
<key>CFBundleIcons</key>
|
|
||||||
<dict/>
|
|
||||||
<key>UTImportedTypeDeclarations</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>UTTypeConformsTo</key>
|
|
||||||
<array>
|
|
||||||
<string>public.data</string>
|
|
||||||
</array>
|
|
||||||
<key>UTTypeDescription</key>
|
|
||||||
<string>Amnezia VPN config</string>
|
|
||||||
<key>UTTypeIconFiles</key>
|
|
||||||
<array/>
|
|
||||||
<key>UTTypeIdentifier</key>
|
|
||||||
<string>org.amnezia.AmneziaVPN.amnezia-config</string>
|
|
||||||
<key>UTTypeTagSpecification</key>
|
|
||||||
<dict>
|
|
||||||
<key>public.filename-extension</key>
|
|
||||||
<array>
|
|
||||||
<string>vpn</string>
|
|
||||||
</array>
|
|
||||||
<key>public.mime-type</key>
|
|
||||||
<array>
|
|
||||||
<string>text/plain</string>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>UTTypeConformsTo</key>
|
|
||||||
<array>
|
|
||||||
<string>public.data</string>
|
|
||||||
</array>
|
|
||||||
<key>UTTypeDescription</key>
|
|
||||||
<string>WireGuard config</string>
|
|
||||||
<key>UTTypeIconFiles</key>
|
|
||||||
<array/>
|
|
||||||
<key>UTTypeIdentifier</key>
|
|
||||||
<string>org.amnezia.AmneziaVPN.wireguard-config</string>
|
|
||||||
<key>UTTypeTagSpecification</key>
|
|
||||||
<dict>
|
|
||||||
<key>public.filename-extension</key>
|
|
||||||
<array>
|
|
||||||
<string>conf</string>
|
|
||||||
<string>cfg</string>
|
|
||||||
</array>
|
|
||||||
<key>public.mime-type</key>
|
|
||||||
<array>
|
|
||||||
<string>text/plain</string>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>UTTypeConformsTo</key>
|
|
||||||
<array>
|
|
||||||
<string>public.data</string>
|
|
||||||
</array>
|
|
||||||
<key>UTTypeDescription</key>
|
|
||||||
<string>OpenVPN config</string>
|
|
||||||
<key>UTTypeIconFiles</key>
|
|
||||||
<array/>
|
|
||||||
<key>UTTypeIdentifier</key>
|
|
||||||
<string>org.amnezia.AmneziaVPN.openvpn-config</string>
|
|
||||||
<key>UTTypeTagSpecification</key>
|
|
||||||
<dict>
|
|
||||||
<key>public.filename-extension</key>
|
|
||||||
<array>
|
|
||||||
<string>ovpn</string>
|
|
||||||
</array>
|
|
||||||
<key>public.mime-type</key>
|
|
||||||
<array>
|
|
||||||
<string>text/plain</string>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>UTTypeConformsTo</key>
|
|
||||||
<array>
|
|
||||||
<string>public.data</string>
|
|
||||||
</array>
|
|
||||||
<key>UTTypeDescription</key>
|
|
||||||
<string>AmneziaVPN backup file</string>
|
|
||||||
<key>UTTypeIconFiles</key>
|
|
||||||
<array/>
|
|
||||||
<key>UTTypeIdentifier</key>
|
|
||||||
<string>org.amnezia.AmneziaVPN.backup-config</string>
|
|
||||||
<key>UTTypeTagSpecification</key>
|
|
||||||
<dict>
|
|
||||||
<key>public.filename-extension</key>
|
|
||||||
<array>
|
|
||||||
<string>backup</string>
|
|
||||||
</array>
|
|
||||||
<key>public.mime-type</key>
|
|
||||||
<array>
|
|
||||||
<string>text/plain</string>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
<key>CFBundleDocumentTypes</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleTypeName</key>
|
|
||||||
<string>Amnezia VPN config</string>
|
|
||||||
<key>LSHandlerRank</key>
|
|
||||||
<string>Alternate</string>
|
|
||||||
<key>LSItemContentTypes</key>
|
|
||||||
<array>
|
|
||||||
<string>org.amnezia.AmneziaVPN.amnezia-config</string>
|
|
||||||
<string>org.amnezia.AmneziaVPN.wireguard-config</string>
|
|
||||||
<string>org.amnezia.AmneziaVPN.openvpn-config</string>
|
|
||||||
<string>org.amnezia.AmneziaVPN.backup-config</string>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
<key>NSExtensions</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>NSExtensionPointIdentifier</key>
|
|
||||||
<string>com.apple.networkextension.packet-tunnel</string>
|
|
||||||
<key>NSExtensionPrincipalClass</key>
|
|
||||||
<string>$(PRODUCT_MODULE_NAME).PacketTunnelProvider</string>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@@ -2,40 +2,34 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.developer.networking.custom-protocol</key>
|
<key>com.apple.application-identifier</key>
|
||||||
<true/>
|
<string>$(DEVELOPMENT_TEAM).$(APP_ID_MACOS)</string>
|
||||||
|
|
||||||
<key>com.apple.developer.networking.networkextension</key>
|
<key>com.apple.developer.networking.networkextension</key>
|
||||||
<array>
|
<array>
|
||||||
<string>app-proxy-provider</string>
|
|
||||||
<string>packet-tunnel-provider</string>
|
<string>packet-tunnel-provider</string>
|
||||||
<string>dns-settings</string>
|
|
||||||
<string>relay</string>
|
|
||||||
<string>content-filter-provider</string>
|
|
||||||
<string>dns-proxy</string>
|
|
||||||
</array>
|
</array>
|
||||||
<key>com.apple.developer.system-extension.install</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.developer.networking.vpn.api</key>
|
|
||||||
<array>
|
|
||||||
<string>allow-vpn</string>
|
|
||||||
</array>
|
|
||||||
<key>com.apple.security.app-sandbox</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.security.application-groups</key>
|
|
||||||
<array>
|
|
||||||
<string>group.org.amnezia.AmneziaVPN</string>
|
|
||||||
</array>
|
|
||||||
<key>com.apple.security.files.user-selected.read-only</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.security.files.user-selected.read-write</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.security.network.client</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.security.network.server</key>
|
|
||||||
<true/>
|
|
||||||
<key>keychain-access-groups</key>
|
<key>keychain-access-groups</key>
|
||||||
<array>
|
<array>
|
||||||
<string>$(DEVELOPMENT_TEAM).*</string>
|
<string>$(DEVELOPMENT_TEAM).*</string>
|
||||||
</array>
|
</array>
|
||||||
|
|
||||||
|
<key>com.apple.developer.team-identifier</key>
|
||||||
|
<string>$(DEVELOPMENT_TEAM)</string>
|
||||||
|
|
||||||
|
<key>com.apple.security.app-sandbox</key>
|
||||||
|
<true/>
|
||||||
|
|
||||||
|
<key>com.apple.security.application-groups</key>
|
||||||
|
<array>
|
||||||
|
<string>$(DEVELOPMENT_TEAM).$(GROUP_ID_MACOS)</string>
|
||||||
|
</array>
|
||||||
|
|
||||||
|
<key>com.apple.security.network.client</key>
|
||||||
|
<true/>
|
||||||
|
|
||||||
|
<key>com.apple.security.network.server</key>
|
||||||
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -2,30 +2,41 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.developer.networking.custom-protocol</key>
|
<key>com.apple.application-identifier</key>
|
||||||
<true/>
|
<string>$(DEVELOPMENT_TEAM).$(NETEXT_ID_MACOS)</string>
|
||||||
|
|
||||||
<key>com.apple.developer.networking.networkextension</key>
|
<key>com.apple.developer.networking.networkextension</key>
|
||||||
<array>
|
<array>
|
||||||
<string>dns-settings</string>
|
|
||||||
<string>relay</string>
|
|
||||||
<string>packet-tunnel-provider</string>
|
<string>packet-tunnel-provider</string>
|
||||||
<string>content-filter-provider</string>
|
|
||||||
<string>dns-proxy</string>
|
|
||||||
<string>app-proxy-provider</string>
|
|
||||||
</array>
|
</array>
|
||||||
<key>com.apple.developer.networking.vpn.api</key>
|
|
||||||
|
<key>keychain-access-groups</key>
|
||||||
<array>
|
<array>
|
||||||
<string>allow-vpn</string>
|
<string>$(DEVELOPMENT_TEAM).*</string>
|
||||||
</array>
|
</array>
|
||||||
|
|
||||||
|
<key>com.apple.developer.team-identifier</key>
|
||||||
|
<string>$(DEVELOPMENT_TEAM)</string>
|
||||||
|
|
||||||
|
<key>com.apple.developer.system-extension.install</key>
|
||||||
|
<true/>
|
||||||
|
|
||||||
<key>com.apple.security.app-sandbox</key>
|
<key>com.apple.security.app-sandbox</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
|
||||||
<key>com.apple.security.application-groups</key>
|
<key>com.apple.security.application-groups</key>
|
||||||
<array>
|
<array>
|
||||||
<string>group.org.amnezia.AmneziaVPN</string>
|
<string>$(DEVELOPMENT_TEAM).$(GROUP_ID_MACOS)</string>
|
||||||
</array>
|
</array>
|
||||||
|
|
||||||
<key>com.apple.security.network.client</key>
|
<key>com.apple.security.network.client</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
|
||||||
<key>com.apple.security.network.server</key>
|
<key>com.apple.security.network.server</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>com.apple.security.app-sandbox</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.private.network.socket-delegate</key>
|
||||||
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -1,138 +0,0 @@
|
|||||||
enable_language(Swift)
|
|
||||||
message("Client message >> macos build >> AmneziaVPNNetworkExtension")
|
|
||||||
set(CLIENT_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
|
|
||||||
|
|
||||||
add_executable(AmneziaVPNNetworkExtension)
|
|
||||||
|
|
||||||
message("executable_path is: @executable_path/../../Frameworks")
|
|
||||||
set_target_properties(AmneziaVPNNetworkExtension PROPERTIES
|
|
||||||
XCODE_PRODUCT_TYPE com.apple.product-type.app-extension
|
|
||||||
# MACOSX_BUNDLE YES
|
|
||||||
BUNDLE_EXTENSION appex
|
|
||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING "${APPLE_PROJECT_VERSION}"
|
|
||||||
MACOSX_BUNDLE_INFO_STRING "AmneziaVPNNetworkExtension"
|
|
||||||
MACOSX_BUNDLE_BUNDLE_NAME "AmneziaVPNNetworkExtension"
|
|
||||||
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${BUILD_IOS_APP_IDENTIFIER}.network-extension"
|
|
||||||
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_NAME "${BUILD_IOS_APP_IDENTIFIER}.network-extension"
|
|
||||||
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${CMAKE_CURRENT_SOURCE_DIR}/AmneziaVPNNetworkExtension.entitlements
|
|
||||||
XCODE_ATTRIBUTE_MARKETING_VERSION "${APP_MAJOR_VERSION}"
|
|
||||||
XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION "${BUILD_ID}"
|
|
||||||
XCODE_ATTRIBUTE_PRODUCT_NAME "AmneziaVPNNetworkExtension"
|
|
||||||
|
|
||||||
XCODE_ATTRIBUTE_APPLICATION_EXTENSION_API_ONLY "YES"
|
|
||||||
XCODE_ATTRIBUTE_ENABLE_BITCODE "NO"
|
|
||||||
XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET "11.0"
|
|
||||||
|
|
||||||
XCODE_ATTRIBUTE_INFOPLIST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
|
|
||||||
XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../../../../Frameworks @loader_path/../../../../Frameworks"
|
|
||||||
)
|
|
||||||
|
|
||||||
if(DEPLOY)
|
|
||||||
message("DEPLOY is ON")
|
|
||||||
set_target_properties(AmneziaVPNNetworkExtension PROPERTIES
|
|
||||||
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Apple Distribution"
|
|
||||||
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY[variant=Debug] "Apple Development"
|
|
||||||
XCODE_ATTRIBUTE_CODE_SIGN_STYLE Manual
|
|
||||||
XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER "distr macos.org.amnezia.amneziaVPN.NE"
|
|
||||||
XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER[variant=Debug] "dev macos.org.amnezia.amneziaVPN.NE"
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
set_target_properties(AmneziaVPNNetworkExtension PROPERTIES
|
|
||||||
XCODE_ATTRIBUTE_CODE_SIGN_STYLE Automatic
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_target_properties(AmneziaVPNNetworkExtension PROPERTIES
|
|
||||||
XCODE_ATTRIBUTE_SWIFT_VERSION "5.0"
|
|
||||||
XCODE_ATTRIBUTE_CLANG_ENABLE_MODULES "YES"
|
|
||||||
XCODE_ATTRIBUTE_SWIFT_OBJC_BRIDGING_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/WireGuardNetworkExtension-Bridging-Header.h"
|
|
||||||
XCODE_ATTRIBUTE_SWIFT_OPTIMIZATION_LEVEL "-Onone"
|
|
||||||
XCODE_ATTRIBUTE_SWIFT_PRECOMPILE_BRIDGING_HEADER "NO"
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties("AmneziaVPNNetworkExtension" PROPERTIES
|
|
||||||
XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "X7UJ388FXK"
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(FW_ASSETS_LIBRARY AssetsLibrary)
|
|
||||||
find_library(FW_MOBILE_CORE MobileCoreServices)
|
|
||||||
find_library(FW_UI_KIT UIKit)
|
|
||||||
find_library(FW_LIBRESOLV libresolv.9.tbd)
|
|
||||||
|
|
||||||
|
|
||||||
# Set the root directory
|
|
||||||
set(CLIENT_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
|
|
||||||
|
|
||||||
target_link_libraries(AmneziaVPNNetworkExtension PRIVATE ${FW_LIBRESOLV})
|
|
||||||
|
|
||||||
target_compile_options(AmneziaVPNNetworkExtension PRIVATE -DGROUP_ID=\"${BUILD_IOS_GROUP_IDENTIFIER}\")
|
|
||||||
target_compile_options(AmneziaVPNNetworkExtension PRIVATE -DNETWORK_EXTENSION=1)
|
|
||||||
|
|
||||||
set(WG_APPLE_SOURCE_DIR ${CLIENT_ROOT_DIR}/3rd/amneziawg-apple/Sources)
|
|
||||||
|
|
||||||
message("WG_APPLE_SOURCE_DIR is: ${WG_APPLE_SOURCE_DIR}")
|
|
||||||
message("CLIENT_ROOT_DIR is: ${CLIENT_ROOT_DIR}")
|
|
||||||
|
|
||||||
target_sources(AmneziaVPNNetworkExtension PRIVATE
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardKit/WireGuardAdapter.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardKit/PacketTunnelSettingsGenerator.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardKit/DNSResolver.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardNetworkExtension/ErrorNotifier.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/Shared/Keychain.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/Shared/Model/TunnelConfiguration+WgQuickConfig.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/Shared/Model/NETunnelProviderProtocol+Extension.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/Shared/Model/String+ArrayConversion.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardKit/TunnelConfiguration.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardKit/IPAddressRange.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardKit/Endpoint.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardKit/DNSServer.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardKit/InterfaceConfiguration.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardKit/PeerConfiguration.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/Shared/FileManager+Extension.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardKitC/x25519.c
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardKit/Array+ConcurrentMap.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardKit/IPAddress+AddrInfo.swift
|
|
||||||
${WG_APPLE_SOURCE_DIR}/WireGuardKit/PrivateKey.swift
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/HevSocksTunnel.swift
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/NELogController.swift
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/Log.swift
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/LogRecord.swift
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/PacketTunnelProvider.swift
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/PacketTunnelProvider+WireGuard.swift
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/PacketTunnelProvider+OpenVPN.swift
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/PacketTunnelProvider+Xray.swift
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/WGConfig.swift
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/iosglue.mm
|
|
||||||
${CLIENT_ROOT_DIR}/platforms/ios/XrayConfig.swift
|
|
||||||
)
|
|
||||||
|
|
||||||
target_sources(AmneziaVPNNetworkExtension PRIVATE
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/PrivacyInfo.xcprivacy
|
|
||||||
)
|
|
||||||
|
|
||||||
set_property(TARGET AmneziaVPNNetworkExtension APPEND PROPERTY RESOURCE
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/PrivacyInfo.xcprivacy
|
|
||||||
)
|
|
||||||
|
|
||||||
## Build wireguard-go-version.h
|
|
||||||
execute_process(
|
|
||||||
COMMAND go list -m golang.zx2c4.com/wireguard
|
|
||||||
WORKING_DIRECTORY ${CLIENT_ROOT_DIR}/3rd/wireguard-apple/Sources/WireGuardKitGo
|
|
||||||
OUTPUT_VARIABLE WG_VERSION_FULL
|
|
||||||
)
|
|
||||||
string(REGEX REPLACE ".*v\([0-9.]*\).*" "\\1" WG_VERSION_STRING 1.1.1)
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/wireguard-go-version.h.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/wireguard-go-version.h)
|
|
||||||
target_sources(AmneziaVPNNetworkExtension PRIVATE
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/wireguard-go-version.h)
|
|
||||||
|
|
||||||
target_include_directories(AmneziaVPNNetworkExtension PRIVATE ${CLIENT_ROOT_DIR})
|
|
||||||
target_include_directories(AmneziaVPNNetworkExtension PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
target_link_libraries(AmneziaVPNNetworkExtension PRIVATE ${CLIENT_ROOT_DIR}/3rd-prebuilt/3rd-prebuilt/wireguard/macos/universal2/libwg-go.a)
|
|
||||||
|
|
||||||
message(${CLIENT_ROOT_DIR})
|
|
||||||
message(${CLIENT_ROOT_DIR}/3rd-prebuilt/3rd-prebuilt/xray/HevSocks5Tunnel.xcframework/macos-arm64_x86_64/libhev-socks5-tunnel.a)
|
|
||||||
target_link_libraries(AmneziaVPNNetworkExtension PRIVATE ${CLIENT_ROOT_DIR}/3rd-prebuilt/3rd-prebuilt/xray/HevSocks5Tunnel.xcframework/macos-arm64_x86_64/libhev-socks5-tunnel.a)
|
|
||||||
|
|
||||||
target_include_directories(AmneziaVPNNetworkExtension PRIVATE ${CLIENT_ROOT_DIR}/3rd-prebuilt/3rd-prebuilt/xray/HevSocks5Tunnel.xcframework/macos-arm64_x86_64/Headers)
|
|
||||||
@@ -3,32 +3,27 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>en</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleDisplayName</key>
|
||||||
<string>AmneziaVPNNetworkExtension</string>
|
<string>AmneziaVPNNetworkExtension</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>org.amnezia.AmneziaVPN.network-extension</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>AmneziaVPNNetworkExtension</string>
|
<string>$(PRODUCT_NAME)</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>${APPLE_PROJECT_VERSION}</string>
|
<string>$(MARKETING_VERSION)</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>${CMAKE_PROJECT_VERSION_TWEAK}</string>
|
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||||
|
|
||||||
<key>ITSAppUsesNonExemptEncryption</key>
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
<false/>
|
<false/>
|
||||||
|
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
|
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||||
|
|
||||||
<key>CFBundleDisplayName</key>
|
|
||||||
<string>AmneziaVPNNetworkExtension</string>
|
|
||||||
|
|
||||||
<key>NSExtension</key>
|
<key>NSExtension</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionPointIdentifier</key>
|
<key>NSExtensionPointIdentifier</key>
|
||||||
@@ -36,11 +31,5 @@
|
|||||||
<key>NSExtensionPrincipalClass</key>
|
<key>NSExtensionPrincipalClass</key>
|
||||||
<string>$(PRODUCT_MODULE_NAME).PacketTunnelProvider</string>
|
<string>$(PRODUCT_MODULE_NAME).PacketTunnelProvider</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
||||||
<key>com.wireguard.ios.app_group_id</key>
|
|
||||||
<string>group.org.amnezia.AmneziaVPN</string>
|
|
||||||
|
|
||||||
<key>com.wireguard.macos.app_group_id</key>
|
|
||||||
<string>${BUILD_VPN_DEVELOPMENT_TEAM}.group.org.amnezia.AmneziaVPN</string>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>NSPrivacyAccessedAPITypes</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>NSPrivacyAccessedAPIType</key>
|
|
||||||
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
|
|
||||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
|
||||||
<array>
|
|
||||||
<string>1C8F.1</string>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>NSPrivacyAccessedAPIType</key>
|
|
||||||
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
|
|
||||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
|
||||||
<array>
|
|
||||||
<string>C617.1</string>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include "macos/gobridge/wireguard.h"
|
||||||
#include "wireguard-go-version.h"
|
#include "wireguard-go-version.h"
|
||||||
#include "3rd/amneziawg-apple/Sources/WireGuardKitGo/wireguard.h"
|
#include "3rd/awg-apple/Sources/WireGuardKitC/WireGuardKitC.h"
|
||||||
#include "3rd/amneziawg-apple/Sources/WireGuardKitC/WireGuardKitC.h"
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -23,8 +23,3 @@ bool key_from_hex(uint8_t key[WG_KEY_LEN], const char* hex);
|
|||||||
bool key_eq(const uint8_t key1[WG_KEY_LEN], const uint8_t key2[WG_KEY_LEN]);
|
bool key_eq(const uint8_t key1[WG_KEY_LEN], const uint8_t key2[WG_KEY_LEN]);
|
||||||
|
|
||||||
void write_msg_to_log(const char* tag, const char* msg);
|
void write_msg_to_log(const char* tag, const char* msg);
|
||||||
|
|
||||||
// init function definition in C
|
|
||||||
void hev_socks5_tunnel_quit(void);
|
|
||||||
// Updated function definition in C
|
|
||||||
int hev_socks5_tunnel_main(const char* configFile, int fd);
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
#ifndef WIREGUARD_GO_VERSION
|
|
||||||
#define WIREGUARD_GO_VERSION "@WG_VERSION_STRING@"
|
|
||||||
#endif // WIREGUARD_GO_VERSION
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "platforms/ios/QtAppDelegate-C-Interface.h"
|
#include "platforms/ios/QtAppDelegate-C-Interface.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
||||||
bool isAnotherInstanceRunning()
|
bool isAnotherInstanceRunning()
|
||||||
{
|
{
|
||||||
QLocalSocket socket;
|
QLocalSocket socket;
|
||||||
@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
AmneziaApplication app(argc, argv);
|
AmneziaApplication app(argc, argv);
|
||||||
|
|
||||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
||||||
if (isAnotherInstanceRunning()) {
|
if (isAnotherInstanceRunning()) {
|
||||||
QTimer::singleShot(1000, &app, [&]() { app.quit(); });
|
QTimer::singleShot(1000, &app, [&]() { app.quit(); });
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ extension PacketTunnelProvider {
|
|||||||
startHandler = completionHandler
|
startHandler = completionHandler
|
||||||
ovpnAdapter?.connect(using: packetFlow)
|
ovpnAdapter?.connect(using: packetFlow)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleOpenVPNStatusMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)? = nil) {
|
func handleOpenVPNStatusMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)? = nil) {
|
||||||
guard let completionHandler = completionHandler else { return }
|
guard let completionHandler = completionHandler else { return }
|
||||||
let bytesin = ovpnAdapter?.transportStatistics.bytesIn
|
let bytesin = ovpnAdapter?.transportStatistics.bytesIn
|
||||||
|
|||||||
@@ -112,19 +112,9 @@ extension PacketTunnelProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let lastHandshakeString = settingsDictionary["last_handshake_time_sec"]
|
|
||||||
let lastHandshake: Int64
|
|
||||||
|
|
||||||
if let lastHandshakeValue = lastHandshakeString, let handshakeValue = Int64(lastHandshakeValue) {
|
|
||||||
lastHandshake = handshakeValue
|
|
||||||
} else {
|
|
||||||
lastHandshake = -2 // Return an error if there is no value for `last_handshake_time_sec`
|
|
||||||
}
|
|
||||||
|
|
||||||
let response: [String: Any] = [
|
let response: [String: Any] = [
|
||||||
"rx_bytes": settingsDictionary["rx_bytes"] ?? "0",
|
"rx_bytes": settingsDictionary["rx_bytes"] ?? "0",
|
||||||
"tx_bytes": settingsDictionary["tx_bytes"] ?? "0",
|
"tx_bytes": settingsDictionary["tx_bytes"] ?? "0"
|
||||||
"last_handshake_time_sec": lastHandshake
|
|
||||||
]
|
]
|
||||||
|
|
||||||
completionHandler(try? JSONSerialization.data(withJSONObject: response, options: []))
|
completionHandler(try? JSONSerialization.data(withJSONObject: response, options: []))
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#if !MACOS_NE
|
|
||||||
#include "QRCodeReaderBase.h"
|
#include "QRCodeReaderBase.h"
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
@@ -109,19 +108,3 @@ void QRCodeReader::startReading() {
|
|||||||
void QRCodeReader::stopReading() {
|
void QRCodeReader::stopReading() {
|
||||||
[m_qrCodeReader stopReading];
|
[m_qrCodeReader stopReading];
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#include "QRCodeReaderBase.h"
|
|
||||||
|
|
||||||
QRCodeReader::QRCodeReader()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect QRCodeReader::cameraSize() {
|
|
||||||
return QRect();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QRCodeReader::startReading() {}
|
|
||||||
void QRCodeReader::stopReading() {}
|
|
||||||
void QRCodeReader::setCameraSize(QRect) {}
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#if !MACOS_NE
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#endif
|
|
||||||
@interface QIOSApplicationDelegate
|
@interface QIOSApplicationDelegate
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
|
|
||||||
@implementation QIOSApplicationDelegate (AmneziaVPNDelegate)
|
@implementation QIOSApplicationDelegate (AmneziaVPNDelegate)
|
||||||
#if !MACOS_NE
|
|
||||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||||
{
|
{
|
||||||
[application setMinimumBackgroundFetchInterval: UIApplicationBackgroundFetchIntervalMinimum];
|
[application setMinimumBackgroundFetchInterval: UIApplicationBackgroundFetchIntervalMinimum];
|
||||||
@@ -57,5 +57,5 @@
|
|||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -1,13 +1,3 @@
|
|||||||
#if MACOS_NE
|
|
||||||
public func toggleScreenshots(_ isEnabled: Bool) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class ScreenProtection {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public func toggleScreenshots(_ isEnabled: Bool) {
|
public func toggleScreenshots(_ isEnabled: Bool) {
|
||||||
@@ -100,4 +90,3 @@ struct ProtectionPair {
|
|||||||
textField.removeFromSuperview()
|
textField.removeFromSuperview()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public:
|
|||||||
void disconnectVpn();
|
void disconnectVpn();
|
||||||
|
|
||||||
void vpnStatusDidChange(void *pNotification);
|
void vpnStatusDidChange(void *pNotification);
|
||||||
|
|
||||||
void vpnConfigurationDidChange(void *pNotification);
|
void vpnConfigurationDidChange(void *pNotification);
|
||||||
|
|
||||||
void getBackendLogs(std::function<void(const QString &)> &&callback);
|
void getBackendLogs(std::function<void(const QString &)> &&callback);
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ const char* MessageKey::isOnDemand = "is-on-demand";
|
|||||||
const char* MessageKey::SplitTunnelType = "SplitTunnelType";
|
const char* MessageKey::SplitTunnelType = "SplitTunnelType";
|
||||||
const char* MessageKey::SplitTunnelSites = "SplitTunnelSites";
|
const char* MessageKey::SplitTunnelSites = "SplitTunnelSites";
|
||||||
|
|
||||||
#if !MACOS_NE
|
|
||||||
static UIViewController* getViewController() {
|
static UIViewController* getViewController() {
|
||||||
NSArray *windows = [[UIApplication sharedApplication]windows];
|
NSArray *windows = [[UIApplication sharedApplication]windows];
|
||||||
for (UIWindow *window in windows) {
|
for (UIWindow *window in windows) {
|
||||||
@@ -37,7 +36,6 @@ static UIViewController* getViewController() {
|
|||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
Vpn::ConnectionState iosStatusToState(NEVPNStatus status) {
|
Vpn::ConnectionState iosStatusToState(NEVPNStatus status) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@@ -251,21 +249,6 @@ void IosController::checkStatus()
|
|||||||
sendVpnExtensionMessage(message, [&](NSDictionary* response){
|
sendVpnExtensionMessage(message, [&](NSDictionary* response){
|
||||||
uint64_t txBytes = [response[@"tx_bytes"] intValue];
|
uint64_t txBytes = [response[@"tx_bytes"] intValue];
|
||||||
uint64_t rxBytes = [response[@"rx_bytes"] intValue];
|
uint64_t rxBytes = [response[@"rx_bytes"] intValue];
|
||||||
|
|
||||||
uint64_t last_handshake_time_sec = 0;
|
|
||||||
#if !MACOS_NE
|
|
||||||
if (response[@"last_handshake_time_sec"] && ![response[@"last_handshake_time_sec"] isKindOfClass:[NSNull class]]) {
|
|
||||||
last_handshake_time_sec = [response[@"last_handshake_time_sec"] intValue];
|
|
||||||
} else {
|
|
||||||
qDebug() << "Key last_handshake_time_sec is missing or null";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (last_handshake_time_sec < 0) {
|
|
||||||
disconnectVpn();
|
|
||||||
qDebug() << "Invalid handshake time, disconnecting VPN.";
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
emit bytesChanged(rxBytes - m_rxBytes, txBytes - m_txBytes);
|
emit bytesChanged(rxBytes - m_rxBytes, txBytes - m_txBytes);
|
||||||
m_rxBytes = rxBytes;
|
m_rxBytes = rxBytes;
|
||||||
m_txBytes = txBytes;
|
m_txBytes = txBytes;
|
||||||
@@ -820,14 +803,14 @@ bool IosController::shareText(const QStringList& filesToSend) {
|
|||||||
NSURL *logFileUrl = [[NSURL alloc] initFileURLWithPath:filesToSend[i].toNSString()];
|
NSURL *logFileUrl = [[NSURL alloc] initFileURLWithPath:filesToSend[i].toNSString()];
|
||||||
[sharingItems addObject:logFileUrl];
|
[sharingItems addObject:logFileUrl];
|
||||||
}
|
}
|
||||||
#if !MACOS_NE
|
|
||||||
UIViewController *qtController = getViewController();
|
UIViewController *qtController = getViewController();
|
||||||
if (!qtController) return;
|
if (!qtController) return;
|
||||||
|
|
||||||
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil];
|
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil];
|
||||||
#endif
|
|
||||||
__block bool isAccepted = false;
|
__block bool isAccepted = false;
|
||||||
#if !MACOS_NE
|
|
||||||
[activityController setCompletionWithItemsHandler:^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) {
|
[activityController setCompletionWithItemsHandler:^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) {
|
||||||
isAccepted = completed;
|
isAccepted = completed;
|
||||||
emit finished();
|
emit finished();
|
||||||
@@ -840,7 +823,6 @@ bool IosController::shareText(const QStringList& filesToSend) {
|
|||||||
popController.sourceRect = CGRectMake(100, 100, 100, 100);
|
popController.sourceRect = CGRectMake(100, 100, 100, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
QEventLoop wait;
|
QEventLoop wait;
|
||||||
QObject::connect(this, &IosController::finished, &wait, &QEventLoop::quit);
|
QObject::connect(this, &IosController::finished, &wait, &QEventLoop::quit);
|
||||||
wait.exec();
|
wait.exec();
|
||||||
@@ -849,7 +831,6 @@ bool IosController::shareText(const QStringList& filesToSend) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString IosController::openFile() {
|
QString IosController::openFile() {
|
||||||
#if !MACOS_NE
|
|
||||||
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.item"] inMode:UIDocumentPickerModeOpen];
|
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.item"] inMode:UIDocumentPickerModeOpen];
|
||||||
|
|
||||||
DocumentPickerDelegate *documentPickerDelegate = [[DocumentPickerDelegate alloc] init];
|
DocumentPickerDelegate *documentPickerDelegate = [[DocumentPickerDelegate alloc] init];
|
||||||
@@ -860,9 +841,8 @@ QString IosController::openFile() {
|
|||||||
|
|
||||||
[qtController presentViewController:documentPicker animated:YES completion:nil];
|
[qtController presentViewController:documentPicker animated:YES completion:nil];
|
||||||
|
|
||||||
#endif
|
|
||||||
__block QString filePath;
|
__block QString filePath;
|
||||||
#if !MACOS_NE
|
|
||||||
documentPickerDelegate.documentPickerClosedCallback = ^(NSString *path) {
|
documentPickerDelegate.documentPickerClosedCallback = ^(NSString *path) {
|
||||||
if (path) {
|
if (path) {
|
||||||
filePath = QString::fromUtf8(path.UTF8String);
|
filePath = QString::fromUtf8(path.UTF8String);
|
||||||
@@ -871,7 +851,7 @@ QString IosController::openFile() {
|
|||||||
}
|
}
|
||||||
emit finished();
|
emit finished();
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
QEventLoop wait;
|
QEventLoop wait;
|
||||||
QObject::connect(this, &IosController::finished, &wait, &QEventLoop::quit);
|
QObject::connect(this, &IosController::finished, &wait, &QEventLoop::quit);
|
||||||
wait.exec();
|
wait.exec();
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
#import <NetworkExtension/NetworkExtension.h>
|
#import <NetworkExtension/NetworkExtension.h>
|
||||||
#import <NetworkExtension/NETunnelProviderSession.h>
|
#import <NetworkExtension/NETunnelProviderSession.h>
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#if !MACOS_NE
|
|
||||||
#include <UIKit/UIKit.h>
|
#include <UIKit/UIKit.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <Security/Security.h>
|
#include <Security/Security.h>
|
||||||
|
|
||||||
class IosController;
|
class IosController;
|
||||||
@@ -21,10 +17,9 @@ class IosController;
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
typedef void (^DocumentPickerClosedCallback)(NSString *path);
|
typedef void (^DocumentPickerClosedCallback)(NSString *path);
|
||||||
#if !MACOS_NE
|
|
||||||
@interface DocumentPickerDelegate : NSObject <UIDocumentPickerDelegate>
|
@interface DocumentPickerDelegate : NSObject <UIDocumentPickerDelegate>
|
||||||
|
|
||||||
@property (nonatomic, copy) DocumentPickerClosedCallback documentPickerClosedCallback;
|
@property (nonatomic, copy) DocumentPickerClosedCallback documentPickerClosedCallback;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -26,8 +26,7 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#if !MACOS_NE
|
@implementation DocumentPickerDelegate
|
||||||
@implementation DocumentPickerDelegate
|
|
||||||
|
|
||||||
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls {
|
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls {
|
||||||
for (NSURL *url in urls) {
|
for (NSURL *url in urls) {
|
||||||
@@ -43,5 +42,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
#endif
|
|
||||||
@@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
#import <UserNotifications/UserNotifications.h>
|
#import <UserNotifications/UserNotifications.h>
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#if !MACOS_NE
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
@interface IOSNotificationDelegate
|
@interface IOSNotificationDelegate
|
||||||
@@ -89,86 +87,3 @@ void IOSNotificationHandler::notify(NotificationHandler::Message type, const QSt
|
|||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
|
||||||
// Removed the UIResponder and UIApplicationDelegate references as these are not available in macOS
|
|
||||||
@interface IOSNotificationDelegate
|
|
||||||
: NSObject <UNUserNotificationCenterDelegate> {
|
|
||||||
IOSNotificationHandler* m_iosNotificationHandler;
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation IOSNotificationDelegate
|
|
||||||
|
|
||||||
- (id)initWithObject:(IOSNotificationHandler*)notification {
|
|
||||||
self = [super init]; // Removed `super init` as it refers to UIResponder, which is iOS specific
|
|
||||||
if (self) {
|
|
||||||
m_iosNotificationHandler = notification;
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)userNotificationCenter:(UNUserNotificationCenter*)center
|
|
||||||
willPresentNotification:(UNNotification*)notification
|
|
||||||
withCompletionHandler:
|
|
||||||
(void (^)(UNNotificationPresentationOptions options))completionHandler {
|
|
||||||
Q_UNUSED(center)
|
|
||||||
completionHandler(UNNotificationPresentationOptionList | UNNotificationPresentationOptionBanner);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)userNotificationCenter:(UNUserNotificationCenter*)center
|
|
||||||
didReceiveNotificationResponse:(UNNotificationResponse*)response
|
|
||||||
withCompletionHandler:(void (^)())completionHandler {
|
|
||||||
Q_UNUSED(center)
|
|
||||||
Q_UNUSED(response)
|
|
||||||
completionHandler();
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
|
|
||||||
IOSNotificationHandler::IOSNotificationHandler(QObject* parent) : NotificationHandler(parent) {
|
|
||||||
|
|
||||||
UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];
|
|
||||||
[center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert |
|
|
||||||
UNAuthorizationOptionBadge)
|
|
||||||
completionHandler:^(BOOL granted, NSError* _Nullable error) {
|
|
||||||
Q_UNUSED(granted);
|
|
||||||
if (!error) {
|
|
||||||
m_delegate = [[IOSNotificationDelegate alloc] initWithObject:this];
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
IOSNotificationHandler::~IOSNotificationHandler() { }
|
|
||||||
|
|
||||||
void IOSNotificationHandler::notify(NotificationHandler::Message type, const QString& title,
|
|
||||||
const QString& message, int timerMsec) {
|
|
||||||
Q_UNUSED(type);
|
|
||||||
|
|
||||||
if (!m_delegate) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UNMutableNotificationContent* content = [[UNMutableNotificationContent alloc] init];
|
|
||||||
content.title = title.toNSString();
|
|
||||||
content.body = message.toNSString();
|
|
||||||
content.sound = [UNNotificationSound defaultSound];
|
|
||||||
|
|
||||||
int timerSec = timerMsec / 1000;
|
|
||||||
UNTimeIntervalNotificationTrigger* trigger =
|
|
||||||
[UNTimeIntervalNotificationTrigger triggerWithTimeInterval:timerSec repeats:NO];
|
|
||||||
|
|
||||||
UNNotificationRequest* request = [UNNotificationRequest requestWithIdentifier:@"amneziavpn"
|
|
||||||
content:content
|
|
||||||
trigger:trigger];
|
|
||||||
|
|
||||||
UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];
|
|
||||||
center.delegate = (id<UNUserNotificationCenterDelegate>)m_delegate;
|
|
||||||
|
|
||||||
[center addNotificationRequest:request
|
|
||||||
withCompletionHandler:^(NSError* _Nullable error) {
|
|
||||||
if (error) {
|
|
||||||
NSLog(@"Local Notification failed");
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ Ikev2Protocol::Ikev2Protocol(const QJsonObject &configuration, QObject* parent)
|
|||||||
Ikev2Protocol::~Ikev2Protocol()
|
Ikev2Protocol::~Ikev2Protocol()
|
||||||
{
|
{
|
||||||
qDebug() << "IpsecProtocol::~IpsecProtocol()";
|
qDebug() << "IpsecProtocol::~IpsecProtocol()";
|
||||||
|
disconnect_vpn();
|
||||||
Ikev2Protocol::stop();
|
Ikev2Protocol::stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ void Ikev2Protocol::stop()
|
|||||||
{
|
{
|
||||||
setConnectionState(Vpn::ConnectionState::Disconnecting);
|
setConnectionState(Vpn::ConnectionState::Disconnecting);
|
||||||
{
|
{
|
||||||
if (!disconnect_vpn()){
|
if (! disconnect_vpn() ){
|
||||||
qDebug()<<"We don't disconnect";
|
qDebug()<<"We don't disconnect";
|
||||||
setConnectionState(Vpn::ConnectionState::Error);
|
setConnectionState(Vpn::ConnectionState::Error);
|
||||||
}
|
}
|
||||||
@@ -310,9 +311,7 @@ bool Ikev2Protocol::connect_to_vpn(const QString & vpn_name){
|
|||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
bool Ikev2Protocol::disconnect_vpn(){
|
bool Ikev2Protocol::disconnect_vpn(){
|
||||||
if ( hRasConn != nullptr ){
|
if ( hRasConn != nullptr ){
|
||||||
auto ret = RasHangUp(hRasConn);
|
if ( RasHangUp(hRasConn) != ERROR_SUCCESS)
|
||||||
qDebug() << "RasHangUp " << ret;
|
|
||||||
if (ret != ERROR_SUCCESS)
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QThread::msleep(3000);
|
QThread::msleep(3000);
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ namespace amnezia
|
|||||||
|
|
||||||
constexpr char defaultPort[] = "51820";
|
constexpr char defaultPort[] = "51820";
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(MACOS_NE)
|
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||||
constexpr char defaultMtu[] = "1280";
|
constexpr char defaultMtu[] = "1280";
|
||||||
#else
|
#else
|
||||||
constexpr char defaultMtu[] = "1376";
|
constexpr char defaultMtu[] = "1376";
|
||||||
@@ -212,7 +212,7 @@ namespace amnezia
|
|||||||
namespace awg
|
namespace awg
|
||||||
{
|
{
|
||||||
constexpr char defaultPort[] = "55424";
|
constexpr char defaultPort[] = "55424";
|
||||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(MACOS_NE)
|
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||||
constexpr char defaultMtu[] = "1280";
|
constexpr char defaultMtu[] = "1280";
|
||||||
#else
|
#else
|
||||||
constexpr char defaultMtu[] = "1376";
|
constexpr char defaultMtu[] = "1376";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "core/errorstrings.h"
|
#include "core/errorstrings.h"
|
||||||
#include "vpnprotocol.h"
|
#include "vpnprotocol.h"
|
||||||
|
|
||||||
#if defined(Q_OS_WINDOWS) || defined(Q_OS_MACX) and !defined MACOS_NE || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
#if defined(Q_OS_WINDOWS) || defined(Q_OS_MACX) || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
#include "openvpnovercloakprotocol.h"
|
#include "openvpnovercloakprotocol.h"
|
||||||
#include "openvpnprotocol.h"
|
#include "openvpnprotocol.h"
|
||||||
#include "shadowsocksvpnprotocol.h"
|
#include "shadowsocksvpnprotocol.h"
|
||||||
@@ -109,7 +109,7 @@ VpnProtocol *VpnProtocol::factory(DockerContainer container, const QJsonObject &
|
|||||||
#if defined(Q_OS_WINDOWS)
|
#if defined(Q_OS_WINDOWS)
|
||||||
case DockerContainer::Ipsec: return new Ikev2Protocol(configuration);
|
case DockerContainer::Ipsec: return new Ikev2Protocol(configuration);
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_WINDOWS) || defined(Q_OS_MACX) and !defined MACOS_NE || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
#if defined(Q_OS_WINDOWS) || defined(Q_OS_MACX) || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
case DockerContainer::OpenVpn: return new OpenVpnProtocol(configuration);
|
case DockerContainer::OpenVpn: return new OpenVpnProtocol(configuration);
|
||||||
case DockerContainer::Cloak: return new OpenVpnOverCloakProtocol(configuration);
|
case DockerContainer::Cloak: return new OpenVpnOverCloakProtocol(configuration);
|
||||||
case DockerContainer::ShadowSocks: return new ShadowSocksVpnProtocol(configuration);
|
case DockerContainer::ShadowSocks: return new ShadowSocksVpnProtocol(configuration);
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ namespace
|
|||||||
constexpr char uuid[] = "installation_uuid";
|
constexpr char uuid[] = "installation_uuid";
|
||||||
constexpr char osVersion[] = "os_version";
|
constexpr char osVersion[] = "os_version";
|
||||||
constexpr char appVersion[] = "app_version";
|
constexpr char appVersion[] = "app_version";
|
||||||
constexpr char appLanguage[] = "app_language";
|
|
||||||
|
|
||||||
constexpr char userCountryCode[] = "user_country_code";
|
constexpr char userCountryCode[] = "user_country_code";
|
||||||
constexpr char serverCountryCode[] = "server_country_code";
|
constexpr char serverCountryCode[] = "server_country_code";
|
||||||
@@ -44,9 +43,6 @@ namespace
|
|||||||
constexpr char authData[] = "auth_data";
|
constexpr char authData[] = "auth_data";
|
||||||
|
|
||||||
constexpr char config[] = "config";
|
constexpr char config[] = "config";
|
||||||
|
|
||||||
constexpr char subscription[] = "subscription";
|
|
||||||
constexpr char endDate[] = "end_date";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ProtocolData
|
struct ProtocolData
|
||||||
@@ -167,7 +163,7 @@ namespace
|
|||||||
auto clientProtocolConfig =
|
auto clientProtocolConfig =
|
||||||
QJsonDocument::fromJson(serverProtocolConfig.value(config_key::last_config).toString().toUtf8()).object();
|
QJsonDocument::fromJson(serverProtocolConfig.value(config_key::last_config).toString().toUtf8()).object();
|
||||||
|
|
||||||
// TODO looks like this block can be removed after v1 configs EOL
|
//TODO looks like this block can be removed after v1 configs EOL
|
||||||
|
|
||||||
serverProtocolConfig[config_key::junkPacketCount] = clientProtocolConfig.value(config_key::junkPacketCount);
|
serverProtocolConfig[config_key::junkPacketCount] = clientProtocolConfig.value(config_key::junkPacketCount);
|
||||||
serverProtocolConfig[config_key::junkPacketMinSize] = clientProtocolConfig.value(config_key::junkPacketMinSize);
|
serverProtocolConfig[config_key::junkPacketMinSize] = clientProtocolConfig.value(config_key::junkPacketMinSize);
|
||||||
@@ -227,19 +223,6 @@ namespace
|
|||||||
|
|
||||||
return ErrorCode::NoError;
|
return ErrorCode::NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSubscriptionExpired(const QJsonObject &apiConfig)
|
|
||||||
{
|
|
||||||
auto subscription = apiConfig.value(configKey::subscription).toObject();
|
|
||||||
if (subscription.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
auto subscriptionEndDate = subscription.value(configKey::endDate).toString();
|
|
||||||
if (apiUtils::isSubscriptionExpired(subscriptionEndDate)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiConfigsController::ApiConfigsController(const QSharedPointer<ServersModel> &serversModel,
|
ApiConfigsController::ApiConfigsController(const QSharedPointer<ServersModel> &serversModel,
|
||||||
@@ -259,11 +242,6 @@ bool ApiConfigsController::exportNativeConfig(const QString &serverCountryCode,
|
|||||||
auto serverConfigObject = m_serversModel->getServerConfig(m_serversModel->getProcessedServerIndex());
|
auto serverConfigObject = m_serversModel->getServerConfig(m_serversModel->getProcessedServerIndex());
|
||||||
auto apiConfigObject = serverConfigObject.value(configKey::apiConfig).toObject();
|
auto apiConfigObject = serverConfigObject.value(configKey::apiConfig).toObject();
|
||||||
|
|
||||||
if (isSubscriptionExpired(apiConfigObject)) {
|
|
||||||
emit errorOccurred(ErrorCode::ApiSubscriptionExpiredError);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GatewayRequestData gatewayRequestData { QSysInfo::productType(),
|
GatewayRequestData gatewayRequestData { QSysInfo::productType(),
|
||||||
QString(APP_VERSION),
|
QString(APP_VERSION),
|
||||||
m_settings->getInstallationUuid(true),
|
m_settings->getInstallationUuid(true),
|
||||||
@@ -299,11 +277,6 @@ bool ApiConfigsController::revokeNativeConfig(const QString &serverCountryCode)
|
|||||||
auto serverConfigObject = m_serversModel->getServerConfig(m_serversModel->getProcessedServerIndex());
|
auto serverConfigObject = m_serversModel->getServerConfig(m_serversModel->getProcessedServerIndex());
|
||||||
auto apiConfigObject = serverConfigObject.value(configKey::apiConfig).toObject();
|
auto apiConfigObject = serverConfigObject.value(configKey::apiConfig).toObject();
|
||||||
|
|
||||||
if (isSubscriptionExpired(apiConfigObject)) {
|
|
||||||
emit errorOccurred(ErrorCode::ApiSubscriptionExpiredError);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GatewayRequestData gatewayRequestData { QSysInfo::productType(),
|
GatewayRequestData gatewayRequestData { QSysInfo::productType(),
|
||||||
QString(APP_VERSION),
|
QString(APP_VERSION),
|
||||||
m_settings->getInstallationUuid(true),
|
m_settings->getInstallationUuid(true),
|
||||||
@@ -349,7 +322,6 @@ bool ApiConfigsController::fillAvailableServices()
|
|||||||
{
|
{
|
||||||
QJsonObject apiPayload;
|
QJsonObject apiPayload;
|
||||||
apiPayload[configKey::osVersion] = QSysInfo::productType();
|
apiPayload[configKey::osVersion] = QSysInfo::productType();
|
||||||
apiPayload[configKey::appLanguage] = m_settings->getAppLanguage().name().split("_").first();
|
|
||||||
|
|
||||||
QByteArray responseBody;
|
QByteArray responseBody;
|
||||||
ErrorCode errorCode = executeRequest(QString("%1v1/services"), apiPayload, responseBody);
|
ErrorCode errorCode = executeRequest(QString("%1v1/services"), apiPayload, responseBody);
|
||||||
@@ -424,11 +396,6 @@ bool ApiConfigsController::updateServiceFromGateway(const int serverIndex, const
|
|||||||
auto serverConfig = m_serversModel->getServerConfig(serverIndex);
|
auto serverConfig = m_serversModel->getServerConfig(serverIndex);
|
||||||
auto apiConfig = serverConfig.value(configKey::apiConfig).toObject();
|
auto apiConfig = serverConfig.value(configKey::apiConfig).toObject();
|
||||||
|
|
||||||
if (isSubscriptionExpired(apiConfig)) {
|
|
||||||
emit errorOccurred(ErrorCode::ApiSubscriptionExpiredError);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GatewayRequestData gatewayRequestData { QSysInfo::productType(),
|
GatewayRequestData gatewayRequestData { QSysInfo::productType(),
|
||||||
QString(APP_VERSION),
|
QString(APP_VERSION),
|
||||||
m_settings->getInstallationUuid(true),
|
m_settings->getInstallationUuid(true),
|
||||||
@@ -535,11 +502,6 @@ bool ApiConfigsController::deactivateDevice()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSubscriptionExpired(apiConfigObject)) {
|
|
||||||
emit errorOccurred(ErrorCode::ApiSubscriptionExpiredError);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GatewayRequestData gatewayRequestData { QSysInfo::productType(),
|
GatewayRequestData gatewayRequestData { QSysInfo::productType(),
|
||||||
QString(APP_VERSION),
|
QString(APP_VERSION),
|
||||||
m_settings->getInstallationUuid(true),
|
m_settings->getInstallationUuid(true),
|
||||||
@@ -574,11 +536,6 @@ bool ApiConfigsController::deactivateExternalDevice(const QString &uuid, const Q
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSubscriptionExpired(apiConfigObject)) {
|
|
||||||
emit errorOccurred(ErrorCode::ApiSubscriptionExpiredError);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GatewayRequestData gatewayRequestData { QSysInfo::productType(),
|
GatewayRequestData gatewayRequestData { QSysInfo::productType(),
|
||||||
QString(APP_VERSION),
|
QString(APP_VERSION),
|
||||||
uuid,
|
uuid,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "connectionController.h"
|
#include "connectionController.h"
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(MACOS_NE)
|
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#else
|
#else
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@@ -32,9 +32,8 @@ ConnectionController::ConnectionController(const QSharedPointer<ServersModel> &s
|
|||||||
|
|
||||||
void ConnectionController::openConnection()
|
void ConnectionController::openConnection()
|
||||||
{
|
{
|
||||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
||||||
if (!Utils::processIsRunning(Utils::executable(SERVICE_NAME, false), true))
|
if (!Utils::processIsRunning(Utils::executable(SERVICE_NAME, false), true)) {
|
||||||
{
|
|
||||||
emit connectionErrorOccurred(ErrorCode::AmneziaServiceNotRunning);
|
emit connectionErrorOccurred(ErrorCode::AmneziaServiceNotRunning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
#include "platforms/android/android_controller.h"
|
#include "platforms/android/android_controller.h"
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_IOS) || defined(MACOS_NE)
|
#ifdef Q_OS_IOS
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -595,7 +595,7 @@ void ImportController::startDecodingQr()
|
|||||||
m_totalQrCodeChunksCount = 0;
|
m_totalQrCodeChunksCount = 0;
|
||||||
m_receivedQrCodeChunksCount = 0;
|
m_receivedQrCodeChunksCount = 0;
|
||||||
|
|
||||||
#if defined(Q_OS_IOS) || defined(MACOS_NE)
|
#if defined Q_OS_IOS
|
||||||
m_isQrCodeProcessed = true;
|
m_isQrCodeProcessed = true;
|
||||||
#endif
|
#endif
|
||||||
#if defined Q_OS_ANDROID
|
#if defined Q_OS_ANDROID
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ void ListViewFocusController::previousDelegate()
|
|||||||
case Section::Default: {
|
case Section::Default: {
|
||||||
if (hasFooter()) {
|
if (hasFooter()) {
|
||||||
m_currentSection = Section::Footer;
|
m_currentSection = Section::Footer;
|
||||||
viewAtCurrentIndex();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
@@ -128,11 +127,9 @@ void ListViewFocusController::previousDelegate()
|
|||||||
case Section::Delegate: {
|
case Section::Delegate: {
|
||||||
if (m_delegateIndex > 0) {
|
if (m_delegateIndex > 0) {
|
||||||
setDelegateIndex(m_delegateIndex - 1);
|
setDelegateIndex(m_delegateIndex - 1);
|
||||||
viewAtCurrentIndex();
|
|
||||||
break;
|
break;
|
||||||
} else if (hasHeader()) {
|
} else if (hasHeader()) {
|
||||||
m_currentSection = Section::Header;
|
m_currentSection = Section::Header;
|
||||||
viewAtCurrentIndex();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
@@ -140,7 +137,6 @@ void ListViewFocusController::previousDelegate()
|
|||||||
case Section::Header: {
|
case Section::Header: {
|
||||||
m_isReturnNeeded = true;
|
m_isReturnNeeded = true;
|
||||||
m_currentSection = Section::Default;
|
m_currentSection = Section::Default;
|
||||||
viewAtCurrentIndex();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@@ -279,7 +275,7 @@ bool ListViewFocusController::isFirstFocusItemInListView() const
|
|||||||
return isFirstFocusItemInDelegate() && (m_delegateIndex == 0) && !hasHeader();
|
return isFirstFocusItemInDelegate() && (m_delegateIndex == 0) && !hasHeader();
|
||||||
}
|
}
|
||||||
case Section::Header: {
|
case Section::Header: {
|
||||||
return isFirstFocusItemInDelegate();
|
isFirstFocusItemInDelegate();
|
||||||
}
|
}
|
||||||
case Section::Default: {
|
case Section::Default: {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
#include "pageController.h"
|
#include "pageController.h"
|
||||||
#include "utils/converter.h"
|
#include "utils/converter.h"
|
||||||
#include "core/errorstrings.h"
|
#include "core/errorstrings.h"
|
||||||
#if defined(MACOS_NE)
|
|
||||||
#include "platforms/ios/ios_controller.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(MACOS_NE)
|
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#else
|
#else
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@@ -28,12 +25,8 @@ PageController::PageController(const QSharedPointer<ServersModel> &serversModel,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined Q_OS_MACX
|
#if defined Q_OS_MACX
|
||||||
connect(this, &PageController::raiseMainWindow, []() {
|
connect(this, &PageController::raiseMainWindow, []() { setDockIconVisible(true); });
|
||||||
setDockIconVisible(true);
|
connect(this, &PageController::hideMainWindow, []() { setDockIconVisible(false); });
|
||||||
});
|
|
||||||
connect(this, &PageController::hideMainWindow, []() {
|
|
||||||
setDockIconVisible(false);
|
|
||||||
});
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
connect(this, qOverload<ErrorCode>(&PageController::showErrorMessage), this, &PageController::onShowErrorMessage);
|
connect(this, qOverload<ErrorCode>(&PageController::showErrorMessage), this, &PageController::onShowErrorMessage);
|
||||||
@@ -63,11 +56,14 @@ QString PageController::getPagePath(PageLoader::PageEnum page)
|
|||||||
|
|
||||||
void PageController::closeWindow()
|
void PageController::closeWindow()
|
||||||
{
|
{
|
||||||
// On mobile platforms, quit app on close; on desktop, just hide window
|
#ifdef Q_OS_ANDROID
|
||||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
#else
|
#else
|
||||||
emit hideMainWindow();
|
if (m_serversModel->getServersCount() == 0) {
|
||||||
|
qApp->quit();
|
||||||
|
} else {
|
||||||
|
emit hideMainWindow();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +114,7 @@ void PageController::showOnStartup()
|
|||||||
} else {
|
} else {
|
||||||
#if defined(Q_OS_WIN) || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
#if defined(Q_OS_WIN) || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
emit hideMainWindow();
|
emit hideMainWindow();
|
||||||
#elif defined(Q_OS_MACX)
|
#elif defined Q_OS_MACX
|
||||||
setDockIconVisible(false);
|
setDockIconVisible(false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace PageLoader
|
|||||||
PageSettingsApiDevices,
|
PageSettingsApiDevices,
|
||||||
PageSettingsApiSubscriptionKey,
|
PageSettingsApiSubscriptionKey,
|
||||||
PageSettingsKillSwitchExceptions,
|
PageSettingsKillSwitchExceptions,
|
||||||
|
|
||||||
PageServiceSftpSettings,
|
PageServiceSftpSettings,
|
||||||
PageServiceTorWebsiteSettings,
|
PageServiceTorWebsiteSettings,
|
||||||
PageServiceDnsSettings,
|
PageServiceDnsSettings,
|
||||||
@@ -125,8 +125,6 @@ signals:
|
|||||||
void goToPageViewConfig();
|
void goToPageViewConfig();
|
||||||
void goToPageSettingsServerServices();
|
void goToPageSettingsServerServices();
|
||||||
void goToPageSettingsBackup();
|
void goToPageSettingsBackup();
|
||||||
void goToShareConnectionPage(QString headerText, QString configContentHeaderText, QString configCaption, QString configExtension,
|
|
||||||
QString configFileName);
|
|
||||||
|
|
||||||
void closePage();
|
void closePage();
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "platforms/android/android_controller.h"
|
#include "platforms/android/android_controller.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_IOS) || defined(MACOS_NE)
|
#ifdef Q_OS_IOS
|
||||||
#include <AmneziaVPN-Swift.h>
|
#include <AmneziaVPN-Swift.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ bool SettingsController::isLoggingEnabled()
|
|||||||
void SettingsController::toggleLogging(bool enable)
|
void SettingsController::toggleLogging(bool enable)
|
||||||
{
|
{
|
||||||
m_settings->setSaveLogs(enable);
|
m_settings->setSaveLogs(enable);
|
||||||
#if defined(Q_OS_IOS)
|
#ifdef Q_OS_IOS
|
||||||
AmneziaVPN::toggleLogging(enable);
|
AmneziaVPN::toggleLogging(enable);
|
||||||
#endif
|
#endif
|
||||||
if (enable == true) {
|
if (enable == true) {
|
||||||
@@ -157,12 +157,8 @@ void SettingsController::backupAppConfig(const QString &fileName)
|
|||||||
|
|
||||||
void SettingsController::restoreAppConfig(const QString &fileName)
|
void SettingsController::restoreAppConfig(const QString &fileName)
|
||||||
{
|
{
|
||||||
QFile file(fileName);
|
QByteArray data;
|
||||||
|
SystemController::readFile(fileName, data);
|
||||||
file.open(QIODevice::ReadOnly);
|
|
||||||
|
|
||||||
QByteArray data = file.readAll();
|
|
||||||
|
|
||||||
restoreAppConfigFromData(data);
|
restoreAppConfigFromData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +237,7 @@ void SettingsController::clearSettings()
|
|||||||
|
|
||||||
emit changeSettingsFinished(tr("All settings have been reset to default values"));
|
emit changeSettingsFinished(tr("All settings have been reset to default values"));
|
||||||
|
|
||||||
#if defined(Q_OS_IOS) || defined(MACOS_NE)
|
#ifdef Q_OS_IOS
|
||||||
AmneziaVPN::clearSettings();
|
AmneziaVPN::clearSettings();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "platforms/android/android_controller.h"
|
#include "platforms/android/android_controller.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_IOS) || defined(MACOS_NE)
|
#ifdef Q_OS_IOS
|
||||||
#include "platforms/ios/ios_controller.h"
|
#include "platforms/ios/ios_controller.h"
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -58,10 +58,8 @@ void SystemController::saveFile(const QString &fileName, const QString &data)
|
|||||||
const auto url = fi.absoluteDir().absolutePath();
|
const auto url = fi.absoluteDir().absolutePath();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MACOS_NE
|
|
||||||
QDesktopServices::openUrl(url);
|
QDesktopServices::openUrl(url);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SystemController::readFile(const QString &fileName, QByteArray &data)
|
bool SystemController::readFile(const QString &fileName, QByteArray &data)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ QVariant ApiAccountInfoModel::data(const QModelIndex &index, int role) const
|
|||||||
return tr("Active");
|
return tr("Active");
|
||||||
}
|
}
|
||||||
|
|
||||||
return apiUtils::isSubscriptionExpired(m_accountInfoData.subscriptionEndDate) ? tr("<p><a style=\"color: #EB5757;\">Inactive</a>") : tr("Active");
|
return apiUtils::isSubscriptionExpired(m_accountInfoData.subscriptionEndDate) ? tr("Inactive") : tr("Active");
|
||||||
}
|
}
|
||||||
case EndDateRole: {
|
case EndDateRole: {
|
||||||
if (m_accountInfoData.configType == apiDefs::ConfigType::AmneziaFreeV3) {
|
if (m_accountInfoData.configType == apiDefs::ConfigType::AmneziaFreeV3) {
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ namespace
|
|||||||
constexpr char serviceInfo[] = "service_info";
|
constexpr char serviceInfo[] = "service_info";
|
||||||
constexpr char serviceType[] = "service_type";
|
constexpr char serviceType[] = "service_type";
|
||||||
constexpr char serviceProtocol[] = "service_protocol";
|
constexpr char serviceProtocol[] = "service_protocol";
|
||||||
constexpr char serviceDescription[] = "service_description";
|
|
||||||
|
|
||||||
constexpr char name[] = "name";
|
constexpr char name[] = "name";
|
||||||
constexpr char price[] = "price";
|
constexpr char price[] = "price";
|
||||||
@@ -23,10 +22,6 @@ namespace
|
|||||||
constexpr char timelimit[] = "timelimit";
|
constexpr char timelimit[] = "timelimit";
|
||||||
constexpr char region[] = "region";
|
constexpr char region[] = "region";
|
||||||
|
|
||||||
constexpr char description[] = "description";
|
|
||||||
constexpr char cardDescription[] = "card_description";
|
|
||||||
constexpr char features[] = "features";
|
|
||||||
|
|
||||||
constexpr char availableCountries[] = "available_countries";
|
constexpr char availableCountries[] = "available_countries";
|
||||||
|
|
||||||
constexpr char storeEndpoint[] = "store_endpoint";
|
constexpr char storeEndpoint[] = "store_endpoint";
|
||||||
@@ -70,9 +65,11 @@ QVariant ApiServicesModel::data(const QModelIndex &index, int role) const
|
|||||||
case CardDescriptionRole: {
|
case CardDescriptionRole: {
|
||||||
auto speed = apiServiceData.serviceInfo.speed;
|
auto speed = apiServiceData.serviceInfo.speed;
|
||||||
if (serviceType == serviceType::amneziaPremium) {
|
if (serviceType == serviceType::amneziaPremium) {
|
||||||
return apiServiceData.serviceInfo.cardDescription.arg(speed);
|
return tr("Amnezia Premium is classic VPN for seamless work, downloading large files, and watching videos. "
|
||||||
|
"Access all websites and online resources. Speeds up to %1 Mbps.")
|
||||||
|
.arg(speed);
|
||||||
} else if (serviceType == serviceType::amneziaFree) {
|
} else if (serviceType == serviceType::amneziaFree) {
|
||||||
QString description = apiServiceData.serviceInfo.cardDescription;
|
QString description = tr("Amnezia Free provides unlimited, free access to a basic set of websites and apps, including Facebook, Instagram, Twitter (X), Discord, Telegram, and more. YouTube is not included in the free plan.");
|
||||||
if (!isServiceAvailable) {
|
if (!isServiceAvailable) {
|
||||||
description += tr("<p><a style=\"color: #EB5757;\">Not available in your region. If you have VPN enabled, disable it, "
|
description += tr("<p><a style=\"color: #EB5757;\">Not available in your region. If you have VPN enabled, disable it, "
|
||||||
"return to the previous screen, and try again.</a>");
|
"return to the previous screen, and try again.</a>");
|
||||||
@@ -81,7 +78,12 @@ QVariant ApiServicesModel::data(const QModelIndex &index, int role) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ServiceDescriptionRole: {
|
case ServiceDescriptionRole: {
|
||||||
return apiServiceData.serviceInfo.description;
|
if (serviceType == serviceType::amneziaPremium) {
|
||||||
|
return tr("Amnezia Premium is classic VPN for for seamless work, downloading large files, and watching videos. "
|
||||||
|
"Access all websites and online resources.");
|
||||||
|
} else {
|
||||||
|
return tr("Amnezia Free provides unlimited, free access to a basic set of websites and apps, including Facebook, Instagram, Twitter (X), Discord, Telegram, and more. YouTube is not included in the free plan.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case IsServiceAvailableRole: {
|
case IsServiceAvailableRole: {
|
||||||
if (serviceType == serviceType::amneziaFree) {
|
if (serviceType == serviceType::amneziaFree) {
|
||||||
@@ -105,7 +107,13 @@ QVariant ApiServicesModel::data(const QModelIndex &index, int role) const
|
|||||||
return apiServiceData.serviceInfo.region;
|
return apiServiceData.serviceInfo.region;
|
||||||
}
|
}
|
||||||
case FeaturesRole: {
|
case FeaturesRole: {
|
||||||
return apiServiceData.serviceInfo.features;
|
if (serviceType == serviceType::amneziaPremium) {
|
||||||
|
return tr("");
|
||||||
|
} else {
|
||||||
|
return tr("VPN will open only popular sites blocked in your region, such as Instagram, Facebook, Twitter and others. "
|
||||||
|
"Other sites will be opened from your real IP address, "
|
||||||
|
"<a href=\"%1\" style=\"color: #FBB26A;\">more details on the website.</a>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case PriceRole: {
|
case PriceRole: {
|
||||||
auto price = apiServiceData.serviceInfo.price;
|
auto price = apiServiceData.serviceInfo.price;
|
||||||
@@ -117,13 +125,6 @@ QVariant ApiServicesModel::data(const QModelIndex &index, int role) const
|
|||||||
case EndDateRole: {
|
case EndDateRole: {
|
||||||
return QDateTime::fromString(apiServiceData.subscription.endDate, Qt::ISODate).toLocalTime().toString("d MMM yyyy");
|
return QDateTime::fromString(apiServiceData.subscription.endDate, Qt::ISODate).toLocalTime().toString("d MMM yyyy");
|
||||||
}
|
}
|
||||||
case OrderRole: {
|
|
||||||
if (serviceType == serviceType::amneziaPremium) {
|
|
||||||
return 0;
|
|
||||||
} else if (serviceType == serviceType::amneziaFree) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
@@ -223,7 +224,6 @@ QHash<int, QByteArray> ApiServicesModel::roleNames() const
|
|||||||
roles[FeaturesRole] = "features";
|
roles[FeaturesRole] = "features";
|
||||||
roles[PriceRole] = "price";
|
roles[PriceRole] = "price";
|
||||||
roles[EndDateRole] = "endDate";
|
roles[EndDateRole] = "endDate";
|
||||||
roles[OrderRole] = "order";
|
|
||||||
|
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
@@ -234,7 +234,6 @@ ApiServicesModel::ApiServicesData ApiServicesModel::getApiServicesData(const QJs
|
|||||||
auto serviceType = data.value(configKey::serviceType).toString();
|
auto serviceType = data.value(configKey::serviceType).toString();
|
||||||
auto serviceProtocol = data.value(configKey::serviceProtocol).toString();
|
auto serviceProtocol = data.value(configKey::serviceProtocol).toString();
|
||||||
auto availableCountries = data.value(configKey::availableCountries).toArray();
|
auto availableCountries = data.value(configKey::availableCountries).toArray();
|
||||||
auto serviceDescription = data.value(configKey::serviceDescription).toObject();
|
|
||||||
|
|
||||||
auto subscriptionObject = data.value(configKey::subscription).toObject();
|
auto subscriptionObject = data.value(configKey::subscription).toObject();
|
||||||
|
|
||||||
@@ -245,10 +244,6 @@ ApiServicesModel::ApiServicesData ApiServicesModel::getApiServicesData(const QJs
|
|||||||
serviceData.serviceInfo.speed = serviceInfo.value(configKey::speed).toString();
|
serviceData.serviceInfo.speed = serviceInfo.value(configKey::speed).toString();
|
||||||
serviceData.serviceInfo.timeLimit = serviceInfo.value(configKey::timelimit).toString();
|
serviceData.serviceInfo.timeLimit = serviceInfo.value(configKey::timelimit).toString();
|
||||||
|
|
||||||
serviceData.serviceInfo.cardDescription = serviceDescription.value(configKey::cardDescription).toString();
|
|
||||||
serviceData.serviceInfo.description = serviceDescription.value(configKey::description).toString();
|
|
||||||
serviceData.serviceInfo.features = serviceDescription.value(configKey::features).toString();
|
|
||||||
|
|
||||||
serviceData.type = serviceType;
|
serviceData.type = serviceType;
|
||||||
serviceData.protocol = serviceProtocol;
|
serviceData.protocol = serviceProtocol;
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ public:
|
|||||||
RegionRole,
|
RegionRole,
|
||||||
FeaturesRole,
|
FeaturesRole,
|
||||||
PriceRole,
|
PriceRole,
|
||||||
EndDateRole,
|
EndDateRole
|
||||||
OrderRole
|
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit ApiServicesModel(QObject *parent = nullptr);
|
explicit ApiServicesModel(QObject *parent = nullptr);
|
||||||
@@ -59,10 +58,6 @@ private:
|
|||||||
QString region;
|
QString region;
|
||||||
QString price;
|
QString price;
|
||||||
|
|
||||||
QString description;
|
|
||||||
QString features;
|
|
||||||
QString cardDescription;
|
|
||||||
|
|
||||||
QJsonObject object;
|
QJsonObject object;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -191,14 +191,14 @@ QJsonObject AwgConfigModel::getConfig()
|
|||||||
jsonConfig[config_key::junkPacketCount] = m_clientProtocolConfig[config_key::junkPacketCount];
|
jsonConfig[config_key::junkPacketCount] = m_clientProtocolConfig[config_key::junkPacketCount];
|
||||||
jsonConfig[config_key::junkPacketMinSize] = m_clientProtocolConfig[config_key::junkPacketMinSize];
|
jsonConfig[config_key::junkPacketMinSize] = m_clientProtocolConfig[config_key::junkPacketMinSize];
|
||||||
jsonConfig[config_key::junkPacketMaxSize] = m_clientProtocolConfig[config_key::junkPacketMaxSize];
|
jsonConfig[config_key::junkPacketMaxSize] = m_clientProtocolConfig[config_key::junkPacketMaxSize];
|
||||||
jsonConfig[config_key::specialJunk1] = m_clientProtocolConfig[config_key::specialJunk1].toString().trimmed();
|
jsonConfig[config_key::specialJunk1] = m_clientProtocolConfig[config_key::specialJunk1];
|
||||||
jsonConfig[config_key::specialJunk2] = m_clientProtocolConfig[config_key::specialJunk2].toString().trimmed();
|
jsonConfig[config_key::specialJunk2] = m_clientProtocolConfig[config_key::specialJunk2];
|
||||||
jsonConfig[config_key::specialJunk3] = m_clientProtocolConfig[config_key::specialJunk3].toString().trimmed();
|
jsonConfig[config_key::specialJunk3] = m_clientProtocolConfig[config_key::specialJunk3];
|
||||||
jsonConfig[config_key::specialJunk4] = m_clientProtocolConfig[config_key::specialJunk4].toString().trimmed();
|
jsonConfig[config_key::specialJunk4] = m_clientProtocolConfig[config_key::specialJunk4];
|
||||||
jsonConfig[config_key::specialJunk5] = m_clientProtocolConfig[config_key::specialJunk5].toString().trimmed();
|
jsonConfig[config_key::specialJunk5] = m_clientProtocolConfig[config_key::specialJunk5];
|
||||||
jsonConfig[config_key::controlledJunk1] = m_clientProtocolConfig[config_key::controlledJunk1].toString().trimmed();
|
jsonConfig[config_key::controlledJunk1] = m_clientProtocolConfig[config_key::controlledJunk1];
|
||||||
jsonConfig[config_key::controlledJunk2] = m_clientProtocolConfig[config_key::controlledJunk2].toString().trimmed();
|
jsonConfig[config_key::controlledJunk2] = m_clientProtocolConfig[config_key::controlledJunk2];
|
||||||
jsonConfig[config_key::controlledJunk3] = m_clientProtocolConfig[config_key::controlledJunk3].toString().trimmed();
|
jsonConfig[config_key::controlledJunk3] = m_clientProtocolConfig[config_key::controlledJunk3];
|
||||||
jsonConfig[config_key::specialHandshakeTimeout] = m_clientProtocolConfig[config_key::specialHandshakeTimeout];
|
jsonConfig[config_key::specialHandshakeTimeout] = m_clientProtocolConfig[config_key::specialHandshakeTimeout];
|
||||||
|
|
||||||
m_serverProtocolConfig[config_key::last_config] = QString(QJsonDocument(jsonConfig).toJson());
|
m_serverProtocolConfig[config_key::last_config] = QString(QJsonDocument(jsonConfig).toJson());
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "core/controllers/serverController.h"
|
#include "core/controllers/serverController.h"
|
||||||
#include "core/networkUtilities.h"
|
#include "core/networkUtilities.h"
|
||||||
|
|
||||||
#if defined(Q_OS_IOS) || defined(MACOS_NE)
|
#ifdef Q_OS_IOS
|
||||||
#include <AmneziaVPN-Swift.h>
|
#include <AmneziaVPN-Swift.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -782,7 +782,7 @@ void ServersModel::removeApiConfig(const int serverIndex)
|
|||||||
{
|
{
|
||||||
auto serverConfig = getServerConfig(serverIndex);
|
auto serverConfig = getServerConfig(serverIndex);
|
||||||
|
|
||||||
#if defined(Q_OS_IOS) || defined(MACOS_NE)
|
#ifdef Q_OS_IOS
|
||||||
QString vpncName = QString("%1 (%2) %3")
|
QString vpncName = QString("%1 (%2) %3")
|
||||||
.arg(serverConfig[config_key::description].toString())
|
.arg(serverConfig[config_key::description].toString())
|
||||||
.arg(serverConfig[config_key::hostName].toString())
|
.arg(serverConfig[config_key::hostName].toString())
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
#ifndef NE_NOTIFICATION_HANDLER_H
|
|
||||||
#define NE_NOTIFICATION_HANDLER_H
|
|
||||||
|
|
||||||
#include "notificationhandler.h"
|
|
||||||
#include <QMenu>
|
|
||||||
#include <QAction>
|
|
||||||
|
|
||||||
class MacOSStatusIcon;
|
|
||||||
|
|
||||||
class NEStatusBarNotificationHandler : public NotificationHandler {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit NEStatusBarNotificationHandler(QObject* parent);
|
|
||||||
~NEStatusBarNotificationHandler() override;
|
|
||||||
|
|
||||||
void setConnectionState(Vpn::ConnectionState state) override;
|
|
||||||
void onTranslationsUpdated() override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void notify(Message type, const QString& title,
|
|
||||||
const QString& message, int timerMsec) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void buildMenu();
|
|
||||||
|
|
||||||
QMenu m_menu;
|
|
||||||
MacOSStatusIcon* m_statusIcon;
|
|
||||||
|
|
||||||
QAction* m_actionShow;
|
|
||||||
QAction* m_actionConnect;
|
|
||||||
QAction* m_actionDisconnect;
|
|
||||||
QAction* m_actionVisitWebsite;
|
|
||||||
QAction* m_actionQuit;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // NE_NOTIFICATION_HANDLER_H
|
|
||||||
@@ -11,12 +11,18 @@
|
|||||||
# include "systemtray_notificationhandler.h"
|
# include "systemtray_notificationhandler.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
NotificationHandler* NotificationHandler::create(QObject* parent) {
|
NotificationHandler* NotificationHandler::create(QObject* parent) {
|
||||||
#if defined(Q_OS_IOS)
|
#if defined(Q_OS_IOS)
|
||||||
return new IOSNotificationHandler(parent);
|
return new IOSNotificationHandler(parent);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
# if defined(Q_OS_LINUX)
|
||||||
|
//if (LinuxSystemTrayNotificationHandler::requiredCustomImpl()) {
|
||||||
|
// return new LinuxSystemTrayNotificationHandler(parent);
|
||||||
|
//}
|
||||||
|
# endif
|
||||||
|
|
||||||
return new SystemTrayNotificationHandler(parent);
|
return new SystemTrayNotificationHandler(parent);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,17 +173,15 @@ CheckBox {
|
|||||||
enabled: false
|
enabled: false
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onEnterPressed: event => handleSwitch(event)
|
|
||||||
Keys.onReturnPressed: event => handleSwitch(event)
|
|
||||||
Keys.onSpacePressed: event => handleSwitch(event)
|
|
||||||
|
|
||||||
function handleSwitch(event) {
|
Keys.onEnterPressed: {
|
||||||
if (!event.isAutoRepeat) {
|
root.checked = !root.checked
|
||||||
root.checked = !root.checked
|
|
||||||
root.checkedChanged()
|
|
||||||
}
|
|
||||||
event.accepted = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Keys.onReturnPressed: {
|
||||||
|
root.checked = !root.checked
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,20 +7,17 @@ import Style 1.0
|
|||||||
import "TextTypes"
|
import "TextTypes"
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: root
|
|
||||||
|
|
||||||
property string imageSource
|
property string imageSource
|
||||||
property string leftText
|
property string leftText
|
||||||
property var rightText
|
property var rightText
|
||||||
property bool isRightTextUndefined: rightText === undefined
|
property bool isRightTextUndefined: rightText === undefined
|
||||||
property int rightTextFormat: Text.PlainText
|
|
||||||
|
|
||||||
visible: !isRightTextUndefined
|
visible: !isRightTextUndefined
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
Layout.preferredHeight: 18
|
Layout.preferredHeight: 18
|
||||||
Layout.preferredWidth: 18
|
Layout.preferredWidth: 18
|
||||||
source: root.imageSource
|
source: imageSource
|
||||||
}
|
}
|
||||||
|
|
||||||
ListItemTitleType {
|
ListItemTitleType {
|
||||||
@@ -28,15 +25,14 @@ RowLayout {
|
|||||||
Layout.rightMargin: 10
|
Layout.rightMargin: 10
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
|
|
||||||
text: root.leftText
|
text: leftText
|
||||||
}
|
}
|
||||||
|
|
||||||
ParagraphTextType {
|
ParagraphTextType {
|
||||||
visible: root.rightText !== ""
|
visible: rightText !== ""
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignLeft
|
Layout.alignment: Qt.AlignLeft
|
||||||
|
|
||||||
text: root.isRightTextUndefined ? "" : root.rightText
|
text: isRightTextUndefined ? "" : rightText
|
||||||
textFormat: root.rightTextFormat
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ Switch {
|
|||||||
function handleSwitch(event) {
|
function handleSwitch(event) {
|
||||||
if (!event.isAutoRepeat) {
|
if (!event.isAutoRepeat) {
|
||||||
root.checked = !root.checked
|
root.checked = !root.checked
|
||||||
root.toggled()
|
root.checkedChanged()
|
||||||
}
|
}
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ PageType {
|
|||||||
text: qsTr("Auto-negotiate encryption")
|
text: qsTr("Auto-negotiate encryption")
|
||||||
checked: autoNegotiateEncryprion
|
checked: autoNegotiateEncryprion
|
||||||
|
|
||||||
onToggled: function() {
|
onCheckedChanged: {
|
||||||
if (checked !== autoNegotiateEncryprion) {
|
if (checked !== autoNegotiateEncryprion) {
|
||||||
autoNegotiateEncryprion = checked
|
autoNegotiateEncryprion = checked
|
||||||
}
|
}
|
||||||
@@ -320,7 +320,7 @@ PageType {
|
|||||||
|
|
||||||
text: qsTr("Additional client configuration commands")
|
text: qsTr("Additional client configuration commands")
|
||||||
|
|
||||||
onToggled: function() {
|
onCheckedChanged: {
|
||||||
if (!checked) {
|
if (!checked) {
|
||||||
additionalClientCommands = ""
|
additionalClientCommands = ""
|
||||||
}
|
}
|
||||||
@@ -357,7 +357,7 @@ PageType {
|
|||||||
|
|
||||||
text: qsTr("Additional server configuration commands")
|
text: qsTr("Additional server configuration commands")
|
||||||
|
|
||||||
onToggled: function() {
|
onCheckedChanged: {
|
||||||
if (!checked) {
|
if (!checked) {
|
||||||
additionalServerCommands = ""
|
additionalServerCommands = ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ PageType {
|
|||||||
readonly property string title: qsTr("Subscription Status")
|
readonly property string title: qsTr("Subscription Status")
|
||||||
readonly property string contentKey: "subscriptionStatus"
|
readonly property string contentKey: "subscriptionStatus"
|
||||||
readonly property string objectImageSource: "qrc:/images/controls/info.svg"
|
readonly property string objectImageSource: "qrc:/images/controls/info.svg"
|
||||||
readonly property bool isRichText: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
@@ -38,7 +37,6 @@ PageType {
|
|||||||
readonly property string title: qsTr("Valid Until")
|
readonly property string title: qsTr("Valid Until")
|
||||||
readonly property string contentKey: "endDate"
|
readonly property string contentKey: "endDate"
|
||||||
readonly property string objectImageSource: "qrc:/images/controls/history.svg"
|
readonly property string objectImageSource: "qrc:/images/controls/history.svg"
|
||||||
readonly property bool isRichText: false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
@@ -47,7 +45,6 @@ PageType {
|
|||||||
readonly property string title: qsTr("Active Connections")
|
readonly property string title: qsTr("Active Connections")
|
||||||
readonly property string contentKey: "connectedDevices"
|
readonly property string contentKey: "connectedDevices"
|
||||||
readonly property string objectImageSource: "qrc:/images/controls/monitor.svg"
|
readonly property string objectImageSource: "qrc:/images/controls/monitor.svg"
|
||||||
readonly property bool isRichText: false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
property var processedServer
|
property var processedServer
|
||||||
@@ -137,7 +134,6 @@ PageType {
|
|||||||
imageSource: objectImageSource
|
imageSource: objectImageSource
|
||||||
leftText: title
|
leftText: title
|
||||||
rightText: ApiAccountInfoModel.data(contentKey)
|
rightText: ApiAccountInfoModel.data(contentKey)
|
||||||
rightTextFormat: isRichText ? Text.RichText : Text.PlainText
|
|
||||||
|
|
||||||
visible: rightText !== ""
|
visible: rightText !== ""
|
||||||
}
|
}
|
||||||
@@ -218,6 +214,9 @@ PageType {
|
|||||||
ApiConfigsController.prepareVpnKeyExport()
|
ApiConfigsController.prepareVpnKeyExport()
|
||||||
|
|
||||||
PageController.showBusyIndicator(false)
|
PageController.showBusyIndicator(false)
|
||||||
|
|
||||||
|
// Navigate to PageShareConnection page
|
||||||
|
//PageController.goToPage(PageEnum.PageShareConnection)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,14 @@ PageType {
|
|||||||
Layout.leftMargin: 16
|
Layout.leftMargin: 16
|
||||||
Layout.rightMargin: 16
|
Layout.rightMargin: 16
|
||||||
|
|
||||||
|
defaultColor: AmneziaStyle.color.paleGray
|
||||||
|
hoveredColor: AmneziaStyle.color.sheerWhite
|
||||||
|
pressedColor: AmneziaStyle.color.translucentWhite
|
||||||
|
disabledColor: AmneziaStyle.color.mutedGray
|
||||||
|
textColor: AmneziaStyle.color.black
|
||||||
|
leftImageColor: "black"
|
||||||
|
borderWidth: 1
|
||||||
|
|
||||||
text: qsTr("Copy key")
|
text: qsTr("Copy key")
|
||||||
leftImageSource: "qrc:/images/controls/copy.svg"
|
leftImageSource: "qrc:/images/controls/copy.svg"
|
||||||
|
|
||||||
@@ -186,7 +194,7 @@ PageType {
|
|||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
font.family: "PT Root UI VF"
|
font.family: "PT Root UI VF"
|
||||||
text: ApiConfigsController.vpnKey
|
text: ApiConfigsController.vpnKey //|| ""
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
background: Rectangle { color: AmneziaStyle.color.transparent }
|
background: Rectangle { color: AmneziaStyle.color.transparent }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ PageType {
|
|||||||
text: qsTr("Allow application screenshots")
|
text: qsTr("Allow application screenshots")
|
||||||
|
|
||||||
checked: SettingsController.isScreenshotsEnabled()
|
checked: SettingsController.isScreenshotsEnabled()
|
||||||
onToggled: function() {
|
onCheckedChanged: {
|
||||||
if (checked !== SettingsController.isScreenshotsEnabled()) {
|
if (checked !== SettingsController.isScreenshotsEnabled()) {
|
||||||
SettingsController.toggleScreenshotsEnabled(checked)
|
SettingsController.toggleScreenshotsEnabled(checked)
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ PageType {
|
|||||||
descriptionText: qsTr("Launch the application every time the device is starts")
|
descriptionText: qsTr("Launch the application every time the device is starts")
|
||||||
|
|
||||||
checked: SettingsController.isAutoStartEnabled()
|
checked: SettingsController.isAutoStartEnabled()
|
||||||
onToggled: function() {
|
onCheckedChanged: {
|
||||||
if (checked !== SettingsController.isAutoStartEnabled()) {
|
if (checked !== SettingsController.isAutoStartEnabled()) {
|
||||||
SettingsController.toggleAutoStart(checked)
|
SettingsController.toggleAutoStart(checked)
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ PageType {
|
|||||||
descriptionText: qsTr("Connect to VPN on app start")
|
descriptionText: qsTr("Connect to VPN on app start")
|
||||||
|
|
||||||
checked: SettingsController.isAutoConnectEnabled()
|
checked: SettingsController.isAutoConnectEnabled()
|
||||||
onToggled: function() {
|
onCheckedChanged: {
|
||||||
if (checked !== SettingsController.isAutoConnectEnabled()) {
|
if (checked !== SettingsController.isAutoConnectEnabled()) {
|
||||||
SettingsController.toggleAutoConnect(checked)
|
SettingsController.toggleAutoConnect(checked)
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ PageType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DividerType {
|
DividerType {
|
||||||
visible: !GC.isMobile() && !IsMacOsNeBuild
|
visible: !GC.isMobile()
|
||||||
}
|
}
|
||||||
|
|
||||||
SwitcherType {
|
SwitcherType {
|
||||||
@@ -158,7 +158,7 @@ PageType {
|
|||||||
opacity: enabled ? 1.0 : 0.5
|
opacity: enabled ? 1.0 : 0.5
|
||||||
|
|
||||||
checked: SettingsController.isStartMinimizedEnabled()
|
checked: SettingsController.isStartMinimizedEnabled()
|
||||||
onToggled: function() {
|
onCheckedChanged: {
|
||||||
if (checked !== SettingsController.isStartMinimizedEnabled()) {
|
if (checked !== SettingsController.isStartMinimizedEnabled()) {
|
||||||
SettingsController.toggleStartMinimized(checked)
|
SettingsController.toggleStartMinimized(checked)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ PageType {
|
|||||||
descriptionText: qsTr("If AmneziaDNS is installed on the server")
|
descriptionText: qsTr("If AmneziaDNS is installed on the server")
|
||||||
|
|
||||||
checked: SettingsController.isAmneziaDnsEnabled()
|
checked: SettingsController.isAmneziaDnsEnabled()
|
||||||
onToggled: function() {
|
onCheckedChanged: {
|
||||||
if (checked !== SettingsController.isAmneziaDnsEnabled()) {
|
if (checked !== SettingsController.isAmneziaDnsEnabled()) {
|
||||||
SettingsController.toggleAmneziaDns(checked)
|
SettingsController.toggleAmneziaDns(checked)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ PageType {
|
|||||||
|
|
||||||
checked: SettingsController.isLoggingEnabled
|
checked: SettingsController.isLoggingEnabled
|
||||||
|
|
||||||
onToggled: function() {
|
onCheckedChanged: {
|
||||||
if (checked !== SettingsController.isLoggingEnabled) {
|
if (checked !== SettingsController.isLoggingEnabled) {
|
||||||
SettingsController.isLoggingEnabled = checked
|
SettingsController.isLoggingEnabled = checked
|
||||||
}
|
}
|
||||||
@@ -165,12 +165,7 @@ PageType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show service logs only if this is NOT a macOS build with
|
property list<QtObject> logTypes: [
|
||||||
// Network-Extension (IsMacOsNeBuild is injected from C++ at run-time)
|
|
||||||
// or if this is NOT a mobile build
|
|
||||||
property list<QtObject> logTypes: (IsMacOsNeBuild || GC.isMobile()) ? [
|
|
||||||
clientLogs
|
|
||||||
] : [
|
|
||||||
clientLogs,
|
clientLogs,
|
||||||
serviceLogs
|
serviceLogs
|
||||||
]
|
]
|
||||||
@@ -209,17 +204,21 @@ PageType {
|
|||||||
|
|
||||||
readonly property string title: qsTr("Service logs")
|
readonly property string title: qsTr("Service logs")
|
||||||
readonly property string description: qsTr("AmneziaVPN-service logs")
|
readonly property string description: qsTr("AmneziaVPN-service logs")
|
||||||
readonly property bool isVisible: !GC.isMobile() && !IsMacOsNeBuild
|
readonly property bool isVisible: !GC.isMobile()
|
||||||
readonly property var openLogsHandler: function() {
|
readonly property var openLogsHandler: function() {
|
||||||
SettingsController.openServiceLogsFolder()
|
SettingsController.openServiceLogsFolder()
|
||||||
}
|
}
|
||||||
readonly property var exportLogsHandler: function() {
|
readonly property var exportLogsHandler: function() {
|
||||||
var fileName = ""
|
var fileName = ""
|
||||||
fileName = SystemController.getFileName(qsTr("Save"),
|
if (GC.isMobile()) {
|
||||||
qsTr("Logs files (*.log)"),
|
fileName = "AmneziaVPN-service.log"
|
||||||
StandardPaths.standardLocations(StandardPaths.DocumentsLocation) + "/AmneziaVPN-service",
|
} else {
|
||||||
true,
|
fileName = SystemController.getFileName(qsTr("Save"),
|
||||||
".log")
|
qsTr("Logs files (*.log)"),
|
||||||
|
StandardPaths.standardLocations(StandardPaths.DocumentsLocation) + "/AmneziaVPN-service",
|
||||||
|
true,
|
||||||
|
".log")
|
||||||
|
}
|
||||||
if (fileName !== "") {
|
if (fileName !== "") {
|
||||||
PageController.showBusyIndicator(true)
|
PageController.showBusyIndicator(true)
|
||||||
SettingsController.exportServiceLogsFile(fileName)
|
SettingsController.exportServiceLogsFile(fileName)
|
||||||
|
|||||||
@@ -66,8 +66,6 @@ PageType {
|
|||||||
imageSource: imagePath
|
imageSource: imagePath
|
||||||
leftText: lText
|
leftText: lText
|
||||||
rightText: rText
|
rightText: rText
|
||||||
|
|
||||||
visible: isVisible
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Dialogs
|
import QtQuick.Dialogs
|
||||||
|
|
||||||
import SortFilterProxyModel 0.2
|
|
||||||
|
|
||||||
import PageEnum 1.0
|
import PageEnum 1.0
|
||||||
import Style 1.0
|
import Style 1.0
|
||||||
|
|
||||||
@@ -56,15 +54,7 @@ PageType {
|
|||||||
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
model: SortFilterProxyModel {
|
model: ApiServicesModel
|
||||||
id: proxyApiServicesModel
|
|
||||||
|
|
||||||
sourceModel: ApiServicesModel
|
|
||||||
sorters: RoleSorter {
|
|
||||||
roleName: "order"
|
|
||||||
sortOrder: Qt.AscendingOrder
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delegate: ColumnLayout {
|
delegate: ColumnLayout {
|
||||||
|
|
||||||
@@ -88,7 +78,7 @@ PageType {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (isServiceAvailable) {
|
if (isServiceAvailable) {
|
||||||
ApiServicesModel.setServiceIndex(proxyApiServicesModel.mapToSource(index))
|
ApiServicesModel.setServiceIndex(index)
|
||||||
PageController.goToPage(PageEnum.PageSetupWizardApiServiceInfo)
|
PageController.goToPage(PageEnum.PageSetupWizardApiServiceInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ PageType {
|
|||||||
|
|
||||||
visible: PageController.isStartPageVisible()
|
visible: PageController.isStartPageVisible()
|
||||||
checked: SettingsController.isLoggingEnabled
|
checked: SettingsController.isLoggingEnabled
|
||||||
onToggled: function() {
|
onCheckedChanged: {
|
||||||
if (checked !== SettingsController.isLoggingEnabled) {
|
if (checked !== SettingsController.isLoggingEnabled) {
|
||||||
SettingsController.isLoggingEnabled = checked
|
SettingsController.isLoggingEnabled = checked
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,67 +45,40 @@ PageType {
|
|||||||
function onGenerateConfig(type) {
|
function onGenerateConfig(type) {
|
||||||
PageController.showBusyIndicator(true)
|
PageController.showBusyIndicator(true)
|
||||||
|
|
||||||
var configCaption
|
|
||||||
var configExtension
|
|
||||||
var configFileName
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PageShare.ConfigType.AmneziaConnection: {
|
case PageShare.ConfigType.AmneziaConnection: {
|
||||||
ExportController.generateConnectionConfig(clientNameTextField.textField.text);
|
ExportController.generateConnectionConfig(clientNameTextField.textField.text);
|
||||||
configCaption = qsTr("Save AmneziaVPN config")
|
|
||||||
configExtension = ".vpn"
|
|
||||||
configFileName = "amnezia_config"
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PageShare.ConfigType.OpenVpn: {
|
case PageShare.ConfigType.OpenVpn: {
|
||||||
ExportController.generateOpenVpnConfig(clientNameTextField.textField.text)
|
ExportController.generateOpenVpnConfig(clientNameTextField.textField.text)
|
||||||
configCaption = qsTr("Save OpenVPN config")
|
|
||||||
configExtension = ".ovpn"
|
|
||||||
configFileName = "amnezia_for_openvpn"
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case PageShare.ConfigType.WireGuard: {
|
case PageShare.ConfigType.WireGuard: {
|
||||||
ExportController.generateWireGuardConfig(clientNameTextField.textField.text)
|
ExportController.generateWireGuardConfig(clientNameTextField.textField.text)
|
||||||
configCaption = qsTr("Save WireGuard config")
|
|
||||||
configExtension = ".conf"
|
|
||||||
configFileName = "amnezia_for_wireguard"
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case PageShare.ConfigType.Awg: {
|
case PageShare.ConfigType.Awg: {
|
||||||
ExportController.generateAwgConfig(clientNameTextField.textField.text)
|
ExportController.generateAwgConfig(clientNameTextField.textField.text)
|
||||||
configCaption = qsTr("Save AmneziaWG config")
|
|
||||||
configExtension = ".conf"
|
|
||||||
configFileName = "amnezia_for_awg"
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case PageShare.ConfigType.ShadowSocks: {
|
case PageShare.ConfigType.ShadowSocks: {
|
||||||
ExportController.generateShadowSocksConfig()
|
ExportController.generateShadowSocksConfig()
|
||||||
configCaption = qsTr("Save Shadowsocks config")
|
|
||||||
configExtension = ".json"
|
|
||||||
configFileName = "amnezia_for_shadowsocks"
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case PageShare.ConfigType.Cloak: {
|
case PageShare.ConfigType.Cloak: {
|
||||||
ExportController.generateCloakConfig()
|
ExportController.generateCloakConfig()
|
||||||
configCaption = qsTr("Save Cloak config")
|
|
||||||
configExtension = ".json"
|
|
||||||
configFileName = "amnezia_for_cloak"
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case PageShare.ConfigType.Xray: {
|
case PageShare.ConfigType.Xray: {
|
||||||
ExportController.generateXrayConfig(clientNameTextField.textField.text)
|
ExportController.generateXrayConfig(clientNameTextField.textField.text)
|
||||||
configCaption = qsTr("Save XRay config")
|
|
||||||
configExtension = ".json"
|
|
||||||
configFileName = "amnezia_for_xray"
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PageController.showBusyIndicator(false)
|
PageController.showBusyIndicator(false)
|
||||||
|
|
||||||
var headerText = qsTr("Connection to ") + serverSelector.text
|
PageController.goToPage(PageEnum.PageShareConnection)
|
||||||
var configContentHeaderText = qsTr("File with connection settings to ") + serverSelector.text
|
|
||||||
PageController.goToShareConnectionPage(headerText, configContentHeaderText, configCaption, configExtension, configFileName)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onExportErrorOccurred(error) {
|
function onExportErrorOccurred(error) {
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ PageType {
|
|||||||
id: pageShareConnection
|
id: pageShareConnection
|
||||||
|
|
||||||
property string headerText
|
property string headerText
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
var serverName = ServersModel.getProcessedServerData("name") || ServersModel.getProcessedServerData("hostName") || "Server"
|
||||||
|
headerText = qsTr("Connection to ") + serverName
|
||||||
|
configContentHeaderText = qsTr("File with connection settings to ") + serverName
|
||||||
|
}
|
||||||
property string configContentHeaderText
|
property string configContentHeaderText
|
||||||
property string shareButtonText: qsTr("Share")
|
property string shareButtonText: qsTr("Share")
|
||||||
property string copyButtonText: qsTr("Copy")
|
property string copyButtonText: qsTr("Copy")
|
||||||
@@ -30,17 +36,17 @@ PageType {
|
|||||||
property string configCaption: qsTr("Save AmneziaVPN config")
|
property string configCaption: qsTr("Save AmneziaVPN config")
|
||||||
property string configFileName: "amnezia_config"
|
property string configFileName: "amnezia_config"
|
||||||
|
|
||||||
// onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
// configExtension = ".vpn"
|
configExtension = ".vpn"
|
||||||
// configCaption = qsTr("Save AmneziaVPN config")
|
configCaption = qsTr("Save AmneziaVPN config")
|
||||||
// configFileName = "amnezia_config"
|
configFileName = "amnezia_config"
|
||||||
|
|
||||||
// if (visible) {
|
if (visible) {
|
||||||
// var serverName = ServersModel.getProcessedServerData("name") || ServersModel.getProcessedServerData("hostName") || "Server"
|
var serverName = ServersModel.getProcessedServerData("name") || ServersModel.getProcessedServerData("hostName") || "Server"
|
||||||
// headerText = qsTr("Connection to ") + serverName
|
headerText = qsTr("Connection to ") + serverName
|
||||||
// configContentHeaderText = qsTr("File with connection settings to ") + serverName
|
configContentHeaderText = qsTr("File with connection settings to ") + serverName
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
BackButtonType {
|
BackButtonType {
|
||||||
id: backButton
|
id: backButton
|
||||||
|
|||||||
@@ -37,9 +37,6 @@ PageType {
|
|||||||
ListViewType {
|
ListViewType {
|
||||||
id: listView
|
id: listView
|
||||||
|
|
||||||
property string headerText: ""
|
|
||||||
property string configContentHeaderText: ""
|
|
||||||
|
|
||||||
anchors.top: backButton.bottom
|
anchors.top: backButton.bottom
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
@@ -111,8 +108,8 @@ PageType {
|
|||||||
serverSelector.currentIndex = serverSelectorListView.currentIndex
|
serverSelector.currentIndex = serverSelectorListView.currentIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
listView.headerText = qsTr("Accessing ") + serverSelector.text
|
shareConnectionPage.headerText = qsTr("Accessing ") + serverSelector.text
|
||||||
listView.configContentHeaderText = qsTr("File with accessing settings to ") + serverSelector.text
|
shareConnectionPage.configContentHeaderText = qsTr("File with accessing settings to ") + serverSelector.text
|
||||||
serverSelector.closeTriggered()
|
serverSelector.closeTriggered()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +156,7 @@ PageType {
|
|||||||
|
|
||||||
PageController.showBusyIndicator(false)
|
PageController.showBusyIndicator(false)
|
||||||
|
|
||||||
PageController.goToShareConnectionPage(listView.headerText, listView.configContentHeaderText, "", "", "")
|
PageController.goToPage(PageEnum.PageShareConnection)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,19 +44,6 @@ PageType {
|
|||||||
tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.PushTransition)
|
tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.PushTransition)
|
||||||
}
|
}
|
||||||
|
|
||||||
function onGoToShareConnectionPage(headerText, configContentHeaderText, configCaption, configExtension, configFileName) {
|
|
||||||
var pagePath = PageController.getPagePath(PageEnum.PageShareConnection)
|
|
||||||
tabBarStackView.push(pagePath,
|
|
||||||
{ "objectName" : pagePath,
|
|
||||||
"headerText" : headerText,
|
|
||||||
"configContentHeaderText" : configContentHeaderText,
|
|
||||||
"configCaption" : configCaption,
|
|
||||||
"configExtension" : configExtension,
|
|
||||||
"configFileName" : configFileName
|
|
||||||
},
|
|
||||||
StackView.PushTransition)
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDisableControls(disabled) {
|
function onDisableControls(disabled) {
|
||||||
isControlsDisabled = disabled
|
isControlsDisabled = disabled
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ Window {
|
|||||||
|
|
||||||
color: AmneziaStyle.color.midnightBlack
|
color: AmneziaStyle.color.midnightBlack
|
||||||
|
|
||||||
onClosing: function(close) {
|
onClosing: function() {
|
||||||
close.accepted = false
|
|
||||||
PageController.closeWindow()
|
PageController.closeWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,11 +38,9 @@ SystemTrayNotificationHandler::SystemTrayNotificationHandler(QObject* parent) :
|
|||||||
QDesktopServices::openUrl(QUrl(websiteUrl));
|
QDesktopServices::openUrl(QUrl(websiteUrl));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Quit action: disconnect VPN first on macOS NE, else quit directly
|
m_trayActionQuit = m_menu.addAction(QIcon(":/images/tray/cancel.png"), tr("Quit") + " " + APPLICATION_NAME, this, [&](){
|
||||||
m_trayActionQuit = m_menu.addAction(QIcon(":/images/tray/cancel.png"),
|
qApp->quit();
|
||||||
tr("Quit") + " " + APPLICATION_NAME,
|
});
|
||||||
this,
|
|
||||||
[&](){ qApp->quit(); });
|
|
||||||
|
|
||||||
m_systemTrayIcon.setContextMenu(&m_menu);
|
m_systemTrayIcon.setContextMenu(&m_menu);
|
||||||
setTrayState(Vpn::ConnectionState::Disconnected);
|
setTrayState(Vpn::ConnectionState::Disconnected);
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ bool Utils::processIsRunning(const QString &fileName, const bool fullFlag)
|
|||||||
CloseHandle(hSnapshot);
|
CloseHandle(hSnapshot);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#elif defined(Q_OS_IOS) || defined(Q_OS_ANDROID) || defined(MACOS_NE)
|
#elif defined(Q_OS_IOS) || defined(Q_OS_ANDROID)
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
QProcess process;
|
QProcess process;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#include "platforms/android/android_controller.h"
|
#include "platforms/android/android_controller.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_IOS) || defined(MACOS_NE)
|
#ifdef Q_OS_IOS
|
||||||
#include "platforms/ios/ios_controller.h"
|
#include "platforms/ios/ios_controller.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ VpnConnection::VpnConnection(std::shared_ptr<Settings> settings, QObject *parent
|
|||||||
: QObject(parent), m_settings(settings), m_checkTimer(new QTimer(this))
|
: QObject(parent), m_settings(settings), m_checkTimer(new QTimer(this))
|
||||||
{
|
{
|
||||||
m_checkTimer.setInterval(1000);
|
m_checkTimer.setInterval(1000);
|
||||||
#if defined(Q_OS_IOS) || defined(MACOS_NE)
|
#ifdef Q_OS_IOS
|
||||||
connect(IosController::Instance(), &IosController::connectionStateChanged, this, &VpnConnection::onConnectionStateChanged);
|
connect(IosController::Instance(), &IosController::connectionStateChanged, this, &VpnConnection::onConnectionStateChanged);
|
||||||
connect(IosController::Instance(), &IosController::bytesChanged, this, &VpnConnection::onBytesChanged);
|
connect(IosController::Instance(), &IosController::bytesChanged, this, &VpnConnection::onBytesChanged);
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ void VpnConnection::onConnectionStateChanged(Vpn::ConnectionState state)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_IOS) || defined(MACOS_NE)
|
#ifdef Q_OS_IOS
|
||||||
if (state == Vpn::ConnectionState::Connected) {
|
if (state == Vpn::ConnectionState::Connected) {
|
||||||
m_checkTimer.start();
|
m_checkTimer.start();
|
||||||
} else {
|
} else {
|
||||||
@@ -236,11 +236,10 @@ ErrorCode VpnConnection::lastError() const
|
|||||||
void VpnConnection::connectToVpn(int serverIndex, const ServerCredentials &credentials, DockerContainer container,
|
void VpnConnection::connectToVpn(int serverIndex, const ServerCredentials &credentials, DockerContainer container,
|
||||||
const QJsonObject &vpnConfiguration)
|
const QJsonObject &vpnConfiguration)
|
||||||
{
|
{
|
||||||
qDebug() << QString("ConnectToVpn, Server index is %1, container is %2, route mode is")
|
qDebug() << QString("Trying to connect to VPN, server index is %1, container is %2")
|
||||||
.arg(serverIndex)
|
.arg(serverIndex)
|
||||||
.arg(ContainerProps::containerToString(container))
|
.arg(ContainerProps::containerToString(container));
|
||||||
<< m_settings->routeMode();
|
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
||||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
|
||||||
if (!m_IpcClient) {
|
if (!m_IpcClient) {
|
||||||
m_IpcClient = new IpcClient(this);
|
m_IpcClient = new IpcClient(this);
|
||||||
}
|
}
|
||||||
@@ -271,7 +270,7 @@ void VpnConnection::connectToVpn(int serverIndex, const ServerCredentials &crede
|
|||||||
|
|
||||||
appendSplitTunnelingConfig();
|
appendSplitTunnelingConfig();
|
||||||
|
|
||||||
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(MACOS_NE)
|
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
|
||||||
m_vpnProtocol.reset(VpnProtocol::factory(container, m_vpnConfiguration));
|
m_vpnProtocol.reset(VpnProtocol::factory(container, m_vpnConfiguration));
|
||||||
if (!m_vpnProtocol) {
|
if (!m_vpnProtocol) {
|
||||||
emit connectionStateChanged(Vpn::ConnectionState::Error);
|
emit connectionStateChanged(Vpn::ConnectionState::Error);
|
||||||
@@ -283,7 +282,7 @@ void VpnConnection::connectToVpn(int serverIndex, const ServerCredentials &crede
|
|||||||
createAndroidConnections();
|
createAndroidConnections();
|
||||||
|
|
||||||
m_vpnProtocol.reset(androidVpnProtocol);
|
m_vpnProtocol.reset(androidVpnProtocol);
|
||||||
#elif defined Q_OS_IOS || defined(MACOS_NE)
|
#elif defined Q_OS_IOS
|
||||||
Proto proto = ContainerProps::defaultProtocol(container);
|
Proto proto = ContainerProps::defaultProtocol(container);
|
||||||
IosController::Instance()->connectVpn(proto, m_vpnConfiguration);
|
IosController::Instance()->connectVpn(proto, m_vpnConfiguration);
|
||||||
connect(&m_checkTimer, &QTimer::timeout, IosController::Instance(), &IosController::checkStatus);
|
connect(&m_checkTimer, &QTimer::timeout, IosController::Instance(), &IosController::checkStatus);
|
||||||
@@ -363,20 +362,20 @@ void VpnConnection::appendSplitTunnelingConfig()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings::RouteMode routeMode = Settings::RouteMode::VpnAllSites;
|
Settings::RouteMode sitesRouteMode = Settings::RouteMode::VpnAllSites;
|
||||||
QJsonArray sitesJsonArray;
|
QJsonArray sitesJsonArray;
|
||||||
if (m_settings->isSitesSplitTunnelingEnabled()) {
|
if (m_settings->isSitesSplitTunnelingEnabled()) {
|
||||||
routeMode = m_settings->routeMode();
|
sitesRouteMode = m_settings->routeMode();
|
||||||
|
|
||||||
if (allowSiteBasedSplitTunneling) {
|
if (allowSiteBasedSplitTunneling) {
|
||||||
auto sites = m_settings->getVpnIps(routeMode);
|
auto sites = m_settings->getVpnIps(sitesRouteMode);
|
||||||
for (const auto &site : sites) {
|
for (const auto &site : sites) {
|
||||||
sitesJsonArray.append(site);
|
sitesJsonArray.append(site);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sitesJsonArray.isEmpty()) {
|
if (sitesJsonArray.isEmpty()) {
|
||||||
routeMode = Settings::RouteMode::VpnAllSites;
|
sitesRouteMode = Settings::RouteMode::VpnAllSites;
|
||||||
} else if (routeMode == Settings::VpnOnlyForwardSites) {
|
} else if (sitesRouteMode == Settings::VpnOnlyForwardSites) {
|
||||||
// Allow traffic to Amnezia DNS
|
// Allow traffic to Amnezia DNS
|
||||||
sitesJsonArray.append(m_vpnConfiguration.value(config_key::dns1).toString());
|
sitesJsonArray.append(m_vpnConfiguration.value(config_key::dns1).toString());
|
||||||
sitesJsonArray.append(m_vpnConfiguration.value(config_key::dns2).toString());
|
sitesJsonArray.append(m_vpnConfiguration.value(config_key::dns2).toString());
|
||||||
@@ -384,7 +383,7 @@ void VpnConnection::appendSplitTunnelingConfig()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_vpnConfiguration.insert(config_key::splitTunnelType, routeMode);
|
m_vpnConfiguration.insert(config_key::splitTunnelType, sitesRouteMode);
|
||||||
m_vpnConfiguration.insert(config_key::splitTunnelSites, sitesJsonArray);
|
m_vpnConfiguration.insert(config_key::splitTunnelSites, sitesJsonArray);
|
||||||
|
|
||||||
Settings::AppsRouteMode appsRouteMode = Settings::AppsRouteMode::VpnAllApps;
|
Settings::AppsRouteMode appsRouteMode = Settings::AppsRouteMode::VpnAllApps;
|
||||||
@@ -404,6 +403,13 @@ void VpnConnection::appendSplitTunnelingConfig()
|
|||||||
|
|
||||||
m_vpnConfiguration.insert(config_key::appSplitTunnelType, appsRouteMode);
|
m_vpnConfiguration.insert(config_key::appSplitTunnelType, appsRouteMode);
|
||||||
m_vpnConfiguration.insert(config_key::splitTunnelApps, appsJsonArray);
|
m_vpnConfiguration.insert(config_key::splitTunnelApps, appsJsonArray);
|
||||||
|
|
||||||
|
qDebug() << QString("Site split tunneling is %1, route mode is %2")
|
||||||
|
.arg(m_settings->isSitesSplitTunnelingEnabled() ? "enabled" : "disabled")
|
||||||
|
.arg(sitesRouteMode);
|
||||||
|
qDebug() << QString("App split tunneling is %1, route mode is %2")
|
||||||
|
.arg(m_settings->isAppsSplitTunnelingEnabled() ? "enabled" : "disabled")
|
||||||
|
.arg(appsRouteMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
@@ -465,7 +471,7 @@ void VpnConnection::disconnectFromVpn()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_IOS) || defined(MACOS_NE)
|
#ifdef Q_OS_IOS
|
||||||
IosController::Instance()->disconnectVpn();
|
IosController::Instance()->disconnectVpn();
|
||||||
disconnect(&m_checkTimer, &QTimer::timeout, IosController::Instance(), &IosController::checkStatus);
|
disconnect(&m_checkTimer, &QTimer::timeout, IosController::Instance(), &IosController::checkStatus);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ cmake --version
|
|||||||
clang -v
|
clang -v
|
||||||
|
|
||||||
# Generate XCodeProj
|
# Generate XCodeProj
|
||||||
$QT_BIN_DIR/qt-cmake . -B $BUILD_DIR -GXcode -DQT_HOST_PATH=$QT_MACOS_ROOT_DIR -DDEPLOY=ON
|
$QT_BIN_DIR/qt-cmake . -B $BUILD_DIR -GXcode -DQT_HOST_PATH=$QT_MACOS_ROOT_DIR
|
||||||
|
|
||||||
KEYCHAIN=amnezia.build.ios.keychain
|
KEYCHAIN=amnezia.build.ios.keychain
|
||||||
KEYCHAIN_FILE=$HOME/Library/Keychains/${KEYCHAIN}-db
|
KEYCHAIN_FILE=$HOME/Library/Keychains/${KEYCHAIN}-db
|
||||||
|
|||||||
@@ -1,122 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
echo "Build script for macOS Network Extension started ..."
|
|
||||||
|
|
||||||
set -o errexit -o nounset
|
|
||||||
|
|
||||||
while getopts n flag
|
|
||||||
do
|
|
||||||
case "${flag}" in
|
|
||||||
n) NOTARIZE_APP=1;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# Hold on to current directory
|
|
||||||
PROJECT_DIR=$(pwd)
|
|
||||||
DEPLOY_DIR=$PROJECT_DIR/deploy
|
|
||||||
|
|
||||||
mkdir -p $DEPLOY_DIR/build-macos
|
|
||||||
BUILD_DIR=$DEPLOY_DIR/build-macos
|
|
||||||
|
|
||||||
echo "Project dir: ${PROJECT_DIR}"
|
|
||||||
echo "Build dir: ${BUILD_DIR}"
|
|
||||||
|
|
||||||
APP_NAME=AmneziaVPN
|
|
||||||
APP_FILENAME=$APP_NAME.app
|
|
||||||
APP_DOMAIN=org.amneziavpn.package
|
|
||||||
PLIST_NAME=$APP_NAME.plist
|
|
||||||
|
|
||||||
OUT_APP_DIR=$BUILD_DIR/client
|
|
||||||
BUNDLE_DIR=$OUT_APP_DIR/$APP_FILENAME
|
|
||||||
|
|
||||||
PREBUILT_DEPLOY_DATA_DIR=$PROJECT_DIR/deploy/data/deploy-prebuilt/macos
|
|
||||||
DEPLOY_DATA_DIR=$PROJECT_DIR/deploy/data/macos
|
|
||||||
|
|
||||||
INSTALLER_DATA_DIR=$BUILD_DIR/installer/packages/$APP_DOMAIN/data
|
|
||||||
INSTALLER_BUNDLE_DIR=$BUILD_DIR/installer/$APP_FILENAME
|
|
||||||
DMG_FILENAME=$PROJECT_DIR/${APP_NAME}.dmg
|
|
||||||
|
|
||||||
echo "Import certificate"
|
|
||||||
|
|
||||||
TRUST_CERT_CER=$BUILD_DIR/trust-cert.cer
|
|
||||||
SIGNING_CERT_P12=$BUILD_DIR/signing-cert.p12
|
|
||||||
|
|
||||||
echo $MAC_TRUST_CERT_BASE64 | base64 --decode > $TRUST_CERT_CER
|
|
||||||
echo $MAC_SIGNING_CERT_BASE64 | base64 --decode > $SIGNING_CERT_P12
|
|
||||||
|
|
||||||
shasum -a 256 $TRUST_CERT_CER
|
|
||||||
shasum -a 256 $SIGNING_CERT_P12
|
|
||||||
KEYCHAIN_PASS=$MAC_SIGNING_CERT_PASSWORD
|
|
||||||
|
|
||||||
# Keychain setup
|
|
||||||
KEYCHAIN=amnezia.build.macos.keychain
|
|
||||||
TEMP_PASS=tmp_pass
|
|
||||||
KEYCHAIN_FILE=$HOME/Library/Keychains/$KEYCHAIN-db
|
|
||||||
|
|
||||||
security create-keychain -p $TEMP_PASS $KEYCHAIN || true
|
|
||||||
security default-keychain -s $KEYCHAIN
|
|
||||||
security unlock-keychain -p $TEMP_PASS $KEYCHAIN
|
|
||||||
|
|
||||||
security default-keychain
|
|
||||||
security list-keychains
|
|
||||||
|
|
||||||
# Import certificates into keychain
|
|
||||||
security import $TRUST_CERT_CER -k $KEYCHAIN -P "" -T /usr/bin/codesign || true
|
|
||||||
security import $SIGNING_CERT_P12 -k $KEYCHAIN -P $MAC_SIGNING_CERT_PASSWORD -T /usr/bin/codesign || true
|
|
||||||
|
|
||||||
# Configure keychain settings
|
|
||||||
security set-key-partition-list -S apple-tool:,apple: -k $TEMP_PASS $KEYCHAIN
|
|
||||||
security find-identity -p codesigning
|
|
||||||
|
|
||||||
# Setup provisioning profiles for main app and NE
|
|
||||||
echo "Setting up provisioning profiles..."
|
|
||||||
|
|
||||||
# Copy provisioning prifiles
|
|
||||||
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles/"
|
|
||||||
|
|
||||||
echo $MAC_APP_PROVISIONING_PROFILE | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/app.mobileprovision
|
|
||||||
echo $MAC_NE_PROVISIONING_PROFILE | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/ne.mobileprovision
|
|
||||||
|
|
||||||
shasum -a 256 ~/Library/MobileDevice/Provisioning\ Profiles/app.mobileprovision
|
|
||||||
shasum -a 256 ~/Library/MobileDevice/Provisioning\ Profiles/ne.mobileprovision
|
|
||||||
|
|
||||||
profile_uuid=`grep UUID -A1 -a ~/Library/MobileDevice/Provisioning\ Profiles/app.mobileprovision | grep -io "[-A-F0-9]\{36\}"`
|
|
||||||
echo $profile_uuid
|
|
||||||
profile_ne_uuid=`grep UUID -A1 -a ~/Library/MobileDevice/Provisioning\ Profiles/ne.mobileprovision | grep -io "[-A-F0-9]\{36\}"`
|
|
||||||
echo $profile_ne_uuid
|
|
||||||
|
|
||||||
mv ~/Library/MobileDevice/Provisioning\ Profiles/app.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/$profile_uuid.mobileprovision
|
|
||||||
mv ~/Library/MobileDevice/Provisioning\ Profiles/ne.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/$profile_ne_uuid.mobileprovision
|
|
||||||
|
|
||||||
# setup environment
|
|
||||||
QT_MACOS_BIN=$QT_BIN_DIR
|
|
||||||
export PATH=$PATH:~/go/bin
|
|
||||||
echo "QT_BIN_DIR: $QT_BIN_DIR"
|
|
||||||
|
|
||||||
|
|
||||||
# Build the Network Extension app
|
|
||||||
echo "Building MAC Network Extension App..."
|
|
||||||
mkdir -p build-macos
|
|
||||||
|
|
||||||
$QT_MACOS_BIN/qt-cmake . -B build-macos -GXcode -DQT_HOST_PATH=$QT_MACOS_ROOT_DIR -DMACOS_NE=TRUE -DCMAKE_BUILD_TYPE=Release -DDEPLOY=ON
|
|
||||||
|
|
||||||
# Build and run tests here
|
|
||||||
|
|
||||||
echo "____________________________________"
|
|
||||||
echo "............Deploying..............."
|
|
||||||
echo "____________________________________"
|
|
||||||
echo "Deploying MAC Network Extension App..."
|
|
||||||
|
|
||||||
echo "xcode build"
|
|
||||||
xcodebuild \
|
|
||||||
"OTHER_CODE_SIGN_FLAGS=--keychain '$KEYCHAIN_FILE'" \
|
|
||||||
-configuration Release \
|
|
||||||
-scheme AmneziaVPN \
|
|
||||||
-destination "platform=macOS" \
|
|
||||||
-project $PROJECT_DIR/build-macos/AmneziaVPN.xcodeproj
|
|
||||||
|
|
||||||
|
|
||||||
# Restore keychain to default
|
|
||||||
echo "Restoring default keychain..."
|
|
||||||
security default-keychain -s "/Users/runner/Library/Keychains/login.keychain-db"
|
|
||||||
|
|
||||||
echo "Build and signing process completed successfully!"
|
|
||||||
@@ -29,7 +29,7 @@ void IpcProcessTun2Socks::start()
|
|||||||
QString XrayConStr = "socks5://127.0.0.1:10808";
|
QString XrayConStr = "socks5://127.0.0.1:10808";
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QStringList arguments({"-device", "tun://tun2?guid={081A8A84-8D12-4DF5-B8C4-396D5B0053E4}", "-proxy", XrayConStr, "-tun-post-up",
|
QStringList arguments({"-device", "tun://tun2", "-proxy", XrayConStr, "-tun-post-up",
|
||||||
QString("cmd /c netsh interface ip set address name=\"tun2\" static %1 255.255.255.255")
|
QString("cmd /c netsh interface ip set address name=\"tun2\" static %1 255.255.255.255")
|
||||||
.arg(amnezia::protocols::xray::defaultLocalAddr)});
|
.arg(amnezia::protocols::xray::defaultLocalAddr)});
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ project(${PROJECT} VERSION ${AMNEZIAVPN_VERSION})
|
|||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
if(NOT IOS AND NOT ANDROID AND NOT MACOS_NE)
|
if(NOT IOS AND NOT ANDROID)
|
||||||
add_subdirectory(server)
|
add_subdirectory(server)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||