diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d9138516..d9f25e9f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -294,6 +294,70 @@ jobs: path: deploy/build/client/AmneziaVPN.app retention-days: 7 +# ------------------------------------------------------ + Build-MacOS-NE: + runs-on: macos-latest + + env: + QT_VERSION: 6.4.3 + QIF_VERSION: 4.6 + QT_MIRROR: https://mirrors.ocf.berkeley.edu/qt/ + PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }} + DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }} + + steps: + - name: 'Setup Xcode' + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '14.3.1' + + - name: 'Install desktop Qt' + uses: jurplel/install-qt-action@v3 + with: + version: ${{ env.QT_VERSION }} + host: 'mac' + target: 'desktop' + modules: 'qtremoteobjects qt5compat qtshadertools qtmultimedia' + arch: 'clang_64' + dir: ${{ runner.temp }} + set-env: 'true' + extra: '--base ${{ env.QT_MIRROR }}' + - name: 'Install Qt Installer Framework ${{ env.QIF_VERSION }}' + run: | + mkdir -pv ${{ runner.temp }}/Qt/Tools/QtInstallerFramework + wget https://qt.amzsvc.com/tools/ifw/${{ env.QIF_VERSION }}.zip + unzip ${{ env.QIF_VERSION }}.zip -d ${{ runner.temp }}/Qt/Tools/QtInstallerFramework/ + - name: 'Install Go' + uses: actions/setup-go@v5 + with: + go-version: '1.22.1' + cache: false + + - name: 'Get sources' + uses: actions/checkout@v4 + with: + submodules: 'true' + fetch-depth: 10 + + - name: 'Install dependencies' + run: pip install jsonschema jinja2 + + - name: 'Set execute permissions for deploy script' + run: chmod +x deploy/build_macos_ne.sh + + - name: 'Build and deploy macOS NE' + run: | + export QT_BIN_DIR="${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/macos/bin" + export QIF_BIN_DIR="${{ runner.temp }}/Qt/Tools/QtInstallerFramework/${{ env.QIF_VERSION }}/bin" + export QT_MACOS_ROOT_DIR="${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/macos" + bash deploy/build_macos_ne.sh + env: + APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }} + APPSTORE_CONNECT_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }} + APPSTORE_CONNECT_PRIVATE_KEY: ${{ secrets.APPSTORE_CONNECT_PRIVATE_KEY }} + MAC_TRUST_CERT_BASE64: ${{ secrets.IOS_TRUST_CERT_BASE64 }} + MAC_SIGNING_CERT_BASE64: ${{ secrets.IOS_SIGNING_CERT_BASE64 }} + MAC_SIGNING_CERT_PASSWORD: ${{ secrets.IOS_SIGNING_CERT_PASSWORD }} # ------------------------------------------------------ Build-Android: diff --git a/.gitmodules b/.gitmodules index 3ceaa56e..e9e25286 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,7 @@ [submodule "client/3rd/OpenVPNAdapter"] path = client/3rd/OpenVPNAdapter url = https://github.com/amnezia-vpn/OpenVPNAdapter.git + branch = macos-dirty-build [submodule "client/3rd/qtkeychain"] path = client/3rd/qtkeychain url = https://github.com/frankosterfeld/qtkeychain.git @@ -10,6 +11,7 @@ [submodule "client/3rd-prebuilt"] path = client/3rd-prebuilt url = https://github.com/amnezia-vpn/3rd-prebuilt + branch = fixbug/mac-network-extension [submodule "client/3rd/amneziawg-apple"] path = client/3rd/amneziawg-apple url = https://github.com/amnezia-vpn/amneziawg-apple diff --git a/CMakeLists.txt b/CMakeLists.txt index fba4183c..fe408ada 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,18 +26,20 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "iOS") elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") set(MZ_PLATFORM_NAME "wasm") endif() - +message(STATUS "Platform: ${MZ_PLATFORM_NAME}") +message(STATUS "Version: ${MACOS_NE}") set(QT_BUILD_TOOLS_WHEN_CROSS_COMPILING ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -if(APPLE AND NOT IOS) +if((APPLE AND NOT IOS) OR (DEFINED MACOS_NE AND MACOS_NE AND NOT IOS)) set(CMAKE_OSX_ARCHITECTURES "x86_64") endif() add_subdirectory(client) -if(NOT IOS AND NOT ANDROID) +# Mac OSX with Network Extension don't need service +if(NOT IOS AND NOT ANDROID AND NOT MACOS_NE) add_subdirectory(service) include(${CMAKE_SOURCE_DIR}/deploy/installer/config.cmake) diff --git a/client/3rd-prebuilt b/client/3rd-prebuilt index ba580dc5..435aaa79 160000 --- a/client/3rd-prebuilt +++ b/client/3rd-prebuilt @@ -1 +1 @@ -Subproject commit ba580dc5bd7784f7b1e110ff0365f3286e549a61 +Subproject commit 435aaa793d8ce455ef4a3b2f5ff5e38f187d8efb diff --git a/client/3rd/OpenVPNAdapter b/client/3rd/OpenVPNAdapter index 7c821a8d..33afba08 160000 --- a/client/3rd/OpenVPNAdapter +++ b/client/3rd/OpenVPNAdapter @@ -1 +1 @@ -Subproject commit 7c821a8d5c1ad5ad94e0763b4f25a875b5a6fe1b +Subproject commit 33afba081c8592e8632128c7f9d6ebe53cae3d08 diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 2de5db48..74c945e9 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -30,11 +30,12 @@ add_definitions(-DPROD_PROXY_STORAGE_KEY="$ENV{PROD_PROXY_STORAGE_KEY}") add_definitions(-DDEV_AGW_PUBLIC_KEY="$ENV{DEV_AGW_PUBLIC_KEY}") add_definitions(-DDEV_AGW_ENDPOINT="$ENV{DEV_AGW_ENDPOINT}") -if(IOS) +if(IOS OR MACOS_NE) set(PACKAGES ${PACKAGES} Multimedia) endif() -if(WIN32 OR (APPLE AND NOT IOS) OR (LINUX AND NOT ANDROID)) +#Macos Network Extension doesn't need Widgets +if(WIN32 OR (APPLE AND NOT IOS AND NOT MACOS_NE) OR (LINUX AND NOT ANDROID)) set(PACKAGES ${PACKAGES} Widgets) endif() @@ -47,18 +48,23 @@ set(LIBS ${LIBS} Qt6::Core5Compat Qt6::Concurrent ) -if(IOS) +if(IOS OR MACOS_NE) set(LIBS ${LIBS} Qt6::Multimedia) endif() +# message("Client desktop build ", ${MACOS_NE}) +#Macos Network Extension doesn't need Widgets -if(WIN32 OR (APPLE AND NOT IOS) OR (LINUX AND NOT ANDROID)) +if(WIN32 OR (APPLE AND NOT IOS AND NOT MACOS_NE) OR (LINUX AND NOT ANDROID)) + message("Run this block when MACOS_NE is not defined or set to FALSE") set(LIBS ${LIBS} Qt6::Widgets) endif() qt_standard_project_setup() qt_add_executable(${PROJECT} MANUAL_FINALIZATION) -if(WIN32 OR (APPLE AND NOT IOS) OR (LINUX AND NOT ANDROID)) +# TODO error in there +if(WIN32 OR (APPLE AND NOT IOS AND NOT MACOS_NE) OR (LINUX AND NOT ANDROID)) + message("Run this block when MACOS_NE is not defined or set to FALSE") qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_interface.rep) qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_process_interface.rep) qt_add_repc_replicas(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/../ipc/ipc_process_tun2socks.rep) @@ -96,10 +102,18 @@ qt6_add_resources(QRC ${I18NQRC} ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc) # -- i18n end if(IOS) + message("Building for iOS") execute_process(COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/ios/scripts/openvpn.sh args WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) endif() +# Build openvpn adapter for MacOS Network Extension +if(MACOS_NE) + message("Building for MacOS Network Extension") + execute_process(COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/macos/scripts/openvpn.sh args + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) +endif() + set(IS_CI ${CI}) if(IS_CI) message("Detected CI env") @@ -160,12 +174,24 @@ include_directories(mozilla) include_directories(mozilla/shared) include_directories(mozilla/models) -if(NOT IOS) +if(MACOS_NE) + message("MACOS_NE is ON") + add_definitions(-DQ_OS_IOS) + add_definitions(-DMACOS_NE) + message("Add macros for MacOS Network Extension") +else() + message("MACOS_NE is OFF") +endif() + + +if(NOT IOS AND NOT MACOS_NE) + message(" Add header for non-IOS and non-MACOS_NE") set(HEADERS ${HEADERS} ${CMAKE_CURRENT_LIST_DIR}/platforms/ios/QRCodeReaderBase.h ) endif() + if(NOT ANDROID) set(HEADERS ${HEADERS} ${CMAKE_CURRENT_LIST_DIR}/ui/notificationhandler.h @@ -210,7 +236,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") target_compile_definitions(${PROJECT} PRIVATE "MZ_DEBUG") endif() -if(NOT IOS) +if(NOT IOS AND NOT MACOS_NE) set(SOURCES ${SOURCES} ${CMAKE_CURRENT_LIST_DIR}/platforms/ios/QRCodeReaderBase.cpp ) @@ -318,10 +344,11 @@ if(LINUX AND NOT ANDROID) link_directories(${CMAKE_CURRENT_LIST_DIR}/platforms/linux) endif() -if(WIN32 OR (APPLE AND NOT IOS) OR (LINUX AND NOT ANDROID)) - message("Client desktop build") +# Macos Network Extension doesn't need +if(WIN32 OR (APPLE AND NOT IOS AND NOT MACOS_NE) OR (LINUX AND NOT ANDROID)) + message("-----> Client desktop build") add_compile_definitions(AMNEZIA_DESKTOP) - + message("-----> Add AMNEZIA_DESKTOP") set(HEADERS ${HEADERS} ${CMAKE_CURRENT_LIST_DIR}/core/ipcclient.h ${CMAKE_CURRENT_LIST_DIR}/core/privileged_process.h @@ -354,9 +381,12 @@ endif() if(IOS) include(cmake/ios.cmake) include(cmake/ios-arch-fixup.cmake) -elseif(APPLE AND NOT IOS) - include(cmake/osxtools.cmake) +elseif(APPLE AND NOT IOS AND NOT DEFINED MACOS_NE) + # include(cmake/osxtools.cmake) include(cmake/macos.cmake) +elseif(APPLE AND NOT IOS AND MACOS_NE) + include(cmake/osxtools.cmake) + include(cmake/macos_ne.cmake) endif() target_link_libraries(${PROJECT} PRIVATE ${LIBS}) @@ -375,7 +405,7 @@ elseif(APPLE AND NOT IOS) set(DEPLOY_PLATFORM_PATH "macos") endif() -if(NOT IOS AND NOT ANDROID) +if(NOT IOS AND NOT ANDROID AND NOT MACOS_NE) add_custom_command( TARGET ${PROJECT} POST_BUILD COMMAND ${CMAKE_COMMAND} -E $,copy_directory,true> @@ -394,4 +424,35 @@ if(NOT IOS AND NOT ANDROID) endif() target_sources(${PROJECT} PRIVATE ${SOURCES} ${HEADERS} ${RESOURCES} ${QRC} ${I18NQRC}) +if(MACOS_NE) + # MacOS specific bundle operations + add_custom_command(TARGET ${PROJECT} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + "$/Contents/Frameworks" + + COMMAND ${CMAKE_COMMAND} -E copy_directory + "$ENV{QT_HOST_PATH}/lib/QtConcurrent.framework" + "$/Contents/Frameworks/QtConcurrent.framework" + + COMMENT "Copying QtConcurrent.framework from QT_HOST_PATH to the bundle's Frameworks directory" + ) + + + # MacOS specific application deployment + add_custom_command(TARGET ${PROJECT} POST_BUILD + COMMAND ${QT_BIN_DIR_DETECTED}/macdeployqt $ -appstore-compliant -qmldir=${CMAKE_CURRENT_SOURCE_DIR} + ) + + # MacOS specific code signing for Release + if(CMAKE_BUILD_TYPE STREQUAL "Release") + SET(SIGN_CMD codesign --deep --force --sign 'Apple Distribution: Privacy Technologies OU \(X7UJ388FXK\)' --timestamp --options runtime $) + message("Manual signing bundle...") + message(${SIGN_CMD}) + + add_custom_command(TARGET ${PROJECT} POST_BUILD + COMMAND ${SIGN_CMD} + ) + endif() +endif() + qt_finalize_target(${PROJECT}) diff --git a/client/cmake/macos_ne.cmake b/client/cmake/macos_ne.cmake new file mode 100644 index 00000000..a7776a0e --- /dev/null +++ b/client/cmake/macos_ne.cmake @@ -0,0 +1,181 @@ +message("Client ==> MacOS NE build") + +set_target_properties(${PROJECT} PROPERTIES MACOSX_BUNDLE TRUE) +set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE INTERNAL "" FORCE) +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(OBJCXX) +enable_language(Swift) + +find_package(Qt6 REQUIRED COMPONENTS ShaderTools) +set(LIBS ${LIBS} Qt6::ShaderTools) + +find_library(FW_AUTHENTICATIONSERVICES AuthenticationServices) +#find_library(FW_UIKIT UIKit) +find_library(FW_AVFOUNDATION AVFoundation) +find_library(FW_FOUNDATION Foundation) +find_library(FW_STOREKIT StoreKit) +find_library(FW_USERNOTIFICATIONS UserNotifications) +find_library(FW_NETWORKEXTENSION NetworkExtension) + +set(LIBS ${LIBS} + ${FW_AUTHENTICATIONSERVICES} +# ${FW_UIKIT} + ${FW_AVFOUNDATION} + ${FW_FOUNDATION} + ${FW_STOREKIT} + ${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}) + +# set(HEADERS ${HEADERS} +# ${CMAKE_CURRENT_SOURCE_DIR}/ui/macos_util.h +# ) + +# set(SOURCES ${SOURCES} +# ${CMAKE_CURRENT_SOURCE_DIR}/ui/macos_util.mm +# ) + + +target_include_directories(${PROJECT} PRIVATE ${Qt6Gui_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/main.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_LINK_BUILD_PHASE_MODE KNOWN_LOCATION + XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks" + XCODE_EMBED_APP_EXTENSIONS networkextension + + XCODE_ATTRIBUTE_CODE_SIGN_STYLE Automatic + # XCODE_ATTRIBUTE_CODE_SIGN_STYLE Manual + + # XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Apple Distribution: Privacy Technologies OU (X7UJ388FXK)" + # XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY[variant=Debug] "Apple Development" + + + # XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER "Mac AppStore AmneziaVPN" + # XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER[variant=Debug] "Mac AppStore AmneziaVPN" + +) +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 +# ${CMAKE_CURRENT_SOURCE_DIR}/platforms/ios/iosvpnprotocol.swift + ${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_ne/app/AmneziaVPNLaunchScreen.storyboard + ${CMAKE_CURRENT_SOURCE_DIR}/macos/app/Media.xcassets + ${CMAKE_CURRENT_SOURCE_DIR}/macos/app/PrivacyInfo.xcprivacy +) + +set_property(TARGET ${PROJECT} APPEND PROPERTY RESOURCE + #${CMAKE_CURRENT_SOURCE_DIR}/macos/app/AmneziaVPNLaunchScreen.storyboard + ${CMAKE_CURRENT_SOURCE_DIR}/macos/app/Media.xcassets + ${CMAKE_CURRENT_SOURCE_DIR}/macos/app/PrivacyInfo.xcprivacy +) + +add_subdirectory(macos/networkextension) +add_dependencies(${PROJECT} networkextension) + +# set_property(TARGET ${PROJECT} PROPERTY XCODE_EMBED_FRAMEWORKS +# "${CMAKE_CURRENT_SOURCE_DIR}/3rd/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework" +# ) + + + +# set(CMAKE_XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/3rd/OpenVPNAdapter/build/Release-iphoneos) +# target_link_libraries("networkextension" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/3rd/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework") + +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) + + +# add_custom_command(TARGET ${PROJECT} POST_BUILD +# COMMAND ${QT_BIN_DIR_DETECTED}/macdeployqt $ -appstore-compliant -qmldir=${CMAKE_CURRENT_SOURCE_DIR} +# ) + +# if(CMAKE_BUILD_TYPE STREQUAL "Release") +# SET(SIGN_CMD codesign --deep --force --sign 'Apple Distribution: Privacy Technologies OU \(X7UJ388FXK\)' --timestamp --options runtime $) +# message("Manual signing bundle...") +# message(${SIGN_CMD}) + + +# add_custom_command(TARGET ${PROJECT} POST_BUILD +# COMMAND ${SIGN_CMD} +# ) +# endif() diff --git a/client/cmake/osxtools.cmake b/client/cmake/osxtools.cmake index a28c9680..4564bfe0 100644 --- a/client/cmake/osxtools.cmake +++ b/client/cmake/osxtools.cmake @@ -76,7 +76,7 @@ function(osx_bundle_assetcatalog TARGET) ) ## Patch the asset catalog into the target bundle. - if(NOT IOS) + if(NOT IOS AND NOT MACOS_NE) set(XCASSETS_RESOURCE_DIR "Resources") endif() add_custom_command(TARGET ${TARGET} POST_BUILD @@ -141,6 +141,7 @@ function(osx_codesign_target TARGET) endif() foreach(FILE ${CODESIGN_FILES}) + message(STATUS "Signing ${TARGET}: ${FILE}") add_custom_command(TARGET ${TARGET} POST_BUILD VERBATIM COMMAND ${COMMENT_ECHO_COMMAND} "Signing ${TARGET}: ${FILE}" COMMAND ${CODESIGN_BIN} ${CODESIGN_ARGS} ${FILE} diff --git a/client/configurators/ssh_configurator.cpp b/client/configurators/ssh_configurator.cpp index 308f5947..d21360e3 100644 --- a/client/configurators/ssh_configurator.cpp +++ b/client/configurators/ssh_configurator.cpp @@ -102,7 +102,9 @@ QProcessEnvironment SshConfigurator::prepareEnv() pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\cygwin;"); pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\openvpn;"); #elif defined(Q_OS_MACX) +#if !defined(MACOS_NE) pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "/Contents/MacOS"); +#endif #endif env.insert("PATH", pathEnvVar); diff --git a/client/macos/app/AmneziaVPNLaunchScreen.storyboard b/client/macos/app/AmneziaVPNLaunchScreen.storyboard new file mode 100644 index 00000000..92f79f7e --- /dev/null +++ b/client/macos/app/AmneziaVPNLaunchScreen.storyboard @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/macos/app/Info.plist.in b/client/macos/app/Info.plist.in new file mode 100644 index 00000000..a10160be --- /dev/null +++ b/client/macos/app/Info.plist.in @@ -0,0 +1,178 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${QT_INTERNAL_DOLLAR_VAR}{PRODUCT_NAME} + CFBundleExecutable + ${MACOSX_BUNDLE_EXECUTABLE_NAME} + CFBundleIdentifier + ${MACOSX_BUNDLE_GUI_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + NSHumanReadableCopyright + ${MACOSX_BUNDLE_COPYRIGHT} + ITSAppUsesNonExemptEncryption + + LSRequiresIPhoneOS + + LSSupportsOpeningDocumentsInPlace + + UILaunchStoryboardName + AmneziaVPNLaunchScreen + UIRequiredDeviceCapabilities + + UIRequiresFullScreen + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIUserInterfaceStyle + Light + com.wireguard.ios.app_group_id + group.org.amnezia.AmneziaVPN + UIViewControllerBasedStatusBarAppearance + + NSCameraUsageDescription + Amnezia VPN needs access to the camera for reading QR-codes. + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSAllowsLocalNetworking + + + CFBundleIcons + + CFBundleIcons~ipad + + UTImportedTypeDeclarations + + + UTTypeConformsTo + + public.data + + UTTypeDescription + Amnezia VPN config + UTTypeIconFiles + + UTTypeIdentifier + org.amnezia.AmneziaVPN.amnezia-config + UTTypeTagSpecification + + public.filename-extension + + vpn + + public.mime-type + + text/plain + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + WireGuard config + UTTypeIconFiles + + UTTypeIdentifier + org.amnezia.AmneziaVPN.wireguard-config + UTTypeTagSpecification + + public.filename-extension + + conf + cfg + + public.mime-type + + text/plain + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + OpenVPN config + UTTypeIconFiles + + UTTypeIdentifier + org.amnezia.AmneziaVPN.openvpn-config + UTTypeTagSpecification + + public.filename-extension + + ovpn + + public.mime-type + + text/plain + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + AmneziaVPN backup file + UTTypeIconFiles + + UTTypeIdentifier + org.amnezia.AmneziaVPN.backup-config + UTTypeTagSpecification + + public.filename-extension + + backup + + public.mime-type + + text/plain + + + + + CFBundleDocumentTypes + + + CFBundleTypeName + Amnezia VPN config + LSHandlerRank + Alternate + LSItemContentTypes + + org.amnezia.AmneziaVPN.amnezia-config + org.amnezia.AmneziaVPN.wireguard-config + org.amnezia.AmneziaVPN.openvpn-config + org.amnezia.AmneziaVPN.backup-config + + + + + diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/100.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/100.png new file mode 100644 index 00000000..bbe3d546 Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/100.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/1024.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/1024.png new file mode 100644 index 00000000..0f2ba915 Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/1024.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/114.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/114.png new file mode 100644 index 00000000..f88f66c7 Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/114.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/120.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/120.png new file mode 100644 index 00000000..51829dc1 Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/120.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/144.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/144.png new file mode 100644 index 00000000..0e28bd7b Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/144.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/152.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/152.png new file mode 100644 index 00000000..81066df7 Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/152.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/167.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/167.png new file mode 100644 index 00000000..44858c5a Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/167.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/180.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/180.png new file mode 100644 index 00000000..911f5491 Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/180.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/20.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/20.png new file mode 100644 index 00000000..bb44c366 Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/20.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/29.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/29.png new file mode 100644 index 00000000..bf9a2c19 Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/29.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/40.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/40.png new file mode 100644 index 00000000..dbcf6fad Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/40.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/50.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/50.png new file mode 100644 index 00000000..83c3e6b7 Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/50.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/57.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/57.png new file mode 100644 index 00000000..f2a56e74 Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/57.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/58.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/58.png new file mode 100644 index 00000000..2714c6bf Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/58.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/60.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/60.png new file mode 100644 index 00000000..a7303586 Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/60.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/72.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/72.png new file mode 100644 index 00000000..d0f20363 Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/72.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/76.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/76.png new file mode 100644 index 00000000..ccf90ddc Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/76.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/80.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/80.png new file mode 100644 index 00000000..9f7b1037 Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/80.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/87.png b/client/macos/app/Media.xcassets/AppIcon.appiconset/87.png new file mode 100644 index 00000000..918e04f6 Binary files /dev/null and b/client/macos/app/Media.xcassets/AppIcon.appiconset/87.png differ diff --git a/client/macos/app/Media.xcassets/AppIcon.appiconset/Contents.json b/client/macos/app/Media.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..3d771d98 --- /dev/null +++ b/client/macos/app/Media.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,290 @@ +{ + "images" : [ + { + "filename" : "40.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "60.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "filename" : "29.png", + "idiom" : "iphone", + "scale" : "1x", + "size" : "29x29" + }, + { + "filename" : "58.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "87.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "filename" : "80.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "filename" : "120.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "filename" : "57.png", + "idiom" : "iphone", + "scale" : "1x", + "size" : "57x57" + }, + { + "filename" : "114.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "57x57" + }, + { + "filename" : "120.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "filename" : "180.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "filename" : "20.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "filename" : "40.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "29.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "filename" : "58.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "40.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "filename" : "80.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "filename" : "50.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "50x50" + }, + { + "filename" : "100.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "50x50" + }, + { + "filename" : "72.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "72x72" + }, + { + "filename" : "144.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "72x72" + }, + { + "filename" : "76.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "filename" : "152.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "filename" : "167.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "filename" : "1024.png", + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + }, + { + "idiom" : "watch", + "role" : "notificationCenter", + "scale" : "2x", + "size" : "24x24", + "subtype" : "38mm" + }, + { + "idiom" : "watch", + "role" : "notificationCenter", + "scale" : "2x", + "size" : "27.5x27.5", + "subtype" : "42mm" + }, + { + "idiom" : "watch", + "role" : "companionSettings", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "watch", + "role" : "companionSettings", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "watch", + "role" : "notificationCenter", + "scale" : "2x", + "size" : "33x33", + "subtype" : "45mm" + }, + { + "idiom" : "watch", + "role" : "appLauncher", + "scale" : "2x", + "size" : "40x40", + "subtype" : "38mm" + }, + { + "idiom" : "watch", + "role" : "appLauncher", + "scale" : "2x", + "size" : "44x44", + "subtype" : "40mm" + }, + { + "idiom" : "watch", + "role" : "appLauncher", + "scale" : "2x", + "size" : "46x46", + "subtype" : "41mm" + }, + { + "idiom" : "watch", + "role" : "appLauncher", + "scale" : "2x", + "size" : "50x50", + "subtype" : "44mm" + }, + { + "idiom" : "watch", + "role" : "appLauncher", + "scale" : "2x", + "size" : "51x51", + "subtype" : "45mm" + }, + { + "idiom" : "watch", + "role" : "appLauncher", + "scale" : "2x", + "size" : "54x54", + "subtype" : "49mm" + }, + { + "idiom" : "watch", + "role" : "quickLook", + "scale" : "2x", + "size" : "86x86", + "subtype" : "38mm" + }, + { + "idiom" : "watch", + "role" : "quickLook", + "scale" : "2x", + "size" : "98x98", + "subtype" : "42mm" + }, + { + "idiom" : "watch", + "role" : "quickLook", + "scale" : "2x", + "size" : "108x108", + "subtype" : "44mm" + }, + { + "idiom" : "watch", + "role" : "quickLook", + "scale" : "2x", + "size" : "117x117", + "subtype" : "45mm" + }, + { + "idiom" : "watch", + "role" : "quickLook", + "scale" : "2x", + "size" : "129x129", + "subtype" : "49mm" + }, + { + "idiom" : "watch-marketing", + "scale" : "1x", + "size" : "1024x1024" + }, + { + "idiom" : "car", + "scale" : "2x", + "size" : "60" + }, + { + "idiom" : "car", + "scale" : "3x", + "size" : "60" + }, + { + "idiom" : "watch", + "role" : "longLook", + "scale" : "2x", + "size" : "44x44", + "subtype" : "42mm" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/client/macos/app/Media.xcassets/Contents.json b/client/macos/app/Media.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/client/macos/app/Media.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/client/macos/app/PrivacyInfo.xcprivacy b/client/macos/app/PrivacyInfo.xcprivacy new file mode 100644 index 00000000..24e32f37 --- /dev/null +++ b/client/macos/app/PrivacyInfo.xcprivacy @@ -0,0 +1,33 @@ + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryUserDefaults + NSPrivacyAccessedAPITypeReasons + + 1C8F.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + + diff --git a/client/macos/app/launch.png b/client/macos/app/launch.png new file mode 100644 index 00000000..175b1afc Binary files /dev/null and b/client/macos/app/launch.png differ diff --git a/client/macos/app/main.entitlements b/client/macos/app/main.entitlements new file mode 100644 index 00000000..d9f00bb1 --- /dev/null +++ b/client/macos/app/main.entitlements @@ -0,0 +1,20 @@ + + + + + com.apple.developer.networking.networkextension + + packet-tunnel-provider + + com.apple.security.application-groups + + group.org.amnezia.AmneziaVPN + + com.apple.security.files.user-selected.read-write + + keychain-access-groups + + $(AppIdentifierPrefix)group.org.amnezia.AmneziaVPN + + + diff --git a/client/macos/networkextension/AmneziaVPNNetworkExtension.entitlements b/client/macos/networkextension/AmneziaVPNNetworkExtension.entitlements index b4f08784..1d6ec4a1 100644 --- a/client/macos/networkextension/AmneziaVPNNetworkExtension.entitlements +++ b/client/macos/networkextension/AmneziaVPNNetworkExtension.entitlements @@ -3,40 +3,26 @@ com.apple.application-identifier - $(DEVELOPMENT_TEAM).$(NETEXT_ID_MACOS) - + X7UJ388FXK.org.amnezia.AmneziaVPN.network-extension com.apple.developer.networking.networkextension packet-tunnel-provider - - keychain-access-groups - - $(DEVELOPMENT_TEAM).* - - com.apple.developer.team-identifier - $(DEVELOPMENT_TEAM) - - com.apple.developer.system-extension.install - - + X7UJ388FXK com.apple.security.app-sandbox - com.apple.security.application-groups - $(DEVELOPMENT_TEAM).$(GROUP_ID_MACOS) + group.org.amnezia.AmneziaVPN - com.apple.security.network.client - com.apple.security.network.server - com.apple.security.app-sandbox - - com.apple.private.network.socket-delegate - + keychain-access-groups + + $(AppIdentifierPrefix)org.amnezia.AmneziaVPN.network-extension + diff --git a/client/macos/networkextension/CMakeLists.txt b/client/macos/networkextension/CMakeLists.txt new file mode 100644 index 00000000..d0d50b1b --- /dev/null +++ b/client/macos/networkextension/CMakeLists.txt @@ -0,0 +1,207 @@ +enable_language(Swift) +message("Client message >> macos build >> networkextension") +set(CLIENT_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..) + +add_executable(networkextension) + +configure_file( + ${CMAKE_CURRENT_LIST_DIR}/Info.plist.in + ${CMAKE_CURRENT_BINARY_DIR}/Info.plist +) + +if(MACOS_NE) + message("MACOS_NE is ON") + add_definitions(-DQ_OS_IOS) + add_definitions(-DMACOS_NE) + message("Add macros for MacOS Network Extension") +else() + message("MACOS_NE is OFF") +endif() + +set_target_properties(networkextension PROPERTIES + XCODE_PRODUCT_TYPE com.apple.product-type.app-extension + BUNDLE_EXTENSION appex + + #MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist + + MACOSX_BUNDLE_SHORT_VERSION_STRING "${APPLE_PROJECT_VERSION}" + + 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_TARGETED_DEVICE_FAMILY "1,2" + + XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../../Frameworks" + + XCODE_ATTRIBUTE_CODE_SIGN_STYLE Automatic + # #XCODE_ATTRIBUTE_CODE_SIGN_STYLE Manual + + # #XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Apple Distribution: Privacy Technologies OU (X7UJ388FXK)" + # #XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY[variant=Debug] "Apple Development" + + + # #XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER "Mac AppStore AmneziaVPN.network-extension" + # #XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER[variant=Debug] "Mac AppStore AmneziaVPN.network-extension" + + XCODE_ATTRIBUTE_INFOPLIST_FILE "${CMAKE_CURRENT_BINARY_DIR}/Info.plist" + XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../../../../Frameworks @loader_path/../../../../Frameworks" +) + +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set_target_properties(networkextension PROPERTIES + XCODE_ATTRIBUTE_CODE_SIGN_STYLE Automatic + ) +endif() + +if(CMAKE_BUILD_TYPE STREQUAL "Release") + set_target_properties(networkextension PROPERTIES + XCODE_ATTRIBUTE_CODE_SIGN_STYLE Automatic + #XCODE_ATTRIBUTE_CODE_SIGN_STYLE Manual + + #XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Apple Distribution: Privacy Technologies OU (X7UJ388FXK)" + #XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY[variant=Debug] "Apple Development" + + + #XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER "Mac AppStore AmneziaVPN.network-extension" + #XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER[variant=Debug] "Mac AppStore AmneziaVPN.network-extension" + ) +endif() + + +set_target_properties(networkextension 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("networkextension" 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(OpenVPNAdapter_DIR "${CLIENT_ROOT_DIR}/3rd/") + +# find_library(OPENVPN_ADAPTER_LIBRARY OpenVPNAdapter PATHS ${OpenVPNAdapter_DIR}) +# target_link_libraries(networkextension PRIVATE ${OPENVPN_ADAPTER_LIBRARY}) + +# add_custom_command(TARGET networkextension PRE_BUILD +# COMMAND ${CMAKE_COMMAND} -E make_directory $/../Frameworks +# ) + + +# add_custom_command(TARGET networkextension POST_BUILD +# COMMAND ${CMAKE_COMMAND} -E echo "Copying ${OPENVPN_ADAPTER_LIBRARY} to $/../Frameworks/" +# COMMAND ${CMAKE_COMMAND} -E copy_if_different +# ${OPENVPN_ADAPTER_LIBRARY} +# $/../Frameworks/ +# COMMAND ${CMAKE_COMMAND} -E echo "Copy complete" +# ) + + + + +# Set the root directory +set(CLIENT_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..) + +# Embedding the framework using CLIENT_ROOT_DIR +set_property(TARGET networkextension PROPERTY XCODE_EMBED_FRAMEWORKS + "${CLIENT_ROOT_DIR}/3rd/OpenVPNAdapter/build/Release-macos/OpenVPNAdapter.framework" +) + +# Setting the framework search paths using CLIENT_ROOT_DIR +set(CMAKE_XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS "${CLIENT_ROOT_DIR}/3rd/OpenVPNAdapter/build/Release-macos") + +# Linking the framework using CLIENT_ROOT_DIR +target_link_libraries("networkextension" PRIVATE "${CLIENT_ROOT_DIR}/3rd/OpenVPNAdapter/build/Release-macos/OpenVPNAdapter.framework") + + + +#target_link_libraries(networkextension PRIVATE ${FW_ASSETS_LIBRARY}) +#target_link_libraries(networkextension PRIVATE ${FW_MOBILE_CORE}) +#target_link_libraries(networkextension PRIVATE ${FW_UI_KIT}) +target_link_libraries(networkextension PRIVATE ${FW_LIBRESOLV}) + +target_compile_options(networkextension PRIVATE -DGROUP_ID=\"${BUILD_IOS_GROUP_IDENTIFIER}\") +target_compile_options(networkextension 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(networkextension 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 +) + +target_sources(networkextension PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/PrivacyInfo.xcprivacy +) + +set_property(TARGET networkextension 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(networkextension PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/wireguard-go-version.h) + +target_include_directories(networkextension PRIVATE ${CLIENT_ROOT_DIR}) +target_include_directories(networkextension PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + +target_link_libraries(networkextension PRIVATE ${CLIENT_ROOT_DIR}/3rd-prebuilt/3rd-prebuilt/wireguard/macos/x86_64/libwg-go.a) + +# Print the root directory for debugging purposes +message("---------") +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("networkextension" PRIVATE "${CLIENT_ROOT_DIR}/3rd-prebuilt/3rd-prebuilt/xray/HevSocks5Tunnel.xcframework/macos-arm64_x86_64/libhev-socks5-tunnel.a") + +target_include_directories(networkextension PRIVATE ${CLIENT_ROOT_DIR}/3rd-prebuilt/3rd-prebuilt/xray/HevSocks5Tunnel.xcframework/macos-arm64_x86_64/Headers) \ No newline at end of file diff --git a/client/macos/networkextension/Info.plist b/client/macos/networkextension/Info.plist.in similarity index 63% rename from client/macos/networkextension/Info.plist rename to client/macos/networkextension/Info.plist.in index 96d82459..5ceaa356 100644 --- a/client/macos/networkextension/Info.plist +++ b/client/macos/networkextension/Info.plist.in @@ -3,27 +3,32 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - AmneziaVPNNetworkExtension + en CFBundleExecutable - $(EXECUTABLE_NAME) + AmneziaVPNNetworkExtension + CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) + ${BUILD_IOS_APP_IDENTIFIER}.network-extension CFBundleInfoDictionaryVersion 6.0 CFBundleName - $(PRODUCT_NAME) + AmneziaVPNNetworkExtension CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - $(MARKETING_VERSION) + ${APPLE_PROJECT_VERSION} CFBundleVersion - $(CURRENT_PROJECT_VERSION) + ${CMAKE_PROJECT_VERSION_TWEAK} + ITSAppUsesNonExemptEncryption + LSMinimumSystemVersion - $(MACOSX_DEPLOYMENT_TARGET) + ${CMAKE_OSX_DEPLOYMENT_TARGET} + + CFBundleDisplayName + AmneziaVPNNetworkExtension + NSExtension NSExtensionPointIdentifier @@ -31,5 +36,11 @@ NSExtensionPrincipalClass $(PRODUCT_MODULE_NAME).PacketTunnelProvider + + com.wireguard.ios.app_group_id + group.org.amnezia.AmneziaVPN + + com.wireguard.macos.app_group_id + ${BUILD_VPN_DEVELOPMENT_TEAM}.group.org.amnezia.AmneziaVPN diff --git a/client/macos/networkextension/PrivacyInfo.xcprivacy b/client/macos/networkextension/PrivacyInfo.xcprivacy new file mode 100644 index 00000000..380e0b7b --- /dev/null +++ b/client/macos/networkextension/PrivacyInfo.xcprivacy @@ -0,0 +1,25 @@ + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryUserDefaults + NSPrivacyAccessedAPITypeReasons + + 1C8F.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + + diff --git a/client/macos/networkextension/WireGuardNetworkExtension-Bridging-Header.h b/client/macos/networkextension/WireGuardNetworkExtension-Bridging-Header.h index 4ae7bded..f911e186 100644 --- a/client/macos/networkextension/WireGuardNetworkExtension-Bridging-Header.h +++ b/client/macos/networkextension/WireGuardNetworkExtension-Bridging-Header.h @@ -1,10 +1,6 @@ -/* 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 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "macos/gobridge/wireguard.h" #include "wireguard-go-version.h" -#include "3rd/awg-apple/Sources/WireGuardKitC/WireGuardKitC.h" +#include "3rd/amneziawg-apple/Sources/WireGuardKitGo/wireguard.h" +#include "3rd/amneziawg-apple/Sources/WireGuardKitC/WireGuardKitC.h" #include #include @@ -23,3 +19,8 @@ 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]); void write_msg_to_log(const char* tag, const char* msg); + +// Khai báo hàm C để Swift có thể sử dụng +void hev_socks5_tunnel_quit(void); +// Updated function definition in C +int hev_socks5_tunnel_main(const char* configFile, int fd); diff --git a/client/macos/networkextension/wireguard-go-version.h.in b/client/macos/networkextension/wireguard-go-version.h.in new file mode 100644 index 00000000..860bc3c3 --- /dev/null +++ b/client/macos/networkextension/wireguard-go-version.h.in @@ -0,0 +1,3 @@ +#ifndef WIREGUARD_GO_VERSION +#define WIREGUARD_GO_VERSION "@WG_VERSION_STRING@" +#endif // WIREGUARD_GO_VERSION \ No newline at end of file diff --git a/client/macos/scripts/clangwrap.sh b/client/macos/scripts/clangwrap.sh new file mode 100755 index 00000000..1d0db357 --- /dev/null +++ b/client/macos/scripts/clangwrap.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# go/clangwrap_macos.sh + +# Lấy đường dẫn SDK cho macOS +SDK_PATH=`xcrun --sdk macosx --show-sdk-path` + +# Tìm đường dẫn đến `clang` cho macOS +CLANG=`xcrun --sdk macosx --find clang` + +# Xác định kiến trúc máy dựa trên biến GOARCH +if [ "$GOARCH" == "amd64" ]; then + CARCH="x86_64" +elif [ "$GOARCH" == "arm64" ]; then + CARCH="arm64" +fi + +# Thực thi `clang` với các tùy chọn cụ thể cho macOS +exec $CLANG -arch $CARCH -isysroot $SDK_PATH -mmacosx-version-min=10.15 "$@" diff --git a/client/macos/scripts/openvpn.sh b/client/macos/scripts/openvpn.sh new file mode 100644 index 00000000..8c371618 --- /dev/null +++ b/client/macos/scripts/openvpn.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +XCODEBUILD="/usr/bin/xcodebuild" +WORKINGDIR=`pwd` +PATCH="/usr/bin/patch" + +echo "Building OpenVPNAdapter for macOS Network Extension (MacNE)..." + +# Copy the Project-MacNE.xcconfig settings to amnezia.xcconfig +cat $WORKINGDIR/3rd/OpenVPNAdapter/Configuration/Project-MacNE.xcconfig > $WORKINGDIR/3rd/OpenVPNAdapter/Configuration/amnezia.xcconfig + +# Append macOS-specific build directory configurations to amnezia.xcconfig +cat << EOF >> $WORKINGDIR/3rd/OpenVPNAdapter/Configuration/amnezia.xcconfig +PROJECT_TEMP_DIR = $WORKINGDIR/3rd/OpenVPNAdapter/build/OpenVPNAdapter.build +CONFIGURATION_BUILD_DIR = $WORKINGDIR/3rd/OpenVPNAdapter/build/Release-macos +BUILT_PRODUCTS_DIR = $WORKINGDIR/3rd/OpenVPNAdapter/build/Release-macos +EOF + +# Exclude UIKit, include Cocoa for macOS +# echo "OTHER_LDFLAGS = -framework Cocoa" >> $WORKINGDIR/3rd/OpenVPNAdapter/Configuration/amnezia.xcconfig + +# Fetch the current macOS SDK version dynamically +MACOSX_SDK=$(xcrun --sdk macosx --show-sdk-path | sed -E 's/.*MacOSX([0-9]+\.[0-9]+)\.sdk/\1/') + +echo "Using macOS SDK version: $MACOSX_SDK" + +cd 3rd/OpenVPNAdapter + +# Build for macOS using the correct SDK and destination +if $XCODEBUILD -scheme OpenVPNAdapter -configuration Release -xcconfig Configuration/amnezia.xcconfig -sdk macosx$MACOSX_SDK -destination 'generic/platform=macOS' -project OpenVPNAdapter.xcodeproj ; then + echo "OpenVPNAdapter built successfully for macOS Network Extension (MacNE)" +else + echo "OpenVPNAdapter macOS Network Extension (MacNE) build failed..." +fi + +# Remove CodeSignature if needed for macOS +rm -rf ./build/Release-macos/OpenVPNAdapter.framework/Versions/A/_CodeSignature + +cd ../../ diff --git a/client/platforms/ios/PacketTunnelProvider+OpenVPN.swift b/client/platforms/ios/PacketTunnelProvider+OpenVPN.swift index 3e0a4a07..f1af7449 100644 --- a/client/platforms/ios/PacketTunnelProvider+OpenVPN.swift +++ b/client/platforms/ios/PacketTunnelProvider+OpenVPN.swift @@ -47,7 +47,7 @@ extension PacketTunnelProvider { let configuration = OpenVPNConfiguration() configuration.fileContent = ovpnConfiguration if str.contains("cloak") { - configuration.setPTCloak() +// configuration.setPTCloak() } let evaluation: OpenVPNConfigurationEvaluation? diff --git a/client/platforms/ios/PacketTunnelProvider+Xray.swift b/client/platforms/ios/PacketTunnelProvider+Xray.swift index 648b3613..ff80cb29 100644 --- a/client/platforms/ios/PacketTunnelProvider+Xray.swift +++ b/client/platforms/ios/PacketTunnelProvider+Xray.swift @@ -1,10 +1,196 @@ +//import Foundation +//import NetworkExtension +//import WireGuardKitGo +// +//enum XrayErrors: Error { +// case noXrayConfig +// case xrayConfigIsWrong +// case cantSaveXrayConfig +// case cantParseListenAndPort +// case cantSaveHevSocksConfig +//} +// +//extension Constants { +// static let cachesDirectory: URL = { +// if let cachesDirectoryURL = FileManager.default.urls(for: .cachesDirectory, +// in: .userDomainMask).first { +// return cachesDirectoryURL +// } else { +// fatalError("Unable to retrieve caches directory.") +// } +// }() +//} +// +//extension PacketTunnelProvider { +// func startXray(completionHandler: @escaping (Error?) -> Void) { +// +// // Xray configuration +// guard let protocolConfiguration = self.protocolConfiguration as? NETunnelProviderProtocol, +// let providerConfiguration = protocolConfiguration.providerConfiguration, +// let configData = providerConfiguration[Constants.xrayConfigKey] as? Data else { +// xrayLog(.error, message: "Can't get xray configuration") +// completionHandler(XrayErrors.noXrayConfig) +// return +// } +// +// // Tunnel settings +// let ipv6Enabled = false +// let hideVPNIcon = false +// +// let settings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "254.1.1.1") +// settings.mtu = 9000 +// +// settings.ipv4Settings = { +// let settings = NEIPv4Settings(addresses: ["198.18.0.1"], subnetMasks: ["255.255.0.0"]) +// settings.includedRoutes = [NEIPv4Route.default()] +// return settings +// }() +// +// settings.ipv6Settings = { +// guard ipv6Enabled else { +// return nil +// } +// let settings = NEIPv6Settings(addresses: ["fd6e:a81b:704f:1211::1"], networkPrefixLengths: [64]) +// settings.includedRoutes = [NEIPv6Route.default()] +// if hideVPNIcon { +// settings.excludedRoutes = [NEIPv6Route(destinationAddress: "::", networkPrefixLength: 128)] +// } +// return settings +// }() +// +// do { +// let xrayConfig = try JSONDecoder().decode(XrayConfig.self, +// from: configData) +// +// var dnsArray = [String]() +// if let dns1 = xrayConfig.dns1 { +// dnsArray.append(dns1) +// } +// if let dns2 = xrayConfig.dns2 { +// dnsArray.append(dns2) +// } +// +// settings.dnsSettings = !dnsArray.isEmpty +// ? NEDNSSettings(servers: dnsArray) +// : NEDNSSettings(servers: ["1.1.1.1"]) +// +// let xrayConfigData = xrayConfig.config.data(using: .utf8) +// +// guard let xrayConfigData else { +// xrayLog(.error, message: "Can't encode config to data") +// completionHandler(XrayErrors.xrayConfigIsWrong) +// return +// } +// +// let jsonDict = try JSONSerialization.jsonObject(with: xrayConfigData, +// options: []) as? [String: Any] +// +// guard var jsonDict else { +// xrayLog(.error, message: "Can't parse address and port for hevSocks") +// completionHandler(XrayErrors.cantParseListenAndPort) +// return +// } +// +// let port = 10808 +// let address = "::1" +// +// if var inboundsArray = jsonDict["inbounds"] as? [[String: Any]], !inboundsArray.isEmpty { +// inboundsArray[0]["port"] = port +// inboundsArray[0]["listen"] = address +// jsonDict["inbounds"] = inboundsArray +// } +// +// let updatedData = try JSONSerialization.data(withJSONObject: jsonDict, options: []) +// +// setTunnelNetworkSettings(settings) { [weak self] error in +// if let error { +// completionHandler(error) +// return +// } +// +// // Launch xray +// self?.setupAndStartXray(configData: updatedData) { xrayError in +// if let xrayError { +// completionHandler(xrayError) +// return +// } +// +// // Launch hevSocks +// self?.setupAndRunTun2socks(configData: updatedData, +// address: address, +// port: port, +// completionHandler: completionHandler) +// } +// } +// } catch { +// completionHandler(error) +// return +// } +// } +// +// func stopXray(completionHandler: () -> Void) { +// Socks5Tunnel.quit() +// LibXrayStopXray() +// completionHandler() +// } +// +// private func setupAndStartXray(configData: Data, +// completionHandler: @escaping (Error?) -> Void) { +// let path = Constants.cachesDirectory.appendingPathComponent("config.json", isDirectory: false).path +// guard FileManager.default.createFile(atPath: path, contents: configData) else { +// xrayLog(.error, message: "Can't save xray configuration") +// completionHandler(XrayErrors.cantSaveXrayConfig) +// return +// } +// +// LibXrayRunXray(nil, +// path, +// Int64.max) +// +// completionHandler(nil) +// xrayLog(.info, message: "Xray started") +// } +// +// private func setupAndRunTun2socks(configData: Data, +// address: String, +// port: Int, +// completionHandler: @escaping (Error?) -> Void) { +// let config = """ +// tunnel: +// mtu: 9000 +// socks5: +// port: \(port) +// address: \(address) +// udp: 'udp' +// misc: +// task-stack-size: 20480 +// connect-timeout: 5000 +// read-write-timeout: 60000 +// log-file: stderr +// log-level: error +// limit-nofile: 65535 +// """ +// +// let configurationFilePath = Constants.cachesDirectory.appendingPathComponent("config.yml", isDirectory: false).path +// guard FileManager.default.createFile(atPath: configurationFilePath, contents: config.data(using: .utf8)!) else { +// xrayLog(.info, message: "Cant save hevSocks configuration") +// completionHandler(XrayErrors.cantSaveHevSocksConfig) +// return +// } +// +// DispatchQueue.global().async { +// xrayLog(.info, message: "Hev socks started") +// completionHandler(nil) +// Socks5Tunnel.run(withConfig: configurationFilePath) +// } +// } +//} import Foundation import NetworkExtension import WireGuardKitGo enum XrayErrors: Error { case noXrayConfig - case xrayConfigIsWrong case cantSaveXrayConfig case cantParseListenAndPort case cantSaveHevSocksConfig @@ -27,14 +213,14 @@ extension PacketTunnelProvider { // Xray configuration guard let protocolConfiguration = self.protocolConfiguration as? NETunnelProviderProtocol, let providerConfiguration = protocolConfiguration.providerConfiguration, - let configData = providerConfiguration[Constants.xrayConfigKey] as? Data else { + let xrayConfigData = providerConfiguration[Constants.xrayConfigKey] as? Data else { xrayLog(.error, message: "Can't get xray configuration") completionHandler(XrayErrors.noXrayConfig) return } // Tunnel settings - let ipv6Enabled = false + let ipv6Enabled = true let hideVPNIcon = false let settings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "254.1.1.1") @@ -58,29 +244,12 @@ extension PacketTunnelProvider { return settings }() + let dns = ["8.8.4.4","1.1.1.1"] + settings.dnsSettings = NEDNSSettings(servers: dns) + do { - let xrayConfig = try JSONDecoder().decode(XrayConfig.self, - from: configData) - - var dnsArray = [String]() - if let dns1 = xrayConfig.dns1 { - dnsArray.append(dns1) - } - if let dns2 = xrayConfig.dns2 { - dnsArray.append(dns2) - } - - settings.dnsSettings = !dnsArray.isEmpty - ? NEDNSSettings(servers: dnsArray) - : NEDNSSettings(servers: ["1.1.1.1"]) - - let xrayConfigData = xrayConfig.config.data(using: .utf8) - - guard let xrayConfigData else { - xrayLog(.error, message: "Can't encode config to data") - completionHandler(XrayErrors.xrayConfigIsWrong) - return - } + let port = 10808 + let address = "::1" let jsonDict = try JSONSerialization.jsonObject(with: xrayConfigData, options: []) as? [String: Any] @@ -91,9 +260,6 @@ extension PacketTunnelProvider { return } - let port = 10808 - let address = "::1" - if var inboundsArray = jsonDict["inbounds"] as? [[String: Any]], !inboundsArray.isEmpty { inboundsArray[0]["port"] = port inboundsArray[0]["listen"] = address diff --git a/client/platforms/ios/QRCodeReaderBase.mm b/client/platforms/ios/QRCodeReaderBase.mm index af879e2f..963c35a8 100644 --- a/client/platforms/ios/QRCodeReaderBase.mm +++ b/client/platforms/ios/QRCodeReaderBase.mm @@ -1,3 +1,4 @@ +#if !MACOS_NE #include "QRCodeReaderBase.h" #import @@ -108,3 +109,19 @@ void QRCodeReader::startReading() { void 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 diff --git a/client/platforms/ios/QtAppDelegate.h b/client/platforms/ios/QtAppDelegate.h index c2c1d2d3..1668f4c3 100644 --- a/client/platforms/ios/QtAppDelegate.h +++ b/client/platforms/ios/QtAppDelegate.h @@ -1,5 +1,6 @@ +#if !MACOS_NE #import - +#endif @interface QIOSApplicationDelegate @end diff --git a/client/platforms/ios/QtAppDelegate.mm b/client/platforms/ios/QtAppDelegate.mm index bd7ad6b1..64ee9425 100644 --- a/client/platforms/ios/QtAppDelegate.mm +++ b/client/platforms/ios/QtAppDelegate.mm @@ -5,7 +5,7 @@ @implementation QIOSApplicationDelegate (AmneziaVPNDelegate) - +#if !MACOS_NE - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [application setMinimumBackgroundFetchInterval: UIApplicationBackgroundFetchIntervalMinimum]; @@ -57,5 +57,5 @@ } return NO; } - +#endif @end diff --git a/client/platforms/ios/ScreenProtection.swift b/client/platforms/ios/ScreenProtection.swift index 1355dc13..a2b5d7a3 100644 --- a/client/platforms/ios/ScreenProtection.swift +++ b/client/platforms/ios/ScreenProtection.swift @@ -1,3 +1,13 @@ +#if MACOS_NE +public func toggleScreenshots(_ isEnabled: Bool) { + +} + +class ScreenProtection { + + +} +#else import UIKit public func toggleScreenshots(_ isEnabled: Bool) { @@ -85,3 +95,4 @@ struct ProtectionPair { textField.removeFromSuperview() } } +#endif diff --git a/client/platforms/ios/ios_controller.mm b/client/platforms/ios/ios_controller.mm index 85fb50b7..d66c5239 100644 --- a/client/platforms/ios/ios_controller.mm +++ b/client/platforms/ios/ios_controller.mm @@ -27,6 +27,7 @@ const char* MessageKey::isOnDemand = "is-on-demand"; const char* MessageKey::SplitTunnelType = "SplitTunnelType"; const char* MessageKey::SplitTunnelSites = "SplitTunnelSites"; +#if !MACOS_NE static UIViewController* getViewController() { NSArray *windows = [[UIApplication sharedApplication]windows]; for (UIWindow *window in windows) { @@ -36,6 +37,7 @@ static UIViewController* getViewController() { } return nil; } +#endif Vpn::ConnectionState iosStatusToState(NEVPNStatus status) { switch (status) { @@ -789,14 +791,14 @@ bool IosController::shareText(const QStringList& filesToSend) { NSURL *logFileUrl = [[NSURL alloc] initFileURLWithPath:filesToSend[i].toNSString()]; [sharingItems addObject:logFileUrl]; } - +#if !MACOS_NE UIViewController *qtController = getViewController(); if (!qtController) return; UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil]; - +#endif __block bool isAccepted = false; - +#if !MACOS_NE [activityController setCompletionWithItemsHandler:^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) { isAccepted = completed; emit finished(); @@ -808,7 +810,7 @@ bool IosController::shareText(const QStringList& filesToSend) { popController.sourceView = qtController.view; popController.sourceRect = CGRectMake(100, 100, 100, 100); } - +#endif QEventLoop wait; QObject::connect(this, &IosController::finished, &wait, &QEventLoop::quit); wait.exec(); @@ -817,6 +819,7 @@ bool IosController::shareText(const QStringList& filesToSend) { } QString IosController::openFile() { +#if !MACOS_NE UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.item"] inMode:UIDocumentPickerModeOpen]; DocumentPickerDelegate *documentPickerDelegate = [[DocumentPickerDelegate alloc] init]; @@ -826,9 +829,9 @@ QString IosController::openFile() { if (!qtController) return; [qtController presentViewController:documentPicker animated:YES completion:nil]; - +#endif __block QString filePath; - +#if !MACOS_NE documentPickerDelegate.documentPickerClosedCallback = ^(NSString *path) { if (path) { filePath = QString::fromUtf8(path.UTF8String); @@ -837,7 +840,7 @@ QString IosController::openFile() { } emit finished(); }; - +#endif QEventLoop wait; QObject::connect(this, &IosController::finished, &wait, &QEventLoop::quit); wait.exec(); @@ -863,3 +866,4 @@ void IosController::requestInetAccess() { }]; [task resume]; } + diff --git a/client/platforms/ios/ios_controller_wrapper.h b/client/platforms/ios/ios_controller_wrapper.h index f0333d77..ab325154 100644 --- a/client/platforms/ios/ios_controller_wrapper.h +++ b/client/platforms/ios/ios_controller_wrapper.h @@ -1,7 +1,11 @@ #import #import #import + +#if !MACOS_NE #include +#endif + #include class IosController; @@ -17,9 +21,10 @@ class IosController; @end typedef void (^DocumentPickerClosedCallback)(NSString *path); - +#if !MACOS_NE @interface DocumentPickerDelegate : NSObject @property (nonatomic, copy) DocumentPickerClosedCallback documentPickerClosedCallback; @end +#endif diff --git a/client/platforms/ios/ios_controller_wrapper.mm b/client/platforms/ios/ios_controller_wrapper.mm index 1f8c938f..38eb2d22 100644 --- a/client/platforms/ios/ios_controller_wrapper.mm +++ b/client/platforms/ios/ios_controller_wrapper.mm @@ -26,7 +26,8 @@ @end -@implementation DocumentPickerDelegate +#if !MACOS_NE +@implementation DocumentPickerDelegate - (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray *)urls { for (NSURL *url in urls) { @@ -42,4 +43,5 @@ } } -@end \ No newline at end of file +@end +#endif diff --git a/client/platforms/ios/iosnotificationhandler.mm b/client/platforms/ios/iosnotificationhandler.mm index efa48385..773c6297 100644 --- a/client/platforms/ios/iosnotificationhandler.mm +++ b/client/platforms/ios/iosnotificationhandler.mm @@ -6,6 +6,8 @@ #import #import + +#if !MACOS_NE #import @interface IOSNotificationDelegate @@ -87,3 +89,86 @@ 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 { + 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)m_delegate; + + [center addNotificationRequest:request + withCompletionHandler:^(NSError* _Nullable error) { + if (error) { + NSLog(@"Local Notification failed"); + } + }]; +} +#endif diff --git a/client/protocols/vpnprotocol.cpp b/client/protocols/vpnprotocol.cpp index 056089b8..4b3edca5 100644 --- a/client/protocols/vpnprotocol.cpp +++ b/client/protocols/vpnprotocol.cpp @@ -4,7 +4,7 @@ #include "core/errorstrings.h" #include "vpnprotocol.h" -#if defined(Q_OS_WINDOWS) || defined(Q_OS_MACX) || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) +#if defined(Q_OS_WINDOWS) || defined(Q_OS_MACX) and !defined MACOS_NE || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) #include "openvpnovercloakprotocol.h" #include "openvpnprotocol.h" #include "shadowsocksvpnprotocol.h" @@ -109,7 +109,7 @@ VpnProtocol *VpnProtocol::factory(DockerContainer container, const QJsonObject & #if defined(Q_OS_WINDOWS) case DockerContainer::Ipsec: return new Ikev2Protocol(configuration); #endif -#if defined(Q_OS_WINDOWS) || defined(Q_OS_MACX) || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) +#if defined(Q_OS_WINDOWS) || defined(Q_OS_MACX) and !defined MACOS_NE || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) case DockerContainer::OpenVpn: return new OpenVpnProtocol(configuration); case DockerContainer::Cloak: return new OpenVpnOverCloakProtocol(configuration); case DockerContainer::ShadowSocks: return new ShadowSocksVpnProtocol(configuration); diff --git a/client/translations/amneziavpn_ar_EG.ts b/client/translations/amneziavpn_ar_EG.ts index e176d8eb..515abd56 100644 --- a/client/translations/amneziavpn_ar_EG.ts +++ b/client/translations/amneziavpn_ar_EG.ts @@ -258,18 +258,18 @@ Can't be disabled for current server غير قادر علي فتح الملف - - + + Invalid configuration file ملف تكوين غير صحيح - + Scanned %1 of %2. تم فحص%1 من %2. - + In the imported configuration, potentially dangerous lines were found: في التكوين المستورد، تم العثور على سطور يحتمل أن تكون خطرة: @@ -401,28 +401,28 @@ Already installed containers were found on the server. All installed containers NotificationHandler - - + + AmneziaVPN AmneziaVPN - + VPN Connected تم الاتصال - + VPN Disconnected تم إنهاء الاتصال - + AmneziaVPN notification إشعار من AmneziaVPN - + Unsecured network detected: تم العثور علي شبكة غير مؤمنة: @@ -2426,12 +2426,12 @@ Already installed containers were found on the server. All installed containers عنوان خادم IP [:منفذ] - + Continue واصل - + All data you enter will remain strictly confidential and will not be shared or disclosed to the Amnezia or any third parties ستظل جميع البيانات التي تدخلها سرية للغاية ولن تتم مشاركتها أو الكشف عنها ل Amnezia أو أي طرف ثالث @@ -2441,42 +2441,42 @@ Already installed containers were found on the server. All installed containers - + SSH Username - + Password or SSH private key كلمة مرور او مفتاح SSH خاص - + How to run your VPN server كيف تقوم بتشغيل خادم ال VPN الخاص بك - + Where to get connection data, step-by-step instructions for buying a VPS اين تحصل علي بيانات الاتصال, تعليمات خطوة ب خطوة لشراء VPS - + Ip address cannot be empty لا يمكن لعنوان IP ان يكون فارغ - + Enter the address in the format 255.255.255.255:88 ادخل العنوان في شكل 255.255.255.255:88 - + Login cannot be empty تسجيل دخول لا يمكن ان يكون فارغ - + Password/private key cannot be empty كلمة مرور/مفتاح خاص لأ يمكن ان يكونو فارغين @@ -2791,42 +2791,47 @@ Already installed containers were found on the server. All installed containers البيانات المٌرسلة: %1 - + + Allowed IPs: %1 + + + + Rename إعادة التسمية - + Client name اسم العميل - + Save احفظ - + Revoke سحب وإبطال - + Revoke the config for a user - %1? سحب وإبطال للمستخدم - %1? - + The user will no longer be able to connect to your server. المستخدم لن يكون قادر علي الاتصال بعد الان. - + Continue واصل - + Cancel إلغاء @@ -4100,12 +4105,12 @@ While it offers a blend of security, stability, and speed, it's essential t main2 - + Private key passphrase عبارة المرور الخاصة بالمفتاح - + Save احفظ diff --git a/client/translations/amneziavpn_fa_IR.ts b/client/translations/amneziavpn_fa_IR.ts index 6cd78e77..468f16b4 100644 --- a/client/translations/amneziavpn_fa_IR.ts +++ b/client/translations/amneziavpn_fa_IR.ts @@ -263,18 +263,18 @@ Can't be disabled for current server نمی‌توان فایل را باز کرد. - - + + Invalid configuration file فایل پیکربندی نامعتبر است. - + Scanned %1 of %2. ارزیابی %1 از %2. - + In the imported configuration, potentially dangerous lines were found: در پیکربندی وارد شده، خطوطی که ممکن است خطرناک باشند، یافت شدند: @@ -405,28 +405,28 @@ Already installed containers were found on the server. All installed containers NotificationHandler - - + + AmneziaVPN AmneziaVPN - + VPN Connected وی‎پی‎ان وصل شد - + VPN Disconnected وی‎پی‎ان قطع شد - + AmneziaVPN notification اخطار AmneziaVPN - + Unsecured network detected: شبکه ناامن شناسایی شد: @@ -2544,12 +2544,12 @@ It's okay as long as it's from someone you trust. آدرس آی‎پی سرور (:پورت) - + Continue ادامه - + Enter the address in the format 255.255.255.255:88 آدرس را با فرمت 255.255.255.255:88 وارد کنید @@ -2564,42 +2564,42 @@ It's okay as long as it's from someone you trust. - + SSH Username - + Password or SSH private key رمز عبور یا کلید خصوصی SSH - + All data you enter will remain strictly confidential and will not be shared or disclosed to the Amnezia or any third parties تمام داده‎هایی که شما وارد می‎کنید به شدت محرمانه‎ است و با Amnezia یا هر شخص ثالث دیگری به اشتراک گذاشته نمی‎شود - + How to run your VPN server چگونه سرور VPN خود را اجرا کنید - + Where to get connection data, step-by-step instructions for buying a VPS داده‌های اتصال را از کجا دریافت کنید و دستورالعمل‌های مرحله به مرحله برای خرید یک VPS - + Ip address cannot be empty آدرس آی‎پی نمی‎تواند خالی باشد - + Login cannot be empty نام‎کاربری نمی‎تواند خالی باشد - + Password/private key cannot be empty پسورد یا کلید خصوصی نمی‎تواند خالی باشد @@ -2958,47 +2958,52 @@ It's okay as long as it's from someone you trust. Data sent: %1 داده‌های ارسال شده: %1 + + + Allowed IPs: %1 + + Creation date: تاریخ ایجاد: - + Rename تغییر نام - + Client name نام کلاینت - + Save ذخیره - + Revoke ابطال - + Revoke the config for a user - %1? لغو پیکربندی برای یک کاربر - %1? - + The user will no longer be able to connect to your server. کاربر دیگر نمی‎تواند به سرور وصل شود. - + Continue ادامه - + Cancel کنسل @@ -4316,12 +4321,12 @@ For more detailed information, you can main2 - + Private key passphrase عبارت کلید خصوصی - + Save ذخیره diff --git a/client/translations/amneziavpn_hi_IN.ts b/client/translations/amneziavpn_hi_IN.ts index ab459b7c..92cebd8c 100644 --- a/client/translations/amneziavpn_hi_IN.ts +++ b/client/translations/amneziavpn_hi_IN.ts @@ -259,18 +259,18 @@ Can't be disabled for current server फाइल खोलने में असमर्थ - - + + Invalid configuration file अमान्य कॉन्फ़िगरेशन फ़ाइल - + Scanned %1 of %2. %2 में से %1 स्कैन किया गया. - + In the imported configuration, potentially dangerous lines were found: @@ -401,28 +401,28 @@ Already installed containers were found on the server. All installed containers NotificationHandler - - + + AmneziaVPN AmneziaVPN - + VPN Connected कनेक्ट - + VPN Disconnected कनेक्ट - + AmneziaVPN notification AmneziaVPN अधिसूचना - + Unsecured network detected: असुरक्षित नेटवर्क का पता चला: @@ -2494,12 +2494,12 @@ Already installed containers were found on the server. All installed containers सर्वर आईपी पता [:पोर्ट] - + Continue जारी रखना - + All data you enter will remain strictly confidential and will not be shared or disclosed to the Amnezia or any third parties आपके द्वारा दर्ज किया गया सभी डेटा पूरी तरह से गोपनीय रहेगा और एमनेज़िया या किसी तीसरे पक्ष को साझा या प्रकट नहीं किया जाएगा @@ -2509,42 +2509,42 @@ Already installed containers were found on the server. All installed containers 255.255.255.255:22 - + SSH Username SSH उपयोगकर्ता नाम - + Password or SSH private key पासवर्ड या SSH निजी कुंजी - + How to run your VPN server - + Where to get connection data, step-by-step instructions for buying a VPS - + Ip address cannot be empty आईपी ​​पता खाली नहीं हो सकता - + Enter the address in the format 255.255.255.255:88 पता 255.255.255.255:88 प्रारूप में दर्ज करें - + Login cannot be empty लॉगिन खाली नहीं हो सकता - + Password/private key cannot be empty पासवर्ड/निजी कुंजी खाली नहीं हो सकती @@ -2876,47 +2876,52 @@ Already installed containers were found on the server. All installed containers Data sent: %1 डेटा भेजा गया: %1 + + + Allowed IPs: %1 + + Creation date: निर्माण तिथि: - + Rename नाम बदलें - + Client name ग्राहक नाम - + Save सहेजें - + Revoke निरस्त करें - + Revoke the config for a user - %1? किसी उपयोक्ता के लिए कॉन्फ़िगरेशन निरस्त करें - %1? - + The user will no longer be able to connect to your server. उपयोगकर्ता अब आपके सर्वर से कनेक्ट नहीं हो पाएगा. - + Continue जारी रखना - + Cancel रद्द करना @@ -4208,12 +4213,12 @@ While it offers a blend of security, stability, and speed, it's essential t main2 - + Private key passphrase निजी कुंजी पासफ़्रेज़ - + Save सहेजें diff --git a/client/translations/amneziavpn_my_MM.ts b/client/translations/amneziavpn_my_MM.ts index 3e964cc9..7479e454 100644 --- a/client/translations/amneziavpn_my_MM.ts +++ b/client/translations/amneziavpn_my_MM.ts @@ -259,18 +259,18 @@ Can't be disabled for current server ဖိုင်ကိုဖွင့်၍မရပါ - - + + Invalid configuration file Configuration ဖိုင် မမှန်ကန်ပါ - + Scanned %1 of %2. %2 ၏ %1 ကို စကင်န်ဖတ်ထားသည်. - + In the imported configuration, potentially dangerous lines were found: တင်သွင်းသည့် configuration တွင်၊ အန္တရာယ်ရှိနိုင်သည့်စာလိုင်းများကို တွေ့ရှိခဲ့သည်: @@ -401,28 +401,28 @@ Already installed containers were found on the server. All installed containers NotificationHandler - - + + AmneziaVPN AmneziaVPN - + VPN Connected VPN ချိတ်ဆက်ထားပါပြီ - + VPN Disconnected VPN ဖြုတ်လိုက်ပါပြီ - + AmneziaVPN notification AmneziaVPN နိုတီ - + Unsecured network detected: လုံခြုံမှုမရှိသောကွန်ရက်မှန်း ထောက်လှန်းမိသည်: @@ -2430,12 +2430,12 @@ Already installed containers were found on the server. All installed containers ဆာဗာ IP လိပ်စာ [:port] - + Continue ဆက်လက်လုပ်ဆောင်မည် - + Enter the address in the format 255.255.255.255:88 လိပ်စာကို 255.255.255.255:88 ဖော်မတ်ဖြင့် ထည့်ပါ @@ -2450,42 +2450,42 @@ Already installed containers were found on the server. All installed containers 255.255.255.255:22 - + SSH Username SSH အသုံးပြုသူအမည် - + Password or SSH private key စကားဝှက် သိုမဟုတ် SSH private key - + All data you enter will remain strictly confidential and will not be shared or disclosed to the Amnezia or any third parties သင်ထည့်သွင်းသည့်ဒေတာအားလုံးကို တင်းကြပ်လုံခြုံစွာလျှို့ဝှက်ထားမည်ဖြစ်ပြီး Amnezia သို့မဟုတ် မည်သည့်ပြင်ပအဖွဲ့အစည်းကိုမျှ မျှဝေမည် သို့မဟုတ် ထုတ်ဖော်မည်မဟုတ်ပါ - + How to run your VPN server သင်၏ဆာဗာကို လည်ပတ်ပုံလည်ပတ်နည်း - + Where to get connection data, step-by-step instructions for buying a VPS ချိတ်ဆက်မှုဒေတာကို ဘယ်မှာရနိုင်မလဲ၊ VPS ဝယ်ယူပုံဝယ်ယူနည်းအတွက် အဆင့်ဆင့် ညွှန်ကြားချက်များ - + Ip address cannot be empty IP လိပ်စာသည် ဗလာမဖြစ်ရပါ - + Login cannot be empty လော့ဂ်အင်အချက်အလက်သည် ဗလာမဖြစ်ရပါ - + Password/private key cannot be empty စကားဝှက်/private key သည် ဗလာမဖြစ်ရပါ @@ -2825,42 +2825,47 @@ Already installed containers were found on the server. All installed containers ပေးပို့လိုက်သည့်ဒေတာ: %1 - + + Allowed IPs: %1 + + + + Rename အမည်ပြောင်းမည် - + Client name ကလိုင်းရင့်အမည် - + Save သိမ်းဆည်းမည် - + Revoke ပြန်ရုပ်သိမ်းမည် - + Revoke the config for a user - %1? အသုံးပြုသူ %1 အတွက် config ကို ပြန်လည်ရုပ်သိမ်းမည်လား? - + The user will no longer be able to connect to your server. ဤအသုံးပြုသူသည် သင့်ဆာဗာသို့ ချိတ်ဆက်နိုင်တော့မည်မဟုတ်ပါ. - + Continue ဆက်လက်လုပ်ဆောင်မည် - + Cancel ပယ်ဖျက်မည် @@ -4105,12 +4110,12 @@ For more detailed information, you can main2 - + Private key passphrase ကိုယ်ပိုင် key စကားဝှက် - + Save သိမ်းဆည်းမည် diff --git a/client/translations/amneziavpn_ru_RU.ts b/client/translations/amneziavpn_ru_RU.ts index 2fb21259..b8f1a242 100644 --- a/client/translations/amneziavpn_ru_RU.ts +++ b/client/translations/amneziavpn_ru_RU.ts @@ -263,18 +263,18 @@ Can't be disabled for current server Невозможно открыть файл - - + + Invalid configuration file Неверный файл конфигурации - + Scanned %1 of %2. Отсканировано %1 из %2. - + In the imported configuration, potentially dangerous lines were found: В импортированной конфигурации были обнаружены потенциально опасные строки: @@ -405,28 +405,28 @@ Already installed containers were found on the server. All installed containers NotificationHandler - - + + AmneziaVPN AmneziaVPN - + VPN Connected VPN подключен - + VPN Disconnected VPN выключен - + AmneziaVPN notification Уведомление AmneziaVPN - + Unsecured network detected: Обнаружена незащищенная сеть: @@ -2628,7 +2628,7 @@ It's okay as long as it's from someone you trust. Password / SSH private key - + Continue Продолжить @@ -2638,7 +2638,7 @@ and will not be shared or disclosed to the Amnezia or any third parties Все данные, которые вы вводите, останутся строго конфиденциальными и не будут переданы или раскрыты Amnezia или каким-либо третьим лицам - + Enter the address in the format 255.255.255.255:88 Введите адрес в формате 255.255.255.255:88 @@ -2657,42 +2657,42 @@ and will not be shared or disclosed to the Amnezia or any third parties 255.255.255.255:22 - + SSH Username Имя пользователя SSH - + Password or SSH private key Пароль или закрытый ключ SSH - + All data you enter will remain strictly confidential and will not be shared or disclosed to the Amnezia or any third parties Все данные, которые вы вводите, останутся строго конфиденциальными и не будут переданы или раскрыты Amnezia или каким-либо третьим лицам - + How to run your VPN server Как создать VPN на собственном сервере - + Where to get connection data, step-by-step instructions for buying a VPS Где взять данные для подключения, пошаговые инстуркции по покупке VPS - + Ip address cannot be empty Поле с IP-адресом не может быть пустым - + Login cannot be empty Поле с логином не может быть пустым - + Password/private key cannot be empty Поле с паролем/закрытым ключом не может быть пустым @@ -3087,47 +3087,52 @@ and will not be shared or disclosed to the Amnezia or any third parties Data sent: %1 Отправлено данных: %1 + + + Allowed IPs: %1 + + Creation date: Дата создания: - + Rename Переименовать - + Client name Имя клиента - + Save Сохранить - + Revoke Отозвать - + Revoke the config for a user - %1? Отозвать конфигурацию для пользователя - %1? - + The user will no longer be able to connect to your server. Пользователь больше не сможет подключаться к вашему серверу. - + Continue Продолжить - + Cancel Отменить @@ -4547,12 +4552,12 @@ This means that AmneziaWG keeps the fast performance of the original while addin main2 - + Private key passphrase Парольная фраза для закрытого ключа - + Save Сохранить diff --git a/client/translations/amneziavpn_uk_UA.ts b/client/translations/amneziavpn_uk_UA.ts index c7195119..73a731ec 100644 --- a/client/translations/amneziavpn_uk_UA.ts +++ b/client/translations/amneziavpn_uk_UA.ts @@ -290,18 +290,18 @@ Can't be disabled for current server Неможливо відкрити файл - - + + Invalid configuration file Недійсний файл конфігурації - + Scanned %1 of %2. Відскановано %1 з %2. - + In the imported configuration, potentially dangerous lines were found: У імпортованій конфігурації знайдено потенційно небезпечні рядки: @@ -431,28 +431,28 @@ Already installed containers were found on the server. All installed containers NotificationHandler - - + + AmneziaVPN AmneziaVPN - + VPN Connected VPN Підключено - + VPN Disconnected VPN Вимкнено - + AmneziaVPN notification Сповіщення AmneziaVPN - + Unsecured network detected: Знайдена не захищена мережа: @@ -2714,7 +2714,7 @@ It's okay as long as it's from someone you trust. Password / SSH private key - + Continue Продовжити @@ -2725,7 +2725,7 @@ and will not be shared or disclosed to the Amnezia or any third parties і не будуть передані чи розголошені Amnezia або будь-яким третім особам - + Enter the address in the format 255.255.255.255:88 Введіть адресу в форматі 255.255.255.255:88 @@ -2744,42 +2744,42 @@ and will not be shared or disclosed to the Amnezia or any third parties 255.255.255.255:22 - + SSH Username SSH Username - + Password or SSH private key Пароль або SSH ключ - + All data you enter will remain strictly confidential and will not be shared or disclosed to the Amnezia or any third parties Усі дані, які ви вводите, залишатимуться суворо конфіденційними та не будуть передані чи розголошені Amnezia або будь-яким третім особам - + How to run your VPN server Як запустити ваш VPN-сервер - + Where to get connection data, step-by-step instructions for buying a VPS Де отримати дані для підключення: покрокові інструкції з придбання VPS - + Ip address cannot be empty Поле IP address не може бути пустим - + Login cannot be empty Поле Login не може бути пустим - + Password/private key cannot be empty Поле Password/Private key не може бути пустим @@ -3182,47 +3182,52 @@ and will not be shared or disclosed to the Amnezia or any third parties Data sent: %1 Відправлено даних: %1 + + + Allowed IPs: %1 + + Creation date: Дата створення: - + Rename Перейменувати - + Client name Назва клієнта - + Save Зберегти - + Revoke Відкликати - + Revoke the config for a user - %1? Відкликати доступ для користувача - %1? - + The user will no longer be able to connect to your server. Користувач більше не зможе підключатись до вашого сервера - + Continue Продовжити - + Cancel Відмінити @@ -4624,12 +4629,12 @@ This means that AmneziaWG keeps the fast performance of the original while addin main2 - + Private key passphrase Пароль для особистого ключа - + Save Зберегти diff --git a/client/translations/amneziavpn_ur_PK.ts b/client/translations/amneziavpn_ur_PK.ts index cf445bfa..5faa241a 100644 --- a/client/translations/amneziavpn_ur_PK.ts +++ b/client/translations/amneziavpn_ur_PK.ts @@ -257,18 +257,18 @@ Can't be disabled for current server فائل کو کھولنے سے قاصر ہے - - + + Invalid configuration file غلط کنفیگریشن فائل - + Scanned %1 of %2. سکین%1 کی%2. - + In the imported configuration, potentially dangerous lines were found: @@ -399,30 +399,30 @@ Already installed containers were found on the server. All installed containers NotificationHandler - - + + AmneziaVPN The translation of "AmneziaVPN" in Urdu would be: امنیزیا وی پی ای - + VPN Connected وی پی این متصل ہوگیا - + VPN Disconnected وی پی این منقطع ہوگیا - + AmneziaVPN notification امنیزیا وی پی این کی اطلاعات - + Unsecured network detected: غیر محفوظ نیٹ ورک کا پتہ لگایا گیا ہے: @@ -2498,12 +2498,12 @@ Already installed containers were found on the server. All installed containers سرور آئی پی پتہ [:پورٹ] - + Continue براہ کرم جاری رکھیں - + All data you enter will remain strictly confidential and will not be shared or disclosed to the Amnezia or any third parties آپ جو ڈیٹا داخل کریں گے وہ بالکل خفیہ رہے گا اور نہ تو امنیزیا یا کسی تیسری شخصیت کے ساتھ اشتراک کیا جائے گا @@ -2513,42 +2513,42 @@ Already installed containers were found on the server. All installed containers - + SSH Username ایس ایس ایچ صارف نام - + Password or SSH private key پاس ورڈ یا SSH نجی کلید - + How to run your VPN server - + Where to get connection data, step-by-step instructions for buying a VPS - + Ip address cannot be empty آئی پی پتہ خالی نہیں ہو سکتا - + Enter the address in the format 255.255.255.255:88 ایڈریس درج کریں فارمیٹ 255.255.255.255:88 - + Login cannot be empty لاگ ان نام خالی نہیں ہو سکتا - + Password/private key cannot be empty پاس ورڈ یا نجی کلید خالی نہیں ہو سکتی @@ -2880,47 +2880,52 @@ Already installed containers were found on the server. All installed containers Data sent: %1 + + + Allowed IPs: %1 + + Creation date: تخلیق کی تاریخ: - + Rename نام تبدیل - + Client name کلائنٹ کا نام - + Save محفوظ - + Revoke واپس لین - + Revoke the config for a user - %1? کیا آپ مستعمل کے لئے کنفیگ کو واپس لینا چاہتے ہیں - %1؟ - + The user will no longer be able to connect to your server. صارف آپ کے سرور سے متصل ہونے کا اختیار نہیں رہے گا. - + Continue جاری رکھیں - + Cancel منسوخ @@ -4154,12 +4159,12 @@ While it offers a blend of security, stability, and speed, it's essential t main2 - + Private key passphrase نجی کلید پاس فریز - + Save محفوظ کریں diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index 39b6bee0..8015c249 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -262,18 +262,18 @@ Can't be disabled for current server - - + + Invalid configuration file - + Scanned %1 of %2. 扫描 %1 of %2. - + In the imported configuration, potentially dangerous lines were found: @@ -427,28 +427,28 @@ Already installed containers were found on the server. All installed containers NotificationHandler - - + + AmneziaVPN - + VPN Connected 已连接到VPN - + VPN Disconnected 已从VPN断开 - + AmneziaVPN notification AmneziaVPN 提示 - + Unsecured network detected: 发现不安全网络 @@ -2673,12 +2673,12 @@ It's okay as long as it's from someone you trust. 密码 或 私钥 - + Continue 继续 - + All data you enter will remain strictly confidential and will not be shared or disclosed to the Amnezia or any third parties 您输入的所有数据将严格保密,不会与 Amnezia 或任何第三方共享或披露 @@ -2694,42 +2694,42 @@ and will not be shared or disclosed to the Amnezia or any third parties - + SSH Username SSH 用户名 - + Password or SSH private key 密码或 SSH 私钥 - + How to run your VPN server - + Where to get connection data, step-by-step instructions for buying a VPS - + Ip address cannot be empty IP不能为空 - + Enter the address in the format 255.255.255.255:88 按照这种格式输入 255.255.255.255:88 - + Login cannot be empty 账号不能为空 - + Password/private key cannot be empty 密码或私钥不能为空 @@ -3086,47 +3086,52 @@ and will not be shared or disclosed to the Amnezia or any third parties Data sent: %1 + + + Allowed IPs: %1 + + Creation date: 创建日期: - + Rename 重新命名 - + Client name 客户名称 - + Save 保存 - + Revoke 撤销 - + Revoke the config for a user - %1? 撤销用户的配置- %1? - + The user will no longer be able to connect to your server. 该用户将无法再连接到您的服务器. - + Continue 继续 - + Cancel 取消 @@ -4610,12 +4615,12 @@ While it offers a blend of security, stability, and speed, it's essential t main2 - + Private key passphrase 私钥密码 - + Save 保存 diff --git a/client/ui/controllers/pageController.cpp b/client/ui/controllers/pageController.cpp index bbcc55a1..a00eba43 100644 --- a/client/ui/controllers/pageController.cpp +++ b/client/ui/controllers/pageController.cpp @@ -24,7 +24,7 @@ PageController::PageController(const QSharedPointer &serversModel, AndroidController::instance()->setNavigationBarColor(initialPageNavigationBarColor); #endif -#if defined Q_OS_MACX +#if defined Q_OS_MACX and !defined MACOS_NE connect(this, &PageController::raiseMainWindow, []() { setDockIconVisible(true); }); connect(this, &PageController::hideMainWindow, []() { setDockIconVisible(false); }); #endif @@ -114,7 +114,7 @@ void PageController::showOnStartup() } else { #if defined(Q_OS_WIN) || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) emit hideMainWindow(); -#elif defined Q_OS_MACX +#elif defined Q_OS_MACX and !defined MACOS_NE setDockIconVisible(false); #endif } diff --git a/client/ui/notificationhandler.cpp b/client/ui/notificationhandler.cpp index 5efb45c4..b8ad8957 100644 --- a/client/ui/notificationhandler.cpp +++ b/client/ui/notificationhandler.cpp @@ -5,12 +5,15 @@ #include #include "notificationhandler.h" -#if defined(Q_OS_IOS) +#if defined(Q_OS_IOS) || defined(MACOS_NE) # include "platforms/ios/iosnotificationhandler.h" +// #elif defined(MACOS_NE) +// # include "platforms/ios/iosnotificationhandler.h" #else # include "systemtray_notificationhandler.h" #endif + // static NotificationHandler* NotificationHandler::create(QObject* parent) { #if defined(Q_OS_IOS) diff --git a/client/ui/systemtray_notificationhandler.h b/client/ui/systemtray_notificationhandler.h index 60bf0b35..a3fb84cc 100644 --- a/client/ui/systemtray_notificationhandler.h +++ b/client/ui/systemtray_notificationhandler.h @@ -8,7 +8,7 @@ #include "notificationhandler.h" #include -#include +#include 'QMenu' file not found class SystemTrayNotificationHandler : public NotificationHandler { Q_OBJECT diff --git a/deploy/AnhTVMacOSMain.provisionprofile b/deploy/AnhTVMacOSMain.provisionprofile new file mode 100644 index 00000000..675c8dd0 Binary files /dev/null and b/deploy/AnhTVMacOSMain.provisionprofile differ diff --git a/deploy/AnhTVMacOSNE.mobileprovision b/deploy/AnhTVMacOSNE.mobileprovision new file mode 100644 index 00000000..88735f24 Binary files /dev/null and b/deploy/AnhTVMacOSNE.mobileprovision differ diff --git a/deploy/build_macos_ne.sh b/deploy/build_macos_ne.sh new file mode 100755 index 00000000..27cc7cc4 --- /dev/null +++ b/deploy/build_macos_ne.sh @@ -0,0 +1,138 @@ +#!/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 +BUILD_DIR=$DEPLOY_DIR/build + +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 + +# Setup provisioning profiles for main app and NE +echo "Setting up provisioning profiles..." + +# Tạo thư mục Provisioning Profiles nếu chưa tồn tại +mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles + +# Setup provisioning profile cho main app +echo "Setting up provisioning profile for main app (AmneziaVPN)" +cp $PROJECT_DIR/deploy/AnhTVMacOSMain.provisionprofile ~/Library/MobileDevice/Provisioning\ Profiles/ +macos_main_uuid=$(grep UUID -A1 -a ~/Library/MobileDevice/Provisioning\ Profiles/AnhTVMacOSMain.provisionprofile | grep -io "[-A-F0-9]\{36\}") +mv ~/Library/MobileDevice/Provisioning\ Profiles/AnhTVMacOSMain.provisionprofile ~/Library/MobileDevice/Provisioning\ Profiles/$macos_main_uuid.mobileprovision + +# Setup provisioning profile cho Network Extension (NE) +echo "Setting up provisioning profile for Network Extension" +cp $PROJECT_DIR/deploy/AnhTVMacOSNE.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/macos_ne.mobileprovision +macos_ne_uuid=$(grep UUID -A1 -a ~/Library/MobileDevice/Provisioning\ Profiles/macos_ne.mobileprovision | grep -io "[-A-F0-9]\{36\}") +mv ~/Library/MobileDevice/Provisioning\ Profiles/macos_ne.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/$macos_ne_uuid.mobileprovision + +# Giải mã và cài đặt chứng chỉ ký code +echo "Installing signing certificates..." +echo $MAC_TRUST_CERT_BASE64 | base64 --decode > mac_trust_cert.pem +echo $MAC_SIGNING_CERT_BASE64 | base64 --decode > mac_signing_cert.p12 + +# Cài đặt chứng chỉ vào keychain +security create-keychain -p password build.keychain +security default-keychain -s build.keychain +security unlock-keychain -p password build.keychain +security import mac_trust_cert.pem -k build.keychain -A +security import mac_signing_cert.p12 -k build.keychain -P $MAC_SIGNING_CERT_PASSWORD -A + +# Thiết lập keychain cho quá trình ký +security set-key-partition-list -S apple-tool:,apple: -s -k password build.keychain + +# Check if QIF_VERSION is properly set, otherwise set a default +if [ -z "${QIF_VERSION+x}" ]; then + echo "QIF_VERSION is not set, using default 4.6" + QIF_VERSION=4.6 +fi + +QIF_BIN_DIR="$QT_BIN_DIR/../../../Tools/QtInstallerFramework/$QIF_VERSION/bin" + +# Checking environment +$QT_BIN_DIR/qt-cmake --version || { echo "Error: qt-cmake not found in $QT_BIN_DIR"; exit 1; } +cmake --version || { echo "Error: cmake not found"; exit 1; } +clang -v || { echo "Error: clang not found"; exit 1; } + +# Build the Network Extension app +echo "Building Network Extension App..." +mkdir -p build-macos-ne +cd build-macos-ne + +$QT_BIN_DIR/qt-cmake .. -GXcode -DQT_HOST_PATH=$QT_MACOS_ROOT_DIR -DMACOS_NE=TRUE +cmake --build . --config release --target AmneziaVPN -- -allowProvisioningUpdates # Thay đổi target phù hợp cho Network Extension + +# Build and run tests here + +echo "____________________________________" +echo "............Deploy.................." +echo "____________________________________" + +# Package Network Extension +echo "Packaging Network Extension ..." + +# Copy necessary data +cp -Rv $PREBUILT_DEPLOY_DATA_DIR/* $BUNDLE_DIR/Contents/macOS +$QT_BIN_DIR/macdeployqt $OUT_APP_DIR/$APP_FILENAME -always-overwrite -qmldir=$PROJECT_DIR +cp -av $BUILD_DIR/service/server/$APP_NAME-service $BUNDLE_DIR/Contents/macOS +cp -Rv $PROJECT_DIR/deploy/data/macos/* $BUNDLE_DIR/Contents/macOS + +# Signing and notarizing the Network Extension +if [ "${MAC_CERT_PW+x}" ]; then + CERTIFICATE_P12=$DEPLOY_DIR/PrivacyTechAppleCertDeveloperId.p12 + WWDRCA=$DEPLOY_DIR/WWDRCA.cer + KEYCHAIN=amnezia.build.macos.keychain + TEMP_PASS=tmp_pass + + security create-keychain -p $TEMP_PASS $KEYCHAIN || true + security default-keychain -s $KEYCHAIN + security unlock-keychain -p $TEMP_PASS $KEYCHAIN + + security import $WWDRCA -k $KEYCHAIN -T /usr/bin/codesign || true + security import $CERTIFICATE_P12 -k $KEYCHAIN -P $MAC_CERT_PW -T /usr/bin/codesign || true + + echo "Signing Network Extension..." + /usr/bin/codesign --deep --force --verbose --timestamp -o runtime --sign "$MAC_SIGNER_ID" $BUNDLE_DIR + spctl -a -vvvv $BUNDLE_DIR || true + + if [ "${NOTARIZE_APP+x}" ]; then + echo "Notarizing Network Extension bundle..." + /usr/bin/ditto -c -k --keepParent $BUNDLE_DIR $PROJECT_DIR/NE_Bundle_to_notarize.zip + xcrun notarytool submit $PROJECT_DIR/NE_Bundle_to_notarize.zip --apple-id $APPLE_DEV_EMAIL --team-id $MAC_TEAM_ID --password $APPLE_DEV_PASSWORD + rm $PROJECT_DIR/NE_Bundle_to_notarize.zip + sleep 300 + xcrun stapler staple $BUNDLE_DIR + spctl -a -vvvv $BUNDLE_DIR || true + fi +fi + +# Package installer, sign, and notarize (if needed) + +# The rest of your installer packaging process similar to build_macos.sh diff --git a/deploy/installer/config.cmake b/deploy/installer/config.cmake index 13f09986..f3ab11a4 100644 --- a/deploy/installer/config.cmake +++ b/deploy/installer/config.cmake @@ -4,7 +4,7 @@ if(WIN32) ${CMAKE_CURRENT_LIST_DIR}/config/windows.xml.in ${CMAKE_BINARY_DIR}/installer/config/windows.xml ) -elseif(APPLE AND NOT IOS) +elseif(APPLE AND NOT IOS AND NOT MACOS_NE) configure_file( ${CMAKE_CURRENT_LIST_DIR}/config/macos.xml.in ${CMAKE_BINARY_DIR}/installer/config/macos.xml diff --git a/service/CMakeLists.txt b/service/CMakeLists.txt index f05dbb23..02a21631 100644 --- a/service/CMakeLists.txt +++ b/service/CMakeLists.txt @@ -6,6 +6,6 @@ project(${PROJECT}) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) -if(NOT IOS AND NOT ANDROID) +if(NOT IOS AND NOT ANDROID AND NOT MACOS_NE) add_subdirectory(server) endif()