final clean code

This commit is contained in:
Macbook 2024-10-13 17:06:56 +07:00 committed by Yaroslav Yashin
parent e0983b74fb
commit c3e4f315ed
36 changed files with 356 additions and 969 deletions

View file

@ -9,132 +9,132 @@ env:
QT_MIRROR: https://mirrors.ocf.berkeley.edu/qt/ # https://download.qt.io/static/mirrorlist/ QT_MIRROR: https://mirrors.ocf.berkeley.edu/qt/ # https://download.qt.io/static/mirrorlist/
jobs: jobs:
# Build-Linux-Ubuntu: Build-Linux-Ubuntu:
# runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
# env: env:
# QT_VERSION: 6.6.2 QT_VERSION: 6.6.2
# QIF_VERSION: 4.7 QIF_VERSION: 4.7
# PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }} PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }}
# DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }} DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }}
# steps: steps:
# - name: 'Install Qt' - name: 'Install Qt'
# uses: jurplel/install-qt-action@v3 uses: jurplel/install-qt-action@v3
# with: with:
# version: ${{ env.QT_VERSION }} version: ${{ env.QT_VERSION }}
# host: 'linux' host: 'linux'
# target: 'desktop' target: 'desktop'
# arch: 'gcc_64' arch: 'gcc_64'
# modules: 'qtremoteobjects qt5compat qtshadertools' modules: 'qtremoteobjects qt5compat qtshadertools'
# dir: ${{ runner.temp }} dir: ${{ runner.temp }}
# setup-python: 'true' setup-python: 'true'
# tools: 'tools_ifw' tools: 'tools_ifw'
# set-env: 'true' set-env: 'true'
# extra: '--external 7z --base ${{ env.QT_MIRROR }}' extra: '--external 7z --base ${{ env.QT_MIRROR }}'
# - name: 'Get sources' - name: 'Get sources'
# uses: actions/checkout@v4 uses: actions/checkout@v4
# with: with:
# submodules: 'true' submodules: 'true'
# fetch-depth: 10 fetch-depth: 10
# - name: 'Setup ccache' - name: 'Setup ccache'
# uses: hendrikmuhs/ccache-action@v1.2 uses: hendrikmuhs/ccache-action@v1.2
# - name: 'Build project' - name: 'Build project'
# run: | run: |
# sudo apt-get install libxkbcommon-x11-0 sudo apt-get install libxkbcommon-x11-0
# export QT_BIN_DIR=${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/gcc_64/bin export QT_BIN_DIR=${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/gcc_64/bin
# export QIF_BIN_DIR=${{ runner.temp }}/Qt/Tools/QtInstallerFramework/${{ env.QIF_VERSION }}/bin export QIF_BIN_DIR=${{ runner.temp }}/Qt/Tools/QtInstallerFramework/${{ env.QIF_VERSION }}/bin
# bash deploy/build_linux.sh bash deploy/build_linux.sh
# - name: 'Pack installer' - name: 'Pack installer'
# run: cd deploy && tar -cf AmneziaVPN_Linux_Installer.tar AmneziaVPN_Linux_Installer.bin run: cd deploy && tar -cf AmneziaVPN_Linux_Installer.tar AmneziaVPN_Linux_Installer.bin
# - name: 'Upload installer artifact' - name: 'Upload installer artifact'
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: AmneziaVPN_Linux_installer.tar name: AmneziaVPN_Linux_installer.tar
# path: deploy/AmneziaVPN_Linux_Installer.tar path: deploy/AmneziaVPN_Linux_Installer.tar
# retention-days: 7 retention-days: 7
# - name: 'Upload unpacked artifact' - name: 'Upload unpacked artifact'
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: AmneziaVPN_Linux_unpacked name: AmneziaVPN_Linux_unpacked
# path: deploy/AppDir path: deploy/AppDir
# retention-days: 7 retention-days: 7
# - name: 'Upload translations artifact' - name: 'Upload translations artifact'
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: AmneziaVPN_translations name: AmneziaVPN_translations
# path: client/translations path: client/translations
# retention-days: 7 retention-days: 7
# ------------------------------------------------------ # ------------------------------------------------------
# Build-Windows: Build-Windows:
# runs-on: windows-latest runs-on: windows-latest
# env: env:
# QT_VERSION: 6.6.2 QT_VERSION: 6.6.2
# QIF_VERSION: 4.7 QIF_VERSION: 4.7
# BUILD_ARCH: 64 BUILD_ARCH: 64
# PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }} PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }}
# DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }} DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }}
# steps: steps:
# - name: 'Get sources' - name: 'Get sources'
# uses: actions/checkout@v4 uses: actions/checkout@v4
# with: with:
# submodules: 'true' submodules: 'true'
# fetch-depth: 10 fetch-depth: 10
# - name: 'Setup ccache' - name: 'Setup ccache'
# uses: hendrikmuhs/ccache-action@v1.2 uses: hendrikmuhs/ccache-action@v1.2
# - name: 'Install Qt' - name: 'Install Qt'
# uses: jurplel/install-qt-action@v3 uses: jurplel/install-qt-action@v3
# with: with:
# version: ${{ env.QT_VERSION }} version: ${{ env.QT_VERSION }}
# host: 'windows' host: 'windows'
# target: 'desktop' target: 'desktop'
# arch: 'win64_msvc2019_64' arch: 'win64_msvc2019_64'
# modules: 'qtremoteobjects qt5compat qtshadertools' modules: 'qtremoteobjects qt5compat qtshadertools'
# dir: ${{ runner.temp }} dir: ${{ runner.temp }}
# setup-python: 'true' setup-python: 'true'
# tools: 'tools_ifw' tools: 'tools_ifw'
# set-env: 'true' set-env: 'true'
# extra: '--external 7z --base ${{ env.QT_MIRROR }}' extra: '--external 7z --base ${{ env.QT_MIRROR }}'
# - name: 'Setup mvsc' - name: 'Setup mvsc'
# uses: ilammy/msvc-dev-cmd@v1 uses: ilammy/msvc-dev-cmd@v1
# with: with:
# arch: 'x64' arch: 'x64'
# - name: 'Build project' - name: 'Build project'
# shell: cmd shell: cmd
# run: | run: |
# set BUILD_ARCH=${{ env.BUILD_ARCH }} set BUILD_ARCH=${{ env.BUILD_ARCH }}
# set QT_BIN_DIR="${{ runner.temp }}\\Qt\\${{ env.QT_VERSION }}\\msvc2019_64\\bin" set QT_BIN_DIR="${{ runner.temp }}\\Qt\\${{ env.QT_VERSION }}\\msvc2019_64\\bin"
# set QIF_BIN_DIR="${{ runner.temp }}\\Qt\\Tools\\QtInstallerFramework\\${{ env.QIF_VERSION }}\\bin" set QIF_BIN_DIR="${{ runner.temp }}\\Qt\\Tools\\QtInstallerFramework\\${{ env.QIF_VERSION }}\\bin"
# call deploy\\build_windows.bat call deploy\\build_windows.bat
# - name: 'Upload installer artifact' - name: 'Upload installer artifact'
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: AmneziaVPN_Windows_installer name: AmneziaVPN_Windows_installer
# path: AmneziaVPN_x${{ env.BUILD_ARCH }}.exe path: AmneziaVPN_x${{ env.BUILD_ARCH }}.exe
# retention-days: 7 retention-days: 7
# - name: 'Upload unpacked artifact' - name: 'Upload unpacked artifact'
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: AmneziaVPN_Windows_unpacked name: AmneziaVPN_Windows_unpacked
# path: deploy\\build_${{ env.BUILD_ARCH }}\\client\\Release path: deploy\\build_${{ env.BUILD_ARCH }}\\client\\Release
# retention-days: 7 retention-days: 7
# ------------------------------------------------------ # ------------------------------------------------------
@ -230,69 +230,69 @@ jobs:
# ------------------------------------------------------ # ------------------------------------------------------
# Build-MacOS: Build-MacOS:
# runs-on: macos-latest runs-on: macos-latest
# env: env:
# # Keep compat with MacOS 10.15 aka Catalina by Qt 6.4 # Keep compat with MacOS 10.15 aka Catalina by Qt 6.4
# QT_VERSION: 6.4.3 QT_VERSION: 6.4.3
# QIF_VERSION: 4.6 QIF_VERSION: 4.6
# PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }} PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }}
# DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }} DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }}
# steps: steps:
# - name: 'Setup xcode' - name: 'Setup xcode'
# uses: maxim-lobanov/setup-xcode@v1 uses: maxim-lobanov/setup-xcode@v1
# with: with:
# xcode-version: '14.3.1' xcode-version: '14.3.1'
# - name: 'Install Qt' - name: 'Install Qt'
# uses: jurplel/install-qt-action@v3 uses: jurplel/install-qt-action@v3
# with: with:
# version: ${{ env.QT_VERSION }} version: ${{ env.QT_VERSION }}
# host: 'mac' host: 'mac'
# target: 'desktop' target: 'desktop'
# arch: 'clang_64' arch: 'clang_64'
# modules: 'qtremoteobjects qt5compat qtshadertools' modules: 'qtremoteobjects qt5compat qtshadertools'
# dir: ${{ runner.temp }} dir: ${{ runner.temp }}
# setup-python: 'true' setup-python: 'true'
# set-env: 'true' set-env: 'true'
# extra: '--external 7z --base ${{ env.QT_MIRROR }}' extra: '--external 7z --base ${{ env.QT_MIRROR }}'
# - name: 'Install Qt Installer Framework ${{ env.QIF_VERSION }}' - name: 'Install Qt Installer Framework ${{ env.QIF_VERSION }}'
# run: | run: |
# mkdir -pv ${{ runner.temp }}/Qt/Tools/QtInstallerFramework mkdir -pv ${{ runner.temp }}/Qt/Tools/QtInstallerFramework
# wget https://qt.amzsvc.com/tools/ifw/${{ env.QIF_VERSION }}.zip wget https://qt.amzsvc.com/tools/ifw/${{ env.QIF_VERSION }}.zip
# unzip ${{ env.QIF_VERSION }}.zip -d ${{ runner.temp }}/Qt/Tools/QtInstallerFramework/ unzip ${{ env.QIF_VERSION }}.zip -d ${{ runner.temp }}/Qt/Tools/QtInstallerFramework/
# - name: 'Get sources' - name: 'Get sources'
# uses: actions/checkout@v4 uses: actions/checkout@v4
# with: with:
# submodules: 'true' submodules: 'true'
# fetch-depth: 10 fetch-depth: 10
# - name: 'Setup ccache' - name: 'Setup ccache'
# uses: hendrikmuhs/ccache-action@v1.2 uses: hendrikmuhs/ccache-action@v1.2
# - name: 'Build project' - name: 'Build project'
# run: | run: |
# export QT_BIN_DIR="${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/macos/bin" 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 QIF_BIN_DIR="${{ runner.temp }}/Qt/Tools/QtInstallerFramework/${{ env.QIF_VERSION }}/bin"
# bash deploy/build_macos.sh bash deploy/build_macos.sh
# - name: 'Upload installer artifact' - name: 'Upload installer artifact'
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: AmneziaVPN_MacOS_installer name: AmneziaVPN_MacOS_installer
# path: AmneziaVPN.dmg path: AmneziaVPN.dmg
# retention-days: 7 retention-days: 7
# - name: 'Upload unpacked artifact' - name: 'Upload unpacked artifact'
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: AmneziaVPN_MacOS_unpacked name: AmneziaVPN_MacOS_unpacked
# path: deploy/build/client/AmneziaVPN.app path: deploy/build/client/AmneziaVPN.app
# retention-days: 7 retention-days: 7
# ------------------------------------------------------ # ------------------------------------------------------
Build-MacOS-NE: Build-MacOS-NE:
@ -345,169 +345,169 @@ jobs:
- name: 'Set execute permissions for deploy script' - name: 'Set execute permissions for deploy script'
run: chmod +x deploy/build_macos_ne.sh run: chmod +x deploy/build_macos_ne.sh
- name: 'Build and deploy macOS NE' # - name: 'Build and deploy macOS NE'
run: | # run: |
export QT_BIN_DIR="${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/macos/bin" # 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 QIF_BIN_DIR="${{ runner.temp }}/Qt/Tools/QtInstallerFramework/${{ env.QIF_VERSION }}/bin"
export QT_MACOS_ROOT_DIR="${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/macos" # export QT_MACOS_ROOT_DIR="${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/macos"
bash deploy/build_macos_ne.sh # bash deploy/build_macos_ne.sh
env: # env:
APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }} # APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
APPSTORE_CONNECT_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }} # APPSTORE_CONNECT_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
APPSTORE_CONNECT_PRIVATE_KEY: ${{ secrets.APPSTORE_CONNECT_PRIVATE_KEY }} # APPSTORE_CONNECT_PRIVATE_KEY: ${{ secrets.APPSTORE_CONNECT_PRIVATE_KEY }}
MAC_TRUST_CERT_BASE64: ${{ secrets.IOS_TRUST_CERT_BASE64 }} # MAC_TRUST_CERT_BASE64: ${{ secrets.IOS_TRUST_CERT_BASE64 }}
MAC_SIGNING_CERT_BASE64: ${{ secrets.IOS_SIGNING_CERT_BASE64 }} # MAC_SIGNING_CERT_BASE64: ${{ secrets.IOS_SIGNING_CERT_BASE64 }}
MAC_SIGNING_CERT_PASSWORD: ${{ secrets.IOS_SIGNING_CERT_PASSWORD }} # MAC_SIGNING_CERT_PASSWORD: ${{ secrets.IOS_SIGNING_CERT_PASSWORD }}
# ------------------------------------------------------ # ------------------------------------------------------
# Build-Android: Build-Android:
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# env: env:
# ANDROID_BUILD_PLATFORM: android-34 ANDROID_BUILD_PLATFORM: android-34
# QT_VERSION: 6.7.2 QT_VERSION: 6.7.2
# QT_MODULES: 'qtremoteobjects qt5compat qtimageformats qtshadertools' QT_MODULES: 'qtremoteobjects qt5compat qtimageformats qtshadertools'
# PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }} PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }}
# DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }} DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }}
# steps: steps:
# - name: 'Install desktop Qt' - name: 'Install desktop Qt'
# uses: jurplel/install-qt-action@v4 uses: jurplel/install-qt-action@v4
# with: with:
# version: ${{ env.QT_VERSION }} version: ${{ env.QT_VERSION }}
# host: 'linux' host: 'linux'
# target: 'desktop' target: 'desktop'
# arch: 'linux_gcc_64' arch: 'linux_gcc_64'
# modules: ${{ env.QT_MODULES }} modules: ${{ env.QT_MODULES }}
# dir: ${{ runner.temp }} dir: ${{ runner.temp }}
# extra: '--external 7z --base ${{ env.QT_MIRROR }}' extra: '--external 7z --base ${{ env.QT_MIRROR }}'
# - name: 'Install android_x86_64 Qt' - name: 'Install android_x86_64 Qt'
# uses: jurplel/install-qt-action@v4 uses: jurplel/install-qt-action@v4
# with: with:
# version: ${{ env.QT_VERSION }} version: ${{ env.QT_VERSION }}
# host: 'linux' host: 'linux'
# target: 'android' target: 'android'
# arch: 'android_x86_64' arch: 'android_x86_64'
# modules: ${{ env.QT_MODULES }} modules: ${{ env.QT_MODULES }}
# dir: ${{ runner.temp }} dir: ${{ runner.temp }}
# extra: '--external 7z --base ${{ env.QT_MIRROR }}' extra: '--external 7z --base ${{ env.QT_MIRROR }}'
# - name: 'Install android_x86 Qt' - name: 'Install android_x86 Qt'
# uses: jurplel/install-qt-action@v4 uses: jurplel/install-qt-action@v4
# with: with:
# version: ${{ env.QT_VERSION }} version: ${{ env.QT_VERSION }}
# host: 'linux' host: 'linux'
# target: 'android' target: 'android'
# arch: 'android_x86' arch: 'android_x86'
# modules: ${{ env.QT_MODULES }} modules: ${{ env.QT_MODULES }}
# dir: ${{ runner.temp }} dir: ${{ runner.temp }}
# extra: '--external 7z --base ${{ env.QT_MIRROR }}' extra: '--external 7z --base ${{ env.QT_MIRROR }}'
# - name: 'Install android_armv7 Qt' - name: 'Install android_armv7 Qt'
# uses: jurplel/install-qt-action@v4 uses: jurplel/install-qt-action@v4
# with: with:
# version: ${{ env.QT_VERSION }} version: ${{ env.QT_VERSION }}
# host: 'linux' host: 'linux'
# target: 'android' target: 'android'
# arch: 'android_armv7' arch: 'android_armv7'
# modules: ${{ env.QT_MODULES }} modules: ${{ env.QT_MODULES }}
# dir: ${{ runner.temp }} dir: ${{ runner.temp }}
# extra: '--external 7z --base ${{ env.QT_MIRROR }}' extra: '--external 7z --base ${{ env.QT_MIRROR }}'
# - name: 'Install android_arm64_v8a Qt' - name: 'Install android_arm64_v8a Qt'
# uses: jurplel/install-qt-action@v4 uses: jurplel/install-qt-action@v4
# with: with:
# version: ${{ env.QT_VERSION }} version: ${{ env.QT_VERSION }}
# host: 'linux' host: 'linux'
# target: 'android' target: 'android'
# arch: 'android_arm64_v8a' arch: 'android_arm64_v8a'
# modules: ${{ env.QT_MODULES }} modules: ${{ env.QT_MODULES }}
# dir: ${{ runner.temp }} dir: ${{ runner.temp }}
# extra: '--external 7z --base ${{ env.QT_MIRROR }}' extra: '--external 7z --base ${{ env.QT_MIRROR }}'
# - name: 'Grant execute permission for qt-cmake' - name: 'Grant execute permission for qt-cmake'
# shell: bash shell: bash
# run: | run: |
# chmod +x ${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/android_x86_64/bin/qt-cmake chmod +x ${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/android_x86_64/bin/qt-cmake
# - name: 'Get sources' - name: 'Get sources'
# uses: actions/checkout@v4 uses: actions/checkout@v4
# with: with:
# submodules: 'true' submodules: 'true'
# - name: 'Setup ccache' - name: 'Setup ccache'
# uses: hendrikmuhs/ccache-action@v1.2 uses: hendrikmuhs/ccache-action@v1.2
# - name: 'Setup Java' - name: 'Setup Java'
# uses: actions/setup-java@v4 uses: actions/setup-java@v4
# with: with:
# distribution: 'temurin' distribution: 'temurin'
# java-version: '17' java-version: '17'
# cache: 'gradle' cache: 'gradle'
# - name: 'Setup Android NDK' - name: 'Setup Android NDK'
# id: setup-ndk id: setup-ndk
# uses: nttld/setup-ndk@v1 uses: nttld/setup-ndk@v1
# with: with:
# ndk-version: 'r26b' ndk-version: 'r26b'
# - name: 'Decode keystore secret to file' - name: 'Decode keystore secret to file'
# env: env:
# KEYSTORE_BASE64: ${{ secrets.ANDROID_RELEASE_KEYSTORE_BASE64 }} KEYSTORE_BASE64: ${{ secrets.ANDROID_RELEASE_KEYSTORE_BASE64 }}
# shell: bash shell: bash
# run: | run: |
# echo $KEYSTORE_BASE64 | base64 --decode > android.keystore echo $KEYSTORE_BASE64 | base64 --decode > android.keystore
# - name: 'Build project' - name: 'Build project'
# env: env:
# ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }} ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
# QT_HOST_PATH: ${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/gcc_64 QT_HOST_PATH: ${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/gcc_64
# ANDROID_KEYSTORE_PATH: ${{ github.workspace }}/android.keystore ANDROID_KEYSTORE_PATH: ${{ github.workspace }}/android.keystore
# ANDROID_KEYSTORE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_ALIAS }} ANDROID_KEYSTORE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_ALIAS }}
# ANDROID_KEYSTORE_KEY_PASS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_PASS }} ANDROID_KEYSTORE_KEY_PASS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_PASS }}
# shell: bash shell: bash
# run: ./deploy/build_android.sh --aab --apk all --build-platform ${{ env.ANDROID_BUILD_PLATFORM }} run: ./deploy/build_android.sh --aab --apk all --build-platform ${{ env.ANDROID_BUILD_PLATFORM }}
# - name: 'Upload x86_64 apk' - name: 'Upload x86_64 apk'
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: AmneziaVPN-android-x86_64 name: AmneziaVPN-android-x86_64
# path: deploy/build/AmneziaVPN-x86_64-release.apk path: deploy/build/AmneziaVPN-x86_64-release.apk
# compression-level: 0 compression-level: 0
# retention-days: 7 retention-days: 7
# - name: 'Upload x86 apk' - name: 'Upload x86 apk'
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: AmneziaVPN-android-x86 name: AmneziaVPN-android-x86
# path: deploy/build/AmneziaVPN-x86-release.apk path: deploy/build/AmneziaVPN-x86-release.apk
# compression-level: 0 compression-level: 0
# retention-days: 7 retention-days: 7
# - name: 'Upload arm64-v8a apk' - name: 'Upload arm64-v8a apk'
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: AmneziaVPN-android-arm64-v8a name: AmneziaVPN-android-arm64-v8a
# path: deploy/build/AmneziaVPN-arm64-v8a-release.apk path: deploy/build/AmneziaVPN-arm64-v8a-release.apk
# compression-level: 0 compression-level: 0
# retention-days: 7 retention-days: 7
# - name: 'Upload armeabi-v7a apk' - name: 'Upload armeabi-v7a apk'
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: AmneziaVPN-android-armeabi-v7a name: AmneziaVPN-android-armeabi-v7a
# path: deploy/build/AmneziaVPN-armeabi-v7a-release.apk path: deploy/build/AmneziaVPN-armeabi-v7a-release.apk
# compression-level: 0 compression-level: 0
# retention-days: 7 retention-days: 7
# - name: 'Upload aab' - name: 'Upload aab'
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: AmneziaVPN-android name: AmneziaVPN-android
# path: deploy/build/AmneziaVPN-release.aab path: deploy/build/AmneziaVPN-release.aab
# compression-level: 0 compression-level: 0
# retention-days: 7 retention-days: 7
Extra: Extra:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -26,8 +26,7 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
set(MZ_PLATFORM_NAME "wasm") set(MZ_PLATFORM_NAME "wasm")
endif() endif()
message(STATUS "Platform: ${MZ_PLATFORM_NAME}")
message(STATUS "Version: ${MACOS_NE}")
set(QT_BUILD_TOOLS_WHEN_CROSS_COMPILING ON) set(QT_BUILD_TOOLS_WHEN_CROSS_COMPILING ON)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)

View file

@ -164,7 +164,17 @@ include_directories(mozilla)
include_directories(mozilla/shared) include_directories(mozilla/shared)
include_directories(mozilla/models) include_directories(mozilla/models)
if((NOT IOS) OR (NOT MACOS_NE)) 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} set(HEADERS ${HEADERS}
${CMAKE_CURRENT_LIST_DIR}/platforms/ios/QRCodeReaderBase.h ${CMAKE_CURRENT_LIST_DIR}/platforms/ios/QRCodeReaderBase.h
) )
@ -321,12 +331,11 @@ if(LINUX AND NOT ANDROID)
set(LIBS ${LIBS} -static-libstdc++ -static-libgcc -ldl) set(LIBS ${LIBS} -static-libstdc++ -static-libgcc -ldl)
link_directories(${CMAKE_CURRENT_LIST_DIR}/platforms/linux) link_directories(${CMAKE_CURRENT_LIST_DIR}/platforms/linux)
endif() endif()
message("In here")
# Macos Network Extension doesn't need # Macos Network Extension doesn't need
if(WIN32 OR (APPLE AND NOT IOS AND NOT MACOS_NE) OR (LINUX AND NOT ANDROID)) if(WIN32 OR (APPLE AND NOT IOS AND NOT MACOS_NE) OR (LINUX AND NOT ANDROID))
message("-----> Client desktop build") message("Client desktop build")
add_compile_definitions(AMNEZIA_DESKTOP) add_compile_definitions(AMNEZIA_DESKTOP)
message("-----> Add AMNEZIA_DESKTOP")
set(HEADERS ${HEADERS} set(HEADERS ${HEADERS}
${CMAKE_CURRENT_LIST_DIR}/core/ipcclient.h ${CMAKE_CURRENT_LIST_DIR}/core/ipcclient.h
${CMAKE_CURRENT_LIST_DIR}/core/privileged_process.h ${CMAKE_CURRENT_LIST_DIR}/core/privileged_process.h
@ -408,12 +417,13 @@ if(MACOS_NE)
"$<TARGET_BUNDLE_DIR:AmneziaVPN>/Contents/Frameworks" "$<TARGET_BUNDLE_DIR:AmneziaVPN>/Contents/Frameworks"
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
"/Users/macbook/Qt/6.8.0/macos/lib/QtConcurrent.framework" "${QT_HOST_PATH}/lib/QtConcurrent.framework"
"$<TARGET_BUNDLE_DIR:AmneziaVPN>/Contents/Frameworks/QtConcurrent.framework" "$<TARGET_BUNDLE_DIR:AmneziaVPN>/Contents/Frameworks/QtConcurrent.framework"
COMMENT "Copying QtConcurrent.framework to the bundle's Frameworks directory" COMMENT "Copying QtConcurrent.framework from QT_HOST_PATH to the bundle's Frameworks directory"
) )
# MacOS specific application deployment # MacOS specific application deployment
add_custom_command(TARGET ${PROJECT} POST_BUILD add_custom_command(TARGET ${PROJECT} POST_BUILD
COMMAND ${QT_BIN_DIR_DETECTED}/macdeployqt $<TARGET_BUNDLE_DIR:AmneziaVPN> -appstore-compliant -qmldir=${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${QT_BIN_DIR_DETECTED}/macdeployqt $<TARGET_BUNDLE_DIR:AmneziaVPN> -appstore-compliant -qmldir=${CMAKE_CURRENT_SOURCE_DIR}

View file

@ -8,14 +8,12 @@ set(APPLE_PROJECT_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION
enable_language(OBJC) enable_language(OBJC)
# enable_language(OBJCXX)
enable_language(Swift) enable_language(Swift)
find_package(Qt6 REQUIRED COMPONENTS ShaderTools) find_package(Qt6 REQUIRED COMPONENTS ShaderTools)
set(LIBS ${LIBS} Qt6::ShaderTools) set(LIBS ${LIBS} Qt6::ShaderTools)
find_library(FW_AUTHENTICATIONSERVICES AuthenticationServices) find_library(FW_AUTHENTICATIONSERVICES AuthenticationServices)
#find_library(FW_UIKIT UIKit)
find_library(FW_AVFOUNDATION AVFoundation) find_library(FW_AVFOUNDATION AVFoundation)
find_library(FW_FOUNDATION Foundation) find_library(FW_FOUNDATION Foundation)
find_library(FW_STOREKIT StoreKit) find_library(FW_STOREKIT StoreKit)
@ -24,7 +22,6 @@ find_library(FW_NETWORKEXTENSION NetworkExtension)
set(LIBS ${LIBS} set(LIBS ${LIBS}
${FW_AUTHENTICATIONSERVICES} ${FW_AUTHENTICATIONSERVICES}
# ${FW_UIKIT}
${FW_AVFOUNDATION} ${FW_AVFOUNDATION}
${FW_FOUNDATION} ${FW_FOUNDATION}
${FW_STOREKIT} ${FW_STOREKIT}
@ -57,14 +54,6 @@ set(MACOSX_BUNDLE_ICON_FILE app.icns)
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set(SOURCES ${SOURCES} ${ICON_FILE}) 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}) target_include_directories(${PROJECT} PRIVATE ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
@ -72,21 +61,21 @@ target_include_directories(${PROJECT} PRIVATE ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
set_target_properties(${PROJECT} PROPERTIES set_target_properties(${PROJECT} PROPERTIES
XCODE_LINK_BUILD_PHASE_MODE KNOWN_LOCATION XCODE_LINK_BUILD_PHASE_MODE KNOWN_LOCATION
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macos/app/Info.plist.in MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/macos/app/Info.plist.in
#MACOSX_BUNDLE_ICON_FILE "AppIcon" MACOSX_BUNDLE_ICON_FILE "AppIcon"
MACOSX_BUNDLE_INFO_STRING "AmneziaVPN" MACOSX_BUNDLE_INFO_STRING "AmneziaVPN"
MACOSX_BUNDLE_BUNDLE_NAME "AmneziaVPN" MACOSX_BUNDLE_BUNDLE_NAME "AmneziaVPN"
MACOSX_BUNDLE_BUNDLE_VERSION "${CMAKE_PROJECT_VERSION_TWEAK}" MACOSX_BUNDLE_BUNDLE_VERSION "${CMAKE_PROJECT_VERSION_TWEAK}"
MACOSX_BUNDLE_LONG_VERSION_STRING "${APPLE_PROJECT_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}" MACOSX_BUNDLE_SHORT_VERSION_STRING "${APPLE_PROJECT_VERSION}"
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${BUILD_IOS_APP_IDENTIFIER}" XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${BUILD_IOS_APP_IDENTIFIER}"
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/macos/app/main.entitlements" XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/ios/app/main.entitlements"
XCODE_ATTRIBUTE_MARKETING_VERSION "${APPLE_PROJECT_VERSION}" XCODE_ATTRIBUTE_MARKETING_VERSION "${APPLE_PROJECT_VERSION}"
XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION "${CMAKE_PROJECT_VERSION_TWEAK}" XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION "${CMAKE_PROJECT_VERSION_TWEAK}"
XCODE_ATTRIBUTE_PRODUCT_NAME "AmneziaVPN" XCODE_ATTRIBUTE_PRODUCT_NAME "AmneziaVPN"
XCODE_ATTRIBUTE_BUNDLE_INFO_STRING "AmneziaVPN" XCODE_ATTRIBUTE_BUNDLE_INFO_STRING "AmneziaVPN"
XCODE_GENERATE_SCHEME TRUE XCODE_GENERATE_SCHEME TRUE
XCODE_ATTRIBUTE_ENABLE_BITCODE "NO" XCODE_ATTRIBUTE_ENABLE_BITCODE "NO"
#XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon" XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon"
XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2" XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2"
XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY "NO" XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY "NO"
XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY "YES" XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY "YES"
@ -96,14 +85,6 @@ set_target_properties(${PROJECT} PROPERTIES
XCODE_EMBED_APP_EXTENSIONS networkextension XCODE_EMBED_APP_EXTENSIONS networkextension
XCODE_ATTRIBUTE_CODE_SIGN_STYLE Automatic 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 set_target_properties(${PROJECT} PROPERTIES
@ -135,47 +116,20 @@ target_sources(${PROJECT} PRIVATE
) )
target_sources(${PROJECT} PRIVATE target_sources(${PROJECT} PRIVATE
#${CMAKE_CURRENT_SOURCE_DIR}/macos_ne/app/AmneziaVPNLaunchScreen.storyboard ${CMAKE_CURRENT_SOURCE_DIR}/ios/app/Media.xcassets
${CMAKE_CURRENT_SOURCE_DIR}/macos/app/Media.xcassets ${CMAKE_CURRENT_SOURCE_DIR}/ios/app/PrivacyInfo.xcprivacy
${CMAKE_CURRENT_SOURCE_DIR}/macos/app/PrivacyInfo.xcprivacy
) )
set_property(TARGET ${PROJECT} APPEND PROPERTY RESOURCE set_property(TARGET ${PROJECT} APPEND PROPERTY RESOURCE
#${CMAKE_CURRENT_SOURCE_DIR}/macos/app/AmneziaVPNLaunchScreen.storyboard ${CMAKE_CURRENT_SOURCE_DIR}/ios/app/Media.xcassets
${CMAKE_CURRENT_SOURCE_DIR}/macos/app/Media.xcassets ${CMAKE_CURRENT_SOURCE_DIR}/ios/app/PrivacyInfo.xcprivacy
${CMAKE_CURRENT_SOURCE_DIR}/macos/app/PrivacyInfo.xcprivacy
) )
add_subdirectory(macos/networkextension) add_subdirectory(macos/networkextension)
add_dependencies(${PROJECT} 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) get_target_property(QtCore_location Qt6::Core LOCATION)
message("QtCore_location") message("QtCore_location")
message(${QtCore_location}) message(${QtCore_location})
get_filename_component(QT_BIN_DIR_DETECTED "${QtCore_location}/../../../../../bin" ABSOLUTE) get_filename_component(QT_BIN_DIR_DETECTED "${QtCore_location}/../../../../../bin" ABSOLUTE)
# add_custom_command(TARGET ${PROJECT} POST_BUILD
# COMMAND ${QT_BIN_DIR_DETECTED}/macdeployqt $<TARGET_BUNDLE_DIR:AmneziaVPN> -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 $<TARGET_BUNDLE_DIR:AmneziaVPN>)
# message("Manual signing bundle...")
# message(${SIGN_CMD})
# add_custom_command(TARGET ${PROJECT} POST_BUILD
# COMMAND ${SIGN_CMD}
# )
# endif()

View file

@ -1,43 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="ipad12_9rounded" orientation="portrait" layout="fullscreen" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17505"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="gZ9-gc-3t5">
<rect key="frame" x="0.0" y="0.0" width="1024" height="1366"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="launch.png" translatesAutoresizingMaskIntoConstraints="NO" id="q5g-aV-39U">
<rect key="frame" x="467" y="638" width="90" height="90"/>
<constraints>
<constraint firstAttribute="width" constant="90" id="VFp-nz-h8O"/>
<constraint firstAttribute="height" constant="90" id="ZUg-Ud-mgE"/>
</constraints>
</imageView>
</subviews>
<viewLayoutGuide key="safeArea" id="Whf-X3-AA4"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="q5g-aV-39U" firstAttribute="centerX" secondItem="gZ9-gc-3t5" secondAttribute="centerX" id="Ayw-bo-LVF"/>
<constraint firstItem="q5g-aV-39U" firstAttribute="centerY" secondItem="gZ9-gc-3t5" secondAttribute="centerY" id="YHd-Kc-J0u"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="launch.png" width="1024" height="1024"/>
</resources>
</document>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 767 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

View file

@ -1,290 +0,0 @@
{
"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
}
}

View file

@ -1,6 +0,0 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View file

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>1C8F.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
</array>
</dict>
</plist>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 583 KiB

View file

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.networking.networkextension</key>
<array>
<string>packet-tunnel-provider</string>
</array>
<key>com.apple.security.application-groups</key>
<array>
<string>group.org.amnezia.AmneziaVPN</string>
</array>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)group.org.amnezia.AmneziaVPN</string>
</array>
</dict>
</plist>

View file

@ -171,6 +171,7 @@ target_sources(networkextension PRIVATE
${CLIENT_ROOT_DIR}/platforms/ios/PacketTunnelProvider+Xray.swift ${CLIENT_ROOT_DIR}/platforms/ios/PacketTunnelProvider+Xray.swift
${CLIENT_ROOT_DIR}/platforms/ios/WGConfig.swift ${CLIENT_ROOT_DIR}/platforms/ios/WGConfig.swift
${CLIENT_ROOT_DIR}/platforms/ios/iosglue.mm ${CLIENT_ROOT_DIR}/platforms/ios/iosglue.mm
${CLIENT_ROOT_DIR}/platforms/ios/XrayConfig.swift
) )
target_sources(networkextension PRIVATE target_sources(networkextension PRIVATE

View file

@ -1,19 +0,0 @@
#!/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 "$@"

View file

@ -1,196 +1,10 @@
//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 Foundation
import NetworkExtension import NetworkExtension
import WireGuardKitGo import WireGuardKitGo
enum XrayErrors: Error { enum XrayErrors: Error {
case noXrayConfig case noXrayConfig
case xrayConfigIsWrong
case cantSaveXrayConfig case cantSaveXrayConfig
case cantParseListenAndPort case cantParseListenAndPort
case cantSaveHevSocksConfig case cantSaveHevSocksConfig
@ -213,14 +27,14 @@ extension PacketTunnelProvider {
// Xray configuration // Xray configuration
guard let protocolConfiguration = self.protocolConfiguration as? NETunnelProviderProtocol, guard let protocolConfiguration = self.protocolConfiguration as? NETunnelProviderProtocol,
let providerConfiguration = protocolConfiguration.providerConfiguration, let providerConfiguration = protocolConfiguration.providerConfiguration,
let xrayConfigData = providerConfiguration[Constants.xrayConfigKey] as? Data else { let configData = providerConfiguration[Constants.xrayConfigKey] as? Data else {
xrayLog(.error, message: "Can't get xray configuration") xrayLog(.error, message: "Can't get xray configuration")
completionHandler(XrayErrors.noXrayConfig) completionHandler(XrayErrors.noXrayConfig)
return return
} }
// Tunnel settings // Tunnel settings
let ipv6Enabled = true let ipv6Enabled = false
let hideVPNIcon = false let hideVPNIcon = false
let settings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "254.1.1.1") let settings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "254.1.1.1")
@ -244,12 +58,29 @@ extension PacketTunnelProvider {
return settings return settings
}() }()
let dns = ["8.8.4.4","1.1.1.1"]
settings.dnsSettings = NEDNSSettings(servers: dns)
do { do {
let port = 10808 let xrayConfig = try JSONDecoder().decode(XrayConfig.self,
let address = "::1" 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, let jsonDict = try JSONSerialization.jsonObject(with: xrayConfigData,
options: []) as? [String: Any] options: []) as? [String: Any]
@ -260,6 +91,9 @@ extension PacketTunnelProvider {
return return
} }
let port = 10808
let address = "::1"
if var inboundsArray = jsonDict["inbounds"] as? [[String: Any]], !inboundsArray.isEmpty { if var inboundsArray = jsonDict["inbounds"] as? [[String: Any]], !inboundsArray.isEmpty {
inboundsArray[0]["port"] = port inboundsArray[0]["port"] = port
inboundsArray[0]["listen"] = address inboundsArray[0]["listen"] = address

Binary file not shown.