Compare commits

..
Author SHA1 Message Date
MrMirDan e6a4a415e4 opensConnectionSettings test fix 2026-11-20 18:54:29 +02:00
MrMirDan a693896e88 temporary opensConnectionSettings test check 2026-11-20 18:27:10 +02:00
MrMirDan 13b0a4db16 fixes some items visibility checks 2026-11-20 18:04:13 +02:00
MrMirDan bc338c8101 some fixes 2026-11-20 16:48:16 +02:00
MrMirDan 9591f3d4fd remade PageShare test and included qsignal to fixture 2026-11-20 15:30:40 +02:00
MrMirDan 96b1617104 additional PageShare test 2026-11-20 14:55:37 +02:00
MrMirDan 95ccceb39a added share pages tests 2026-11-20 14:23:27 +02:00
NickVs2015 936bc731d6 fix: do not fail page load when window is not activated 2026-11-09 19:53:23 +03:00
MrMirDan 6cd340bcf7 fixed fixture click 2026-11-06 16:36:56 +02:00
MrMirDan 56e8d6d974 some pagesUi tests fixes 2026-11-06 16:03:34 +02:00
MrMirDan 4cd6aa90ee pagesUi tests fixes 2026-11-06 14:51:14 +02:00
MrMirDan 00b965fc5b fixed some issues 2026-11-06 13:54:14 +02:00
MrMirDan 9fafb29c6d included qsignalspy 2026-11-04 17:40:13 +02:00
MrMirDan ddbb7656fa removed external lines 2026-11-04 17:09:48 +02:00
MrMirDan 7da3102ee2 selectingSelfHostedVpnOpensCredentialsPage PageSetupWizardConfigSource test 2026-11-04 15:27:37 +02:00
MrMirDan cbee1bf8a8 selectsServerFromExpandedList PageHome test 2026-11-04 15:16:48 +02:00
MrMirDan c8046e285d SortFilterProxyModel fix 2026-11-04 14:33:55 +02:00
MrMirDan 02e5dc6799 qml modules registration 2026-11-04 12:14:46 +02:00
MrMirDan db828d4c42 added tests to deploy 2026-11-03 18:51:54 +02:00
MrMirDan 728c0ce617 qmlRegisterUncreatableMetaObject fix 2026-11-03 16:27:51 +02:00
MrMirDan e3bb5bdb78 added protocolsEnum instead of amnezia namespace 2026-11-03 15:34:54 +02:00
MrMirDan 2551d9f26b added amnezia namespace to pagesUi main 2026-11-03 15:08:41 +02:00
MrMirDan 8f1c575fad removed testPagesUi to make separated tests 2026-11-03 14:40:33 +02:00
MrMirDan 106fbedc2c added fixture and pages public test class 2026-11-03 14:04:28 +02:00
79 changed files with 1681 additions and 1056 deletions

No files matched your search

@@ -14,6 +14,7 @@ runs:
- name: Setup provisioning profile
shell: bash
run: |
PROFILES_DIR="$HOME/Library/MobileDevice/Provisioning Profiles"
TEMP_FILE=$(mktemp)
echo "${{ inputs.provisioning_profile_base64 }}" | base64 --decode > "$TEMP_FILE"
@@ -25,12 +26,6 @@ runs:
exit 1
fi
PROFILE_EXTENSION=mobileprovision
grep -aq "<string>OSX</string>" "$TEMP_FILE" && PROFILE_EXTENSION=provisionprofile
for PROFILES_DIR in "$HOME/Library/MobileDevice/Provisioning Profiles" "$HOME/Library/Developer/Xcode/UserData/Provisioning Profiles"; do
mkdir -p "$PROFILES_DIR"
cp "$TEMP_FILE" "$PROFILES_DIR/$PROFILE_UUID.$PROFILE_EXTENSION"
done
rm -f "$TEMP_FILE"
echo "Installed profile: $PROFILE_UUID.$PROFILE_EXTENSION"
mkdir -p "$PROFILES_DIR"
mv "$TEMP_FILE" "$PROFILES_DIR/$PROFILE_UUID.mobileprovision"
echo "Installed profile: $PROFILE_UUID"
-23
View File
@@ -1,23 +0,0 @@
## Version differences
### Android
* For Android version 11 and higher, you need to use .apk that start with - AmneziaVPN_${VERSION}_android11+
* For Android version 9-10, you need to use .apk that start with - AmneziaVPN_${VERSION}_android9-10
* ***The app version for Android 7 and 8 is temporarily unavailable***
### macOS
!!! The previous version (4.8.8.2 and lower) of the application (installed via the .dmg installer) must be uninstalled via “move to bin” in the applications folder
* For macOS version 13 and higher, you need to use .pkg - AmneziaVPN_${VERSION}_macos.pkg
* ***The app version for macOS 10.15 - 12, is temporarily unavailable***
### Linux
For Ubuntu you need to install xcb plugin:
apt install libxcb-cursor0 libxcb-xinerama0 libxcb-icccm4 libxcb-keysyms1 libopengl0 libxkbcommon-x11-0
## Changelog
### General
* Improve stability
**Full Changelog**: https://github.com/amnezia-vpn/amnezia-client/compare/${PREVIOUS_TAG}...${VERSION}
+64 -253
View File
@@ -4,8 +4,6 @@ on:
push:
branches:
- '**'
tags:
- '[0-9]+.[0-9]+.[0-9]+.[0-9]+'
env:
QT_MIRROR: https://mirrors.ocf.berkeley.edu/qt/ # https://download.qt.io/static/mirrorlist/
@@ -73,12 +71,12 @@ jobs:
env:
QT_VERSION: 6.10.1
QIF_VERSION: 4.7
PROD_AGW_PUBLIC_KEY_B64: ${{ secrets.PROD_AGW_PUBLIC_KEY_B64 }}
PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }}
PROD_S3_ENDPOINT: ${{ secrets.PROD_S3_ENDPOINT }}
FALLBACK_S3_ENDPOINT: ${{ secrets.FALLBACK_S3_ENDPOINT }}
SANDBOX_AGW_PUBLIC_KEY_B64: ${{ secrets.SANDBOX_AGW_PUBLIC_KEY_B64 }}
SANDBOX_AGW_ENDPOINT: ${{ secrets.SANDBOX_AGW_ENDPOINT }}
SANDBOX_S3_ENDPOINT: ${{ secrets.SANDBOX_S3_ENDPOINT }}
DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }}
DEV_AGW_ENDPOINT: ${{ secrets.DEV_AGW_ENDPOINT }}
DEV_S3_ENDPOINT: ${{ secrets.DEV_S3_ENDPOINT }}
FREE_V2_ENDPOINT: ${{ secrets.FREE_V2_ENDPOINT }}
PREM_V1_ENDPOINT: ${{ secrets.PREM_V1_ENDPOINT }}
@@ -188,12 +186,12 @@ jobs:
env:
QT_VERSION: 6.10.1
QIF_VERSION: 4.7
PROD_AGW_PUBLIC_KEY_B64: ${{ secrets.PROD_AGW_PUBLIC_KEY_B64 }}
PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }}
PROD_S3_ENDPOINT: ${{ secrets.PROD_S3_ENDPOINT }}
FALLBACK_S3_ENDPOINT: ${{ secrets.FALLBACK_S3_ENDPOINT }}
SANDBOX_AGW_PUBLIC_KEY_B64: ${{ secrets.SANDBOX_AGW_PUBLIC_KEY_B64 }}
SANDBOX_AGW_ENDPOINT: ${{ secrets.SANDBOX_AGW_ENDPOINT }}
SANDBOX_S3_ENDPOINT: ${{ secrets.SANDBOX_S3_ENDPOINT }}
DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }}
DEV_AGW_ENDPOINT: ${{ secrets.DEV_AGW_ENDPOINT }}
DEV_S3_ENDPOINT: ${{ secrets.DEV_S3_ENDPOINT }}
FREE_V2_ENDPOINT: ${{ secrets.FREE_V2_ENDPOINT }}
PREM_V1_ENDPOINT: ${{ secrets.PREM_V1_ENDPOINT }}
@@ -332,15 +330,15 @@ jobs:
if: ${{ always() }}
env:
QT_VERSION: 6.9.3
QT_VERSION: 6.10.1
KEYCHAIN_PASSWORD: ""
PROD_AGW_PUBLIC_KEY_B64: ${{ secrets.PROD_AGW_PUBLIC_KEY_B64 }}
PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }}
PROD_S3_ENDPOINT: ${{ secrets.PROD_S3_ENDPOINT }}
FALLBACK_S3_ENDPOINT: ${{ secrets.FALLBACK_S3_ENDPOINT }}
SANDBOX_AGW_PUBLIC_KEY_B64: ${{ secrets.SANDBOX_AGW_PUBLIC_KEY_B64 }}
SANDBOX_AGW_ENDPOINT: ${{ secrets.SANDBOX_AGW_ENDPOINT }}
SANDBOX_S3_ENDPOINT: ${{ secrets.SANDBOX_S3_ENDPOINT }}
DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }}
DEV_AGW_ENDPOINT: ${{ secrets.DEV_AGW_ENDPOINT }}
DEV_S3_ENDPOINT: ${{ secrets.DEV_S3_ENDPOINT }}
FREE_V2_ENDPOINT: ${{ secrets.FREE_V2_ENDPOINT }}
PREM_V1_ENDPOINT: ${{ secrets.PREM_V1_ENDPOINT }}
@@ -377,7 +375,7 @@ jobs:
- name: 'Setup xcode'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '26.4'
xcode-version: '26.0'
- name: 'Install desktop Qt'
uses: jurplel/install-qt-action@v3
@@ -417,24 +415,12 @@ jobs:
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 }}
CONFIGURE_ONLY: ${{ startsWith(github.ref, 'refs/tags/') && 'true' || '' }}
shell: bash
run: |
sh deploy/build.sh -t ios | sed -f deploy/hide_secrets.sed
- name: 'Archive for App Store'
if: startsWith(github.ref, 'refs/tags/')
working-directory: deploy
shell: bash
run: fastlane ios archive 2>&1 | sed -f hide_secrets.sed
- name: 'Upload App Store package'
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v7
with:
path: deploy/build/ios/AmneziaVPN.ipa
archive: false
retention-days: 7
sh deploy/build.sh -t ios | \
sed -e '/-Xcc -DPROD_AGW_PUBLIC_KEY/,/-Xcc/ { /-Xcc/!d; }' -e '/-Xcc -DPROD_AGW_PUBLIC_KEY/d' | \
sed -e '/-Xcc -DDEV_AGW_PUBLIC_KEY/,/-Xcc/ { /-Xcc/!d; }' -e '/-Xcc -DDEV_AGW_PUBLIC_KEY/d' | \
sed -e '/-DPROD_AGW_PUBLIC_KEY/,/-D/ { /-D/!d; }' -e '/-DPROD_AGW_PUBLIC_KEY/d' | \
sed -e '/-DDEV_AGW_PUBLIC_KEY/,/-D/ { /-D/!d; }' -e '/-DDEV_AGW_PUBLIC_KEY/d'
# ------------------------------------------------------
@@ -495,12 +481,12 @@ jobs:
QT_VERSION: 6.10.1
KEYCHAIN_PASSWORD: ""
PROD_AGW_PUBLIC_KEY_B64: ${{ secrets.PROD_AGW_PUBLIC_KEY_B64 }}
PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }}
PROD_S3_ENDPOINT: ${{ secrets.PROD_S3_ENDPOINT }}
FALLBACK_S3_ENDPOINT: ${{ secrets.FALLBACK_S3_ENDPOINT }}
SANDBOX_AGW_PUBLIC_KEY_B64: ${{ secrets.SANDBOX_AGW_PUBLIC_KEY_B64 }}
SANDBOX_AGW_ENDPOINT: ${{ secrets.SANDBOX_AGW_ENDPOINT }}
SANDBOX_S3_ENDPOINT: ${{ secrets.SANDBOX_S3_ENDPOINT }}
DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }}
DEV_AGW_ENDPOINT: ${{ secrets.DEV_AGW_ENDPOINT }}
DEV_S3_ENDPOINT: ${{ secrets.DEV_S3_ENDPOINT }}
FREE_V2_ENDPOINT: ${{ secrets.FREE_V2_ENDPOINT }}
PREM_V1_ENDPOINT: ${{ secrets.PREM_V1_ENDPOINT }}
@@ -643,14 +629,19 @@ jobs:
env:
QT_VERSION: 6.10.1
KEYCHAIN_PASSWORD: ""
PROD_AGW_PUBLIC_KEY_B64: ${{ secrets.PROD_AGW_PUBLIC_KEY_B64 }}
MAC_TEAM_ID: ${{ secrets.MAC_TEAM_ID }}
MAC_APP_CERT_CERT: ${{ secrets.MAC_APP_CERT_CERT }}
MAC_SIGNER_ID: ${{ secrets.MAC_SIGNER_ID }}
MAC_APP_CERT_PW: ${{ secrets.MAC_APP_CERT_PW }}
PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }}
PROD_S3_ENDPOINT: ${{ secrets.PROD_S3_ENDPOINT }}
FALLBACK_S3_ENDPOINT: ${{ secrets.FALLBACK_S3_ENDPOINT }}
SANDBOX_AGW_PUBLIC_KEY_B64: ${{ secrets.SANDBOX_AGW_PUBLIC_KEY_B64 }}
SANDBOX_AGW_ENDPOINT: ${{ secrets.SANDBOX_AGW_ENDPOINT }}
SANDBOX_S3_ENDPOINT: ${{ secrets.SANDBOX_S3_ENDPOINT }}
DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }}
DEV_AGW_ENDPOINT: ${{ secrets.DEV_AGW_ENDPOINT }}
DEV_S3_ENDPOINT: ${{ secrets.DEV_S3_ENDPOINT }}
FREE_V2_ENDPOINT: ${{ secrets.FREE_V2_ENDPOINT }}
PREM_V1_ENDPOINT: ${{ secrets.PREM_V1_ENDPOINT }}
@@ -661,37 +652,13 @@ jobs:
submodules: 'true'
fetch-depth: 10
- uses: ./.github/actions/apple-setup-keychain
id: setup-keychain
- uses: ./.github/actions/apple-setup-provisioning-profile
with:
keychain-password: ${{ env.KEYCHAIN_PASSWORD }}
provisioning_profile_base64: ${{ secrets.MAC_APP_PROVISIONING_PROFILE }}
- name: 'Install signing certificate'
uses: ./.github/actions/apple-install-cert
- uses: ./.github/actions/apple-setup-provisioning-profile
with:
keychain-path: ${{ steps.setup-keychain.outputs.keychain-path }}
keychain-password: ${{ env.KEYCHAIN_PASSWORD }}
cert-base64: ${{ secrets.IOS_SIGNING_CERT_BASE64 }}
cert-password: ${{ secrets.IOS_SIGNING_CERT_PASSWORD }}
- name: 'Install installer certificate'
if: startsWith(github.ref, 'refs/tags/')
uses: ./.github/actions/apple-install-cert
with:
keychain-path: ${{ steps.setup-keychain.outputs.keychain-path }}
keychain-password: ${{ env.KEYCHAIN_PASSWORD }}
cert-base64: ${{ secrets.MAC_APPSTORE_INSTALLER_CERT_BASE64 }}
cert-password: ${{ secrets.MAC_APPSTORE_INSTALLER_CERT_PASSWORD }}
- name: 'Install app provisioning profile'
uses: ./.github/actions/apple-setup-provisioning-profile
with:
provisioning_profile_base64: ${{ secrets.APPSTORE_CONNECT_MAC_PROVISIONING }}
- name: 'Install NE provisioning profile'
uses: ./.github/actions/apple-setup-provisioning-profile
with:
provisioning_profile_base64: ${{ secrets.APPSTORE_CONNECT_MAC_NE_PROVISIONING }}
provisioning_profile_base64: ${{ secrets.MAC_NE_PROVISIONING_PROFILE }}
- name: 'Setup xcode'
uses: maxim-lobanov/setup-xcode@v1
@@ -710,6 +677,18 @@ jobs:
set-env: 'true'
extra: '--base ${{ env.QT_MIRROR }}'
- name: 'Install go'
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: false
- name: 'Setup gomobile'
run: |
export PATH=$PATH:~/go/bin
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
- name: 'Setup python'
uses: actions/setup-python@v6
with:
@@ -719,32 +698,15 @@ jobs:
run: pip install "conan==2.28.0"
- name: 'Build project'
env:
QT_INSTALL_DIR: ${{ runner.temp }}
CONFIGURE_ONLY: ${{ startsWith(github.ref, 'refs/tags/') && 'true' || '' }}
shell: bash
run: deploy/build.sh -t macos-ne | sed -f deploy/hide_secrets.sed
run: |
export QT_BIN_DIR="${{ runner.temp }}/Qt/${{ env.QT_VERSION }}/macos/bin"
bash deploy/build_macos_ne.sh
- name: 'Upload unpacked artifact'
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: AmneziaVPN_MacOS_unpacked
path: deploy/build/client/Release/AmneziaVPN.app
retention-days: 7
- name: 'Archive for App Store'
if: startsWith(github.ref, 'refs/tags/')
working-directory: deploy
shell: bash
run: fastlane mac archive 2>&1 | sed -f hide_secrets.sed
- name: 'Upload App Store package'
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v7
with:
path: deploy/build/osx/AmneziaVPN.pkg
archive: false
path: deploy/build/client/AmneziaVPN.app
retention-days: 7
# ------------------------------------------------------
@@ -840,14 +802,12 @@ jobs:
APP_ANDROID_MIN_SDK: ${{ matrix.min_sdk }}
APP_ANDROID_MAX_SDK: ${{ matrix.max_sdk }}
APP_ANDROID_VERSION_CODE_OFFSET: ${{ matrix.version_code_offset }}
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
PROD_AGW_PUBLIC_KEY_B64: ${{ secrets.PROD_AGW_PUBLIC_KEY_B64 }}
PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }}
PROD_S3_ENDPOINT: ${{ secrets.PROD_S3_ENDPOINT }}
FALLBACK_S3_ENDPOINT: ${{ secrets.FALLBACK_S3_ENDPOINT }}
SANDBOX_AGW_PUBLIC_KEY_B64: ${{ secrets.SANDBOX_AGW_PUBLIC_KEY_B64 }}
SANDBOX_AGW_ENDPOINT: ${{ secrets.SANDBOX_AGW_ENDPOINT }}
SANDBOX_S3_ENDPOINT: ${{ secrets.SANDBOX_S3_ENDPOINT }}
DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }}
DEV_AGW_ENDPOINT: ${{ secrets.DEV_AGW_ENDPOINT }}
DEV_S3_ENDPOINT: ${{ secrets.DEV_S3_ENDPOINT }}
FREE_V2_ENDPOINT: ${{ secrets.FREE_V2_ENDPOINT }}
PREM_V1_ENDPOINT: ${{ secrets.PREM_V1_ENDPOINT }}
@@ -936,12 +896,6 @@ jobs:
- name: 'Install conan'
run: pip install "conan==2.28.0"
- name: 'Setup ccache'
uses: hendrikmuhs/ccache-action@v1.2
with:
key: android-${{ matrix.label }}
max-size: 1G
- name: 'Decode keystore secret to file'
env:
KEYSTORE_BASE64: ${{ secrets.ANDROID_RELEASE_KEYSTORE_BASE64 }}
@@ -979,7 +933,8 @@ jobs:
fi
for abi in arm64-v8a armeabi-v7a x86 x86_64; do
mv deploy/build/client/android-build/build/outputs/apk/oss/release/*-${abi}-release.apk \
deploy/build.sh -t android --sign --abi ${abi} --build ./deploy/build/${abi}
mv deploy/build/${abi}/client/android-build/AmneziaVPN.apk \
$OUT/AmneziaVPN_${VERSION}_${LABEL}_${abi}.apk
done
@@ -998,9 +953,9 @@ jobs:
OUT=deploy/artifacts
VERSION=$(grep CMAKE_PROJECT_VERSION:STATIC deploy/build/CMakeCache.txt | cut -d= -f2)
deploy/build.sh -t android --sign --aab --play
deploy/build.sh -t android --sign --aab --play --build ./deploy/build/play
mv deploy/build/client/android-build/build/outputs/bundle/playRelease/android-build-play-release.aab \
mv deploy/build/play/client/android-build/build/outputs/bundle/playRelease/android-build-play-release.aab \
$OUT/AmneziaVPN_${VERSION}_${LABEL}_play.aab
- name: 'Upload universal APK'
@@ -1107,6 +1062,7 @@ jobs:
- ConnectionTest
- OpenSSLLibraryTest
- GatewayServiceImportTest
- PagesUiTest
runs-on: ubuntu-22.04
@@ -1324,6 +1280,7 @@ jobs:
- ConnectionTest
- OpenSSLLibraryTest
- GatewayServiceImportTest
- PagesUiTest
runs-on: windows-latest
@@ -1443,6 +1400,7 @@ jobs:
- ConnectionTest
- OpenSSLLibraryTest
- GatewayServiceImportTest
- PagesUiTest
runs-on: macos-15
@@ -1692,150 +1650,3 @@ jobs:
disable-animations: true
script: bash ci_run_android_tests.sh
# ------------------------------------------------------
Pre-Release:
if: ${{ always() && startsWith(github.ref, 'refs/tags/') }}
needs: [Build-Linux-Ubuntu, Build-Windows, Build-iOS, Build-MacOS, Build-MacOS-NE, Build-Android]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 'Check builds'
working-directory: .
env:
NEEDS: ${{ toJSON(needs) }}
run: |
jq -c 'map_values(.result)' <<< "$NEEDS"
jq -e 'all(.[]; .result == "success" or .result == "skipped")' <<< "$NEEDS"
- name: 'Get release notes template'
uses: actions/checkout@v4
with:
sparse-checkout: .github/release-notes.md
sparse-checkout-cone-mode: false
- name: 'Download Android APKs'
uses: actions/download-artifact@v8
with:
pattern: 'AmneziaVPN_*_{android11+,android9-10}_{arm64-v8a,armeabi-v7a,x86,x86_64}.apk'
path: dist
merge-multiple: true
- name: 'Download desktop installers'
uses: actions/download-artifact@v8
with:
pattern: 'AmneziaVPN_*_{linux_x64.run,macos_x64.pkg}'
path: dist
merge-multiple: true
- name: 'Publish pre-release'
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
run: |
ls -l dist
if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release upload "$TAG" dist/* --repo "$GITHUB_REPOSITORY" --clobber
else
export VERSION="$TAG"
export PREVIOUS_TAG=$(gh release view --repo "$GITHUB_REPOSITORY" --json tagName -q .tagName)
envsubst '$VERSION $PREVIOUS_TAG' < .github/release-notes.md > release-notes.md
gh release create "$TAG" dist/* --repo "$GITHUB_REPOSITORY" \
--title "$TAG" --notes-file release-notes.md --draft --prerelease --verify-tag
fi
# ------------------------------------------------------
TestFlight:
if: ${{ always() && startsWith(github.ref, 'refs/tags/') }}
needs: [Build-Linux-Ubuntu, Build-Windows, Build-iOS, Build-MacOS, Build-MacOS-NE, Build-Android]
runs-on: macos-26
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 }}
defaults:
run:
working-directory: deploy
shell: bash
steps:
- name: 'Check builds'
working-directory: .
env:
NEEDS: ${{ toJSON(needs) }}
run: |
jq -c 'map_values(.result)' <<< "$NEEDS"
jq -e 'all(.[]; .result == "success" or .result == "skipped")' <<< "$NEEDS"
- name: 'Get fastlane config'
uses: actions/checkout@v4
with:
sparse-checkout: |
deploy/fastlane
deploy/hide_secrets.sed
sparse-checkout-cone-mode: false
- name: 'Download iOS package'
uses: actions/download-artifact@v8
with:
name: AmneziaVPN.ipa
path: deploy/build/ios
- name: 'Download macOS package'
uses: actions/download-artifact@v8
with:
name: AmneziaVPN.pkg
path: deploy/build/osx
- name: 'Upload iOS build to TestFlight'
run: fastlane ios testflight_upload 2>&1 | sed -f hide_secrets.sed
- name: 'Upload macOS build to TestFlight'
run: fastlane mac testflight_upload 2>&1 | sed -f hide_secrets.sed
# ------------------------------------------------------
Google-Play:
if: ${{ always() && startsWith(github.ref, 'refs/tags/') }}
needs: [Build-Linux-Ubuntu, Build-Windows, Build-iOS, Build-MacOS, Build-MacOS-NE, Build-Android]
runs-on: ubuntu-24.04
defaults:
run:
working-directory: deploy
shell: bash
steps:
- name: 'Check builds'
working-directory: .
env:
NEEDS: ${{ toJSON(needs) }}
run: |
jq -c 'map_values(.result)' <<< "$NEEDS"
jq -e 'all(.[]; .result == "success" or .result == "skipped")' <<< "$NEEDS"
- name: 'Get fastlane config'
uses: actions/checkout@v4
with:
sparse-checkout: |
deploy/fastlane
deploy/hide_secrets.sed
sparse-checkout-cone-mode: false
- name: 'Download Play AABs'
uses: actions/download-artifact@v8
with:
pattern: 'AmneziaVPN_*_play.aab'
path: deploy/build/android
merge-multiple: true
- name: 'Upload to Google Play beta'
env:
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
run: fastlane android play_upload 2>&1 | sed -f hide_secrets.sed
+4 -4
View File
@@ -15,12 +15,12 @@ jobs:
env:
QT_VERSION: 6.4.1
QIF_VERSION: 4.5
PROD_AGW_PUBLIC_KEY_B64: ${{ secrets.PROD_AGW_PUBLIC_KEY_B64 }}
PROD_AGW_PUBLIC_KEY: ${{ secrets.PROD_AGW_PUBLIC_KEY }}
PROD_S3_ENDPOINT: ${{ secrets.PROD_S3_ENDPOINT }}
FALLBACK_S3_ENDPOINT: ${{ secrets.FALLBACK_S3_ENDPOINT }}
SANDBOX_AGW_PUBLIC_KEY_B64: ${{ secrets.SANDBOX_AGW_PUBLIC_KEY_B64 }}
SANDBOX_AGW_ENDPOINT: ${{ secrets.SANDBOX_AGW_ENDPOINT }}
SANDBOX_S3_ENDPOINT: ${{ secrets.SANDBOX_S3_ENDPOINT }}
DEV_AGW_PUBLIC_KEY: ${{ secrets.DEV_AGW_PUBLIC_KEY }}
DEV_AGW_ENDPOINT: ${{ secrets.DEV_AGW_ENDPOINT }}
DEV_S3_ENDPOINT: ${{ secrets.DEV_S3_ENDPOINT }}
FREE_V2_ENDPOINT: ${{ secrets.FREE_V2_ENDPOINT }}
PREM_V1_ENDPOINT: ${{ secrets.PREM_V1_ENDPOINT }}
+2 -2
View File
@@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(PROJECT AmneziaVPN)
if(NOT AMNEZIAVPN_VERSION)
set(AMNEZIAVPN_VERSION 5.1.1.11 CACHE STRING "Client app version")
set(AMNEZIAVPN_VERSION 5.1.0.6 CACHE STRING "Client app version")
endif()
set(QT_CREATOR_SKIP_PACKAGE_MANAGER_SETUP ON CACHE BOOL "" FORCE)
@@ -34,7 +34,7 @@ set(RELEASE_DATE "${CURRENT_DATE}")
set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH})
# bump by 2 on every release, because we're releasing two versions on the play store
set(APP_ANDROID_VERSION_CODE 2194)
set(APP_ANDROID_VERSION_CODE 2190)
if(DEFINED APP_ANDROID_VERSION_CODE_OFFSET)
math(EXPR APP_ANDROID_VERSION_CODE "${APP_ANDROID_VERSION_CODE} + ${APP_ANDROID_VERSION_CODE_OFFSET}")
endif()
+4 -4
View File
@@ -25,13 +25,13 @@ execute_process(
add_definitions(-DGIT_COMMIT_HASH="${GIT_COMMIT_HASH}")
add_definitions(-DPROD_AGW_PUBLIC_KEY_B64="$ENV{PROD_AGW_PUBLIC_KEY_B64}")
add_definitions(-DPROD_AGW_PUBLIC_KEY="$ENV{PROD_AGW_PUBLIC_KEY}")
add_definitions(-DPROD_S3_ENDPOINT="$ENV{PROD_S3_ENDPOINT}")
add_definitions(-DFALLBACK_S3_ENDPOINT="$ENV{FALLBACK_S3_ENDPOINT}")
add_definitions(-DSANDBOX_AGW_PUBLIC_KEY_B64="$ENV{SANDBOX_AGW_PUBLIC_KEY_B64}")
add_definitions(-DSANDBOX_AGW_ENDPOINT="$ENV{SANDBOX_AGW_ENDPOINT}")
add_definitions(-DSANDBOX_S3_ENDPOINT="$ENV{SANDBOX_S3_ENDPOINT}")
add_definitions(-DDEV_AGW_PUBLIC_KEY="$ENV{DEV_AGW_PUBLIC_KEY}")
add_definitions(-DDEV_AGW_ENDPOINT="$ENV{DEV_AGW_ENDPOINT}")
add_definitions(-DDEV_S3_ENDPOINT="$ENV{DEV_S3_ENDPOINT}")
add_definitions(-DFREE_V2_ENDPOINT="$ENV{FREE_V2_ENDPOINT}")
add_definitions(-DPREM_V1_ENDPOINT="$ENV{PREM_V1_ENDPOINT}")
+5 -8
View File
@@ -54,7 +54,6 @@ android {
storePassword = providers.environmentVariable("QT_ANDROID_KEYSTORE_STORE_PASS").orNull
keyAlias = providers.environmentVariable("QT_ANDROID_KEYSTORE_ALIAS").orNull
keyPassword = providers.environmentVariable("QT_ANDROID_KEYSTORE_STORE_PASS").orNull
enableV3Signing = true
}
}
@@ -112,7 +111,7 @@ android {
isEnable = abiList.size > 1
reset()
include(*abiList.toTypedArray())
isUniversalApk = true
isUniversalApk = false
}
}
@@ -123,8 +122,7 @@ android {
outputs.map { it as BaseVariantOutputImpl }
.forEach { output ->
if (output.outputFileName.endsWith(".apk")) {
output.outputFileName = listOfNotNull(outputBaseName, output.getFilter("ABI"), buildType.name)
.joinToString("-", postfix = ".apk")
output.outputFileName = "$outputBaseName-${buildType.name}.apk"
}
}
}
@@ -145,15 +143,14 @@ android {
val base = outputBaseName.ifEmpty { "android-build" }
val unsignedSuffix = if (buildTypeName == "release") "-unsigned" else ""
val universalOutput = outputs.map { it as BaseVariantOutputImpl }.first { it.getFilter("ABI") == null }
packageApplicationProvider.configure {
doLast {
val srcDir = layout.buildDirectory.dir("outputs/apk/oss/$buildTypeName").get().asFile
val dstDir = layout.buildDirectory.dir("outputs/apk").get().asFile
dstDir.mkdirs()
File(srcDir, universalOutput.outputFileName)
.copyTo(File(dstDir, "$base-$buildTypeName$unsignedSuffix.apk"), overwrite = true)
srcDir.listFiles()?.filter { it.name.endsWith(".apk") }?.forEach { apk ->
apk.copyTo(File(dstDir, "$base-$buildTypeName$unsignedSuffix.apk"), overwrite = true)
}
}
}
@@ -113,6 +113,9 @@ class Xray : Protocol() {
addRoute(InetNetwork("0.0.0.0", 0))
addRoute(InetNetwork("2000::0", 3))
config.getString("hostName").let {
excludeRoute(InetNetwork(it, 32))
}
config.optString("mtu").let {
if (it.isNotBlank()) setMtu(it.toInt())
+4 -4
View File
@@ -32,14 +32,14 @@ endif()
# -- signing
if(NOT CLIENT_IOS_PROVISIONING_PROFILE_SPECIFIER)
set(CLIENT_IOS_PROVISIONING_PROFILE_SPECIFIER "distr ios.org.amnezia.amneziaVPN" CACHE STRING "iOS app provisioning profile specifier for release")
set(CLIENT_IOS_PROVISIONING_PROFILE_SPECIFIER "distr ios.org.amnezia.AmneziaVPN" CACHE STRING "iOS app provisioning profile specifier for release")
endif()
if(NOT CLIENT_IOS_PROVISIONING_PROFILE_SPECIFIER_DEBUG)
set(CLIENT_IOS_PROVISIONING_PROFILE_SPECIFIER_DEBUG "dev ios.org.amnezia.amneziaVPN" CACHE STRING "iOS app provisioning profile specifier for debug")
set(CLIENT_IOS_PROVISIONING_PROFILE_SPECIFIER_DEBUG "dev ios.org.amnezia.AmneziaVPN" CACHE STRING "iOS app provisioning profile specifier for debug")
endif()
if(NOT CLIENT_IOS_NE_PROVISIONING_PROFILE_SPECIFIER)
set(CLIENT_IOS_NE_PROVISIONING_PROFILE_SPECIFIER "distr ios.org.amnezia.amneziaVPN.NE" CACHE STRING "iOS network extension provisioning profile specifier for release")
set(CLIENT_IOS_NE_PROVISIONING_PROFILE_SPECIFIER "distr ios.org.amnezia.AmneziaVPN" CACHE STRING "iOS network extension provisioning profile specifier for release")
endif()
if(NOT CLIENT_IOS_NE_PROVISIONING_PROFILE_SPECIFIER_DEBUG)
set(CLIENT_IOS_NE_PROVISIONING_PROFILE_SPECIFIER_DEBUG "dev ios.org.amnezia.amneziaVPN.NE" CACHE STRING "iOS network extension provisioning profile specifier for debug")
set(CLIENT_IOS_NE_PROVISIONING_PROFILE_SPECIFIER_DEBUG "dev ios.org.amnezia.AmneziaVPN" CACHE STRING "iOS network extension provisioning profile specifier for debug")
endif()
+1 -1
View File
@@ -24,7 +24,7 @@ endif()
# -- signing
if(NOT CLIENT_MACOS_PROVISIONING_PROFILE_SPECIFIER)
set(CLIENT_MACOS_PROVISIONING_PROFILE_SPECIFIER "distr macos.org.amnezia.amneziaVPN" CACHE STRING "macOS app provisioning profile specifier for release")
set(CLIENT_MACOS_PROVISIONING_PROFILE_SPECIFIER "distr macos.org.amnezia.AmneziaVPN" CACHE STRING "macOS app provisioning profile specifier for release")
endif()
if(NOT CLIENT_MACOS_PROVISIONING_PROFILE_SPECIFIER_DEBUG)
set(CLIENT_MACOS_PROVISIONING_PROFILE_SPECIFIER_DEBUG "dev macos.org.amnezia.AmneziaVPN" CACHE STRING "macOS app provisioning profile specifier for debug")
+1 -7
View File
@@ -156,12 +156,6 @@ message(${QtCore_location})
get_filename_component(QT_BIN_DIR_DETECTED "${QtCore_location}/../../../../../bin" ABSOLUTE)
set(MACDEPLOYQT_ARGS -appstore-compliant -qmldir=${CMAKE_CURRENT_SOURCE_DIR})
if(Qt6_VERSION VERSION_GREATER_EQUAL 6.11)
list(APPEND MACDEPLOYQT_ARGS -no-codesign)
endif()
# $<TARGET_BUNDLE_DIR> points to the build tree; xcodebuild archive builds the bundle elsewhere
add_custom_command(TARGET ${PROJECT} POST_BUILD
COMMAND ${QT_BIN_DIR_DETECTED}/macdeployqt \${TARGET_BUILD_DIR}/\${WRAPPER_NAME} ${MACDEPLOYQT_ARGS}
COMMAND ${QT_BIN_DIR_DETECTED}/macdeployqt $<TARGET_BUNDLE_DIR:${PROJECT}> -appstore-compliant -qmldir=${CMAKE_CURRENT_SOURCE_DIR} -no-codesign
)
@@ -66,8 +66,6 @@ ProtocolConfig AwgConfigurator::createConfig(const ServerCredentials &credential
newClientConfig.nativeConfig = awgConfig;
newClientConfig.hostName = wgConfig->clientConfig->hostName;
newClientConfig.port = wgConfig->clientConfig->port;
newClientConfig.cascadeEndpoint = wgConfig->clientConfig->cascadeEndpoint;
newClientConfig.cascadePort = wgConfig->clientConfig->cascadePort;
newClientConfig.clientIp = wgConfig->clientConfig->clientIp;
newClientConfig.clientPrivateKey = wgConfig->clientConfig->clientPrivateKey;
newClientConfig.clientPublicKey = wgConfig->clientConfig->clientPublicKey;
@@ -266,11 +266,6 @@ ProtocolConfig WireguardConfigurator::createConfig(const ServerCredentials &cred
clientConfig.nativeConfig = config;
clientConfig.hostName = connData.host;
clientConfig.port = connData.port.toInt();
if (wireguardServerConfig) {
clientConfig.setCascade(wireguardServerConfig->cascadeEndpoint, wireguardServerConfig->cascadePort);
} else if (awgServerConfig) {
clientConfig.setCascade(awgServerConfig->cascadeEndpoint, awgServerConfig->cascadePort);
}
clientConfig.clientIp = connData.clientIP;
clientConfig.clientPrivateKey = connData.clientPrivKey;
clientConfig.clientPublicKey = connData.clientPubKey;
@@ -77,8 +77,11 @@ QFuture<QPair<ErrorCode, QJsonArray>> NewsController::fetchNews()
}
QSharedPointer<GatewayController> gatewayController(
new GatewayController(m_appSettingsRepository->gatewayEnvironment(), apiDefs::requestTimeoutMsecs,
m_appSettingsRepository->isStrictKillSwitchEnabled(), m_appSettingsRepository),
new GatewayController(m_appSettingsRepository->getGatewayEndpoint(),
m_appSettingsRepository->isDevGatewayEnv(),
apiDefs::requestTimeoutMsecs,
m_appSettingsRepository->isStrictKillSwitchEnabled(),
m_appSettingsRepository),
&QObject::deleteLater);
// both country codes and service types are arrays here, one entry per gateway stack the user has
@@ -343,7 +343,7 @@ ErrorCode ServicesCatalogController::fillAvailableServices(QJsonObject &services
ErrorCode ServicesCatalogController::executeRequest(const QString &endpoint, const QJsonObject &apiPayload, QByteArray &responseBody)
{
GatewayController gatewayController(m_appSettingsRepository->gatewayEnvironment(), apiDefs::requestTimeoutMsecs,
GatewayController gatewayController(m_appSettingsRepository->getGatewayEndpoint(), m_appSettingsRepository->isDevGatewayEnv(), apiDefs::requestTimeoutMsecs,
m_appSettingsRepository->isStrictKillSwitchEnabled(), m_appSettingsRepository);
return gatewayController.post(endpoint, apiPayload, responseBody);
}
@@ -108,8 +108,8 @@ StorePurchaseController::StorePurchaseController(SecureServersRepository *server
ErrorCode StorePurchaseController::executeRequest(const QString &endpoint, const QJsonObject &apiPayload,
QByteArray &responseBody, bool isTestPurchase)
{
GatewayController gatewayController(m_appSettingsRepository->gatewayEnvironment(isTestPurchase),
apiDefs::requestTimeoutMsecs,
GatewayController gatewayController(m_appSettingsRepository->getGatewayEndpoint(isTestPurchase),
m_appSettingsRepository->isDevGatewayEnv(isTestPurchase), apiDefs::requestTimeoutMsecs,
m_appSettingsRepository->isStrictKillSwitchEnabled(), m_appSettingsRepository);
return gatewayController.post(endpoint, apiPayload, responseBody);
}
@@ -196,8 +196,7 @@ void SubscriptionController::updateApiConfigInJson(QJsonObject &serverConfigJson
ErrorCode SubscriptionController::executeRequest(const QString &endpoint, const QJsonObject &apiPayload, QByteArray &responseBody, bool isTestPurchase)
{
GatewayController gatewayController(m_appSettingsRepository->gatewayEnvironment(isTestPurchase),
apiDefs::requestTimeoutMsecs,
GatewayController gatewayController(m_appSettingsRepository->getGatewayEndpoint(isTestPurchase), m_appSettingsRepository->isDevGatewayEnv(isTestPurchase), apiDefs::requestTimeoutMsecs,
m_appSettingsRepository->isStrictKillSwitchEnabled(), m_appSettingsRepository);
return gatewayController.post(endpoint, apiPayload, responseBody);
}
@@ -812,9 +811,11 @@ QFuture<QPair<ErrorCode, QString>> SubscriptionController::getRenewalLink(const
.addField(apiDefs::key::subscriptionStatus, getSubscriptionStatusForRenewal(apiV2->apiConfig))
.build();
auto gatewayController = QSharedPointer<GatewayController>::create(
m_appSettingsRepository->gatewayEnvironment(isTestPurchase), apiDefs::requestTimeoutMsecs,
m_appSettingsRepository->isStrictKillSwitchEnabled(), m_appSettingsRepository);
auto gatewayController = QSharedPointer<GatewayController>::create(m_appSettingsRepository->getGatewayEndpoint(isTestPurchase),
m_appSettingsRepository->isDevGatewayEnv(isTestPurchase),
apiDefs::requestTimeoutMsecs,
m_appSettingsRepository->isStrictKillSwitchEnabled(),
m_appSettingsRepository);
auto postFuture = gatewayController->postAsync(QString("%1v1/renewal_link"), apiPayload);
auto *watcher = new QFutureWatcher<QPair<ErrorCode, QByteArray>>();
QObject::connect(watcher, &QFutureWatcher<QPair<ErrorCode, QByteArray>>::finished,
@@ -289,15 +289,6 @@ QJsonObject ConnectionController::createConnectionConfiguration(const QPair<QStr
ContainerUtils::isAwgContainer(container) ? protocols::awg::defaultMtu :
protocols::wireguard::defaultMtu;
}
const QString cascadeEndpoint = vpnConfigData.value(configKey::cascadeEndpoint).toString();
if (!cascadeEndpoint.isEmpty()) {
vpnConfigData[configKey::hostName] = cascadeEndpoint;
}
const QString cascadePort = vpnConfigData.value(configKey::cascadePort).toString();
if (!cascadePort.isEmpty()) {
vpnConfigData[configKey::port] = cascadePort.toInt();
}
}
vpnConfiguration.insert(ProtocolUtils::key_proto_config_data(proto), vpnConfigData);
+22 -14
View File
@@ -56,9 +56,9 @@ namespace
constexpr QLatin1String endpointListSeparator(", ");
constexpr QLatin1String legacyEndpointPlaceholder("%1");
QStringList splitEndpoints(const QString &raw)
QStringList splitEndpoints(const char *raw)
{
return raw.split(endpointListSeparator, Qt::SkipEmptyParts);
return QString::fromUtf8(raw).split(endpointListSeparator, Qt::SkipEmptyParts);
}
void logAgwTrace(const QString &path, const int code, const QString &trace)
@@ -77,24 +77,32 @@ namespace
}
}
GatewayController::GatewayController(const amnezia::GatewayEnvironment &environment, const int requestTimeoutMsecs,
const bool isStrictKillSwitchEnabled,
SecureAppSettingsRepository *appSettingsRepository, QObject *parent)
GatewayController::GatewayController(const QString &gatewayEndpoint, const bool isDevEnvironment, const int requestTimeoutMsecs,
const bool isStrictKillSwitchEnabled, SecureAppSettingsRepository *appSettingsRepository,
QObject *parent)
: QObject(parent),
m_gatewayEndpoint(environment.endpoint),
m_gatewayEndpoint(gatewayEndpoint),
m_isStrictKillSwitchEnabled(isStrictKillSwitchEnabled),
m_appSettingsRepository(appSettingsRepository)
{
m_publicKeyMissing = environment.publicKey.isEmpty();
const QByteArray publicKey = isDevEnvironment ? QByteArray(DEV_AGW_PUBLIC_KEY) : QByteArray(PROD_AGW_PUBLIC_KEY);
m_publicKeyMissing = publicKey.isEmpty();
QStringList primaryEndpoints;
QStringList fallbackEndpoints;
if (isDevEnvironment) {
primaryEndpoints = splitEndpoints(DEV_S3_ENDPOINT);
} else {
primaryEndpoints = splitEndpoints(PROD_S3_ENDPOINT);
fallbackEndpoints = splitEndpoints(FALLBACK_S3_ENDPOINT);
}
QJsonObject config;
config[agwConfigKey::gatewayEndpoint] = environment.endpoint;
config[agwConfigKey::publicKeyPem] = QString::fromUtf8(environment.publicKey);
config[agwConfigKey::s3PrimaryEndpoints] =
QJsonArray::fromStringList(splitEndpoints(environment.primaryProxyStorages));
config[agwConfigKey::s3FallbackEndpoints] =
QJsonArray::fromStringList(splitEndpoints(environment.fallbackProxyStorages));
config[agwConfigKey::isDevEnvironment] = environment.isDev;
config[agwConfigKey::gatewayEndpoint] = gatewayEndpoint;
config[agwConfigKey::publicKeyPem] = QString::fromUtf8(publicKey);
config[agwConfigKey::s3PrimaryEndpoints] = QJsonArray::fromStringList(primaryEndpoints);
config[agwConfigKey::s3FallbackEndpoints] = QJsonArray::fromStringList(fallbackEndpoints);
config[agwConfigKey::isDevEnvironment] = isDevEnvironment;
config[agwConfigKey::requestTimeoutMsecs] = requestTimeoutMsecs;
config[agwConfigKey::proxyRequestTimeoutMsecs] = apiDefs::proxyRequestTimeoutMsecs;
config[agwConfigKey::proxyStorageTimeoutMsecs] = apiDefs::proxyStorageTimeoutMsecs;
+1 -2
View File
@@ -9,7 +9,6 @@
#include <QString>
#include <QStringList>
#include "core/utils/commonStructs.h"
#include "core/utils/errorCodes.h"
#include "agw.h"
@@ -21,7 +20,7 @@ class GatewayController : public QObject
Q_OBJECT
public:
explicit GatewayController(const amnezia::GatewayEnvironment &environment, const int requestTimeoutMsecs,
explicit GatewayController(const QString &gatewayEndpoint, const bool isDevEnvironment, const int requestTimeoutMsecs,
const bool isStrictKillSwitchEnabled, SecureAppSettingsRepository *appSettingsRepository,
QObject *parent = nullptr);
~GatewayController() override;
+11 -12
View File
@@ -300,25 +300,19 @@ bool SettingsController::isDevModeEnabled() const
return m_isDevModeEnabled;
}
QString SettingsController::devGatewayEndpoint() const
void SettingsController::resetGatewayEndpoint()
{
return m_appSettingsRepository->devGatewayEndpoint();
m_appSettingsRepository->resetGatewayEndpoint();
}
QString SettingsController::devGatewayProxyStorages() const
void SettingsController::setGatewayEndpoint(const QString &endpoint)
{
return m_appSettingsRepository->devGatewayProxyStorages();
m_appSettingsRepository->setGatewayEndpoint(endpoint);
}
QString SettingsController::devGatewayPublicKey() const
QString SettingsController::getGatewayEndpoint() const
{
return m_appSettingsRepository->devGatewayPublicKey();
}
void SettingsController::setDevGatewayConfig(const QString &endpoint, const QString &proxyStorages,
const QString &publicKey)
{
m_appSettingsRepository->setDevGatewayConfig(endpoint, proxyStorages, publicKey);
return m_appSettingsRepository->isDevGatewayEnv() ? "Dev endpoint" : m_appSettingsRepository->getGatewayEndpoint();
}
bool SettingsController::isDevGatewayEnv() const
@@ -329,6 +323,11 @@ bool SettingsController::isDevGatewayEnv() const
void SettingsController::toggleDevGatewayEnv(bool enabled)
{
m_appSettingsRepository->toggleDevGatewayEnv(enabled);
if (enabled) {
m_appSettingsRepository->setDevGatewayEndpoint();
} else {
m_appSettingsRepository->resetGatewayEndpoint();
}
}
bool SettingsController::isHomeAdLabelVisible() const
+3 -4
View File
@@ -76,10 +76,9 @@ public:
QString nextAvailableServerName() const;
bool isDevModeEnabled() const;
QString devGatewayEndpoint() const;
QString devGatewayProxyStorages() const;
QString devGatewayPublicKey() const;
void setDevGatewayConfig(const QString &endpoint, const QString &proxyStorages, const QString &publicKey);
void resetGatewayEndpoint();
void setGatewayEndpoint(const QString &endpoint);
QString getGatewayEndpoint() const;
bool isDevGatewayEnv() const;
void toggleDevGatewayEnv(bool enabled);
+5 -3
View File
@@ -139,9 +139,11 @@ void UpdateController::checkForUpdates()
}
setUpdateCheckRunning(true);
auto gatewayController = QSharedPointer<GatewayController>::create(
m_appSettingsRepository->gatewayEnvironment(), apiDefs::requestTimeoutMsecs,
m_appSettingsRepository->isStrictKillSwitchEnabled(), m_appSettingsRepository);
auto gatewayController = QSharedPointer<GatewayController>::create(m_appSettingsRepository->getGatewayEndpoint(),
m_appSettingsRepository->isDevGatewayEnv(),
apiDefs::requestTimeoutMsecs,
m_appSettingsRepository->isStrictKillSwitchEnabled(),
m_appSettingsRepository);
QJsonObject apiPayload = GatewayPayloadBuilder(m_appSettingsRepository).build();
+2 -7
View File
@@ -1,8 +1,5 @@
#include "installerBase.h"
#include <QRandomGenerator>
#include <iterator>
#include "core/utils/containerEnum.h"
#include "core/utils/containers/containerUtils.h"
#include "core/utils/protocolEnum.h"
@@ -88,10 +85,8 @@ ContainerConfig InstallerBase::createBaseConfig(DockerContainer container, int p
srv.transport = protocols::xray::defaultTransport;
srv.security = protocols::xray::defaultSecurity;
srv.flow = protocols::xray::defaultFlow;
const int siteIndex =
QRandomGenerator::global()->bounded(static_cast<int>(std::size(protocols::xray::defaultSites)));
srv.site = protocols::xray::defaultSites[siteIndex];
srv.sni = srv.site;
srv.site = protocols::xray::defaultSite;
srv.sni = protocols::xray::defaultSni;
srv.alpn = protocols::xray::defaultAlpn;
srv.fingerprint = protocols::xray::defaultFingerprint;
config.protocolConfig = xrayConfig;
@@ -72,12 +72,6 @@ QJsonObject AwgServerConfig::toJson() const
if (!port.isEmpty()) {
obj[configKey::port] = this->port;
}
if (!cascadeEndpoint.isEmpty()) {
obj[configKey::cascadeEndpoint] = cascadeEndpoint;
}
if (!cascadePort.isEmpty()) {
obj[configKey::cascadePort] = cascadePort;
}
if (!transportProto.isEmpty()) {
obj[configKey::transportProto] = transportProto;
}
@@ -172,8 +166,6 @@ AwgServerConfig AwgServerConfig::fromJson(const QJsonObject& json)
AwgServerConfig config;
config.port = json.value(configKey::port).toString();
config.cascadeEndpoint = json.value(configKey::cascadeEndpoint).toString();
config.cascadePort = json.value(configKey::cascadePort).toString();
config.transportProto = json.value(configKey::transportProto).toString();
config.protocolVersion = json.value(configKey::protocolVersion).toString();
config.subnetAddress = json.value(configKey::subnetAddress).toString();
@@ -226,12 +218,6 @@ QJsonObject AwgClientConfig::toJson() const
if (port > 0) {
obj[configKey::port] = port;
}
if (!cascadeEndpoint.isEmpty()) {
obj[configKey::cascadeEndpoint] = cascadeEndpoint;
}
if (!cascadePort.isEmpty()) {
obj[configKey::cascadePort] = cascadePort;
}
if (!clientIp.isEmpty()) {
obj[configKey::clientIp] = clientIp;
}
@@ -347,14 +333,6 @@ QJsonObject AwgClientConfig::toJson() const
return obj;
}
void AwgClientConfig::setCascade(const QString &newEndpoint, const QString &newPort)
{
cascadeEndpoint = newEndpoint;
cascadePort = newPort;
nativeConfig = replaceWireGuardEndpoint(nativeConfig, newEndpoint.isEmpty() ? hostName : newEndpoint,
newPort.isEmpty() ? port : newPort.toInt());
}
AwgClientConfig AwgClientConfig::fromJson(const QJsonObject& json)
{
AwgClientConfig config;
@@ -362,8 +340,6 @@ AwgClientConfig AwgClientConfig::fromJson(const QJsonObject& json)
config.nativeConfig = json.value(configKey::config).toString();
config.hostName = json.value(configKey::hostName).toString();
config.port = json.value(configKey::port).toInt(0);
config.cascadeEndpoint = json.value(configKey::cascadeEndpoint).toString();
config.cascadePort = json.value(configKey::cascadePort).toString();
config.clientIp = json.value(configKey::clientIp).toString();
config.clientPrivateKey = json.value(configKey::clientPrivKey).toString();
config.clientPublicKey = json.value(configKey::clientPubKey).toString();
@@ -19,8 +19,6 @@ namespace AwgConstant
struct AwgServerConfig {
QString port;
QString cascadeEndpoint;
QString cascadePort;
QString transportProto;
QString protocolVersion;
QString subnetAddress;
@@ -63,8 +61,6 @@ struct AwgClientConfig {
QString nativeConfig;
QString hostName;
int port;
QString cascadeEndpoint;
QString cascadePort;
QString clientIp;
QString clientPrivateKey;
QString clientPublicKey;
@@ -99,9 +95,6 @@ struct AwgClientConfig {
QString maxHandshakeAttempts;
QString randomTrailers;
QString disableCookies;
void setCascade(const QString &newEndpoint, const QString &newPort);
QJsonObject toJson() const;
static AwgClientConfig fromJson(const QJsonObject& json);
};
@@ -20,12 +20,6 @@ QJsonObject WireGuardServerConfig::toJson() const
if (!port.isEmpty()) {
obj[configKey::port] = port;
}
if (!cascadeEndpoint.isEmpty()) {
obj[configKey::cascadeEndpoint] = cascadeEndpoint;
}
if (!cascadePort.isEmpty()) {
obj[configKey::cascadePort] = cascadePort;
}
if (!transportProto.isEmpty()) {
obj[configKey::transportProto] = transportProto;
}
@@ -51,8 +45,6 @@ WireGuardServerConfig WireGuardServerConfig::fromJson(const QJsonObject& json)
WireGuardServerConfig config;
config.port = json.value(configKey::port).toString();
config.cascadeEndpoint = json.value(configKey::cascadeEndpoint).toString();
config.cascadePort = json.value(configKey::cascadePort).toString();
config.transportProto = json.value(configKey::transportProto).toString();
config.subnetAddress = json.value(configKey::subnetAddress).toString();
config.subnetMask = json.value(configKey::subnetMask).toString();
@@ -81,12 +73,6 @@ QJsonObject WireGuardClientConfig::toJson() const
if (port > 0) {
obj[configKey::port] = port;
}
if (!cascadeEndpoint.isEmpty()) {
obj[configKey::cascadeEndpoint] = cascadeEndpoint;
}
if (!cascadePort.isEmpty()) {
obj[configKey::cascadePort] = cascadePort;
}
if (!clientIp.isEmpty()) {
obj[configKey::clientIp] = clientIp;
}
@@ -133,14 +119,6 @@ QJsonObject WireGuardClientConfig::toJson() const
return obj;
}
void WireGuardClientConfig::setCascade(const QString &newEndpoint, const QString &newPort)
{
cascadeEndpoint = newEndpoint;
cascadePort = newPort;
nativeConfig = replaceWireGuardEndpoint(nativeConfig, newEndpoint.isEmpty() ? hostName : newEndpoint,
newPort.isEmpty() ? port : newPort.toInt());
}
WireGuardClientConfig WireGuardClientConfig::fromJson(const QJsonObject& json)
{
WireGuardClientConfig config;
@@ -148,8 +126,6 @@ WireGuardClientConfig WireGuardClientConfig::fromJson(const QJsonObject& json)
config.nativeConfig = json.value(configKey::config).toString();
config.hostName = json.value(configKey::hostName).toString();
config.port = json.value(configKey::port).toInt(0);
config.cascadeEndpoint = json.value(configKey::cascadeEndpoint).toString();
config.cascadePort = json.value(configKey::cascadePort).toString();
config.clientIp = json.value(configKey::clientIp).toString();
config.clientPrivateKey = json.value(configKey::clientPrivKey).toString();
config.clientPublicKey = json.value(configKey::clientPubKey).toString();
@@ -12,8 +12,6 @@ namespace amnezia
struct WireGuardServerConfig {
QString port;
QString cascadeEndpoint;
QString cascadePort;
QString transportProto;
QString subnetAddress;
QString subnetMask;
@@ -30,8 +28,6 @@ struct WireGuardClientConfig {
QString nativeConfig;
QString hostName;
int port;
QString cascadeEndpoint;
QString cascadePort;
QString clientIp;
QString clientPrivateKey;
QString clientPublicKey;
@@ -45,8 +41,6 @@ struct WireGuardClientConfig {
QMap<QString, QString> awgParams;
bool isObfuscationEnabled = false;
void setCascade(const QString &newEndpoint, const QString &newPort);
QJsonObject toJson() const;
static WireGuardClientConfig fromJson(const QJsonObject& json);
};
@@ -354,6 +354,9 @@ void XrayServerConfig::applyDefaults(bool fillFlowDefault)
transportProto = ProtocolUtils::transportProtoToString(ProtocolUtils::defaultTransportProto(Proto::Xray),
Proto::Xray);
}
if (site.isEmpty()) {
site = protocols::xray::defaultSite;
}
if (transport.isEmpty()) {
transport = protocols::xray::defaultTransport;
}
@@ -364,7 +367,7 @@ void XrayServerConfig::applyDefaults(bool fillFlowDefault)
flow = protocols::xray::defaultFlow;
}
if (sni.isEmpty()) {
sni = site;
sni = site.isEmpty() ? QString::fromLatin1(protocols::xray::defaultSni) : site;
}
if (alpn.isEmpty()) {
alpn = protocols::xray::defaultAlpn;
@@ -566,7 +569,7 @@ QJsonObject XrayServerConfig::streamSettingsJson(XrayStreamSide side) const
if (securityEff == QLatin1String(px::securityTls)) {
QJsonObject tlsSettings;
tlsSettings[px::serverName] = sni;
tlsSettings[px::serverName] = sni.isEmpty() ? QString::fromLatin1(px::defaultSni) : sni;
const QString alpnEff = alpn.isEmpty() ? QString::fromLatin1(px::defaultAlpn) : alpn;
QJsonArray alpnArray;
for (const QString &a : alpnEff.split(QLatin1Char(','))) {
@@ -595,7 +598,7 @@ QJsonObject XrayServerConfig::streamSettingsJson(XrayStreamSide side) const
if (clientSide && securityEff == QLatin1String(px::securityReality)) {
QJsonObject realitySettings;
realitySettings[px::fingerprint] = fingerprintEff;
realitySettings[px::serverName] = sni;
realitySettings[px::serverName] = sni.isEmpty() ? QString::fromLatin1(px::defaultSni) : sni;
streamSettings[px::realitySettings] = realitySettings;
}
@@ -1136,10 +1139,11 @@ QJsonObject XrayServerConfig::toServerInboundJson(const XrayServerInboundInputs
QJsonObject streamSettings = serverStreamSettings();
if (xrayEffective::security(*this) == QLatin1String(px::securityReality)) {
const QString siteEff = site.isEmpty() ? QString::fromLatin1(px::defaultSite) : site;
QJsonObject realitySettings;
realitySettings[px::dest] = site + QStringLiteral(":443");
realitySettings[px::dest] = siteEff + QStringLiteral(":443");
realitySettings[px::privateKey] = inputs.realityPrivateKey;
realitySettings[px::serverNames] = QJsonArray { sni.isEmpty() ? site : sni };
realitySettings[px::serverNames] = QJsonArray { sni.isEmpty() ? siteEff : sni };
realitySettings[px::shortIds] = QJsonArray { inputs.realityShortId };
streamSettings[px::realitySettings] = realitySettings;
}
@@ -1319,9 +1323,10 @@ QJsonObject XrayServerConfig::serverView() const
view[px::streamSettings] = serverStreamSettings();
if (xrayEffective::security(*this) == QLatin1String(px::securityReality)) {
const QString siteEff = site.isEmpty() ? QString::fromLatin1(px::defaultSite) : site;
QJsonObject reality;
reality[px::dest] = site;
reality[px::serverName] = sni.isEmpty() ? site : sni;
reality[px::dest] = siteEff;
reality[px::serverName] = sni.isEmpty() ? siteEff : sni;
view[QStringLiteral("reality")] = reality;
}
-8
View File
@@ -1,7 +1,6 @@
#include "protocolUtils.h"
#include <QRandomGenerator>
#include <QRegularExpression>
#include <QJsonObject>
#include <QObject>
@@ -217,10 +216,3 @@ QString ProtocolUtils::key_proto_config_path(Proto p)
return protoToString(p) + "_config_path";
}
QString ProtocolUtils::replaceWireGuardEndpoint(QString nativeConfig, const QString &host, int port)
{
static const QRegularExpression endpointLine(QString(R"(^(\s*%1\s*=\s*).*$)").arg(protocols::wireguard::Endpoint),
QRegularExpression::MultilineOption);
const QString endpointHost = host.contains(':') ? QString("[%1]").arg(host) : host;
return nativeConfig.replace(endpointLine, QString("\\1%1:%2").arg(endpointHost).arg(port));
}
-2
View File
@@ -39,8 +39,6 @@ namespace amnezia
QString key_proto_config_data(Proto p);
QString key_proto_config_path(Proto p);
QString replaceWireGuardEndpoint(QString nativeConfig, const QString &host, int port);
}
}
-4
View File
@@ -174,10 +174,6 @@ ErrorCode XrayProtocol::startTun2Socks()
connect(
m_tun2socksProcess.data(), &IpcProcessInterfaceReplica::readyReadStandardError, this,
[this]() {
if (!m_tun2socksProcess) {
return;
}
auto readAllStandardError = m_tun2socksProcess->readAllStandardError();
if (!readAllStandardError.waitForFinished()) {
qWarning() << "Failed to read output from tun2socks";
@@ -17,12 +17,14 @@
using namespace amnezia;
namespace {
constexpr char prodGatewayEndpoint[] = "http://gw.amnezia.org:80/";
constexpr char gatewayEndpoint[] = "http://gw.amnezia.org:80/";
}
SecureAppSettingsRepository::SecureAppSettingsRepository(SecureQSettings* settings, QObject *parent)
: QObject(parent), m_settings(settings)
{
QString storedEndpoint = value("Conf/gatewayEndpoint", gatewayEndpoint).toString();
m_gatewayEndpoint = storedEndpoint.isEmpty() ? gatewayEndpoint : storedEndpoint;
}
QVariant SecureAppSettingsRepository::value(const QString &key, const QVariant &defaultValue) const
@@ -268,46 +270,35 @@ void SecureAppSettingsRepository::setAppsSplitTunnelingEnabled(bool enabled)
emit appsSplitTunnelingEnabledChanged(enabled);
}
GatewayEnvironment SecureAppSettingsRepository::gatewayEnvironment(bool isTestPurchase) const
QString SecureAppSettingsRepository::getGatewayEndpoint(bool isTestPurchase) const
{
if (isTestPurchase) {
return { SANDBOX_AGW_ENDPOINT, QByteArray::fromBase64(SANDBOX_AGW_PUBLIC_KEY_B64), SANDBOX_S3_ENDPOINT, {}, true };
return QString(DEV_AGW_ENDPOINT);
}
if (isDevGatewayEnv()) {
return {
devGatewayEndpoint(), QByteArray::fromBase64(devGatewayPublicKey().toUtf8()), devGatewayProxyStorages(), {}, true
};
}
return { prodGatewayEndpoint, QByteArray::fromBase64(PROD_AGW_PUBLIC_KEY_B64), PROD_S3_ENDPOINT,
FALLBACK_S3_ENDPOINT, false };
return m_gatewayEndpoint;
}
QString SecureAppSettingsRepository::devGatewayEndpoint() const
void SecureAppSettingsRepository::setGatewayEndpoint(const QString &endpoint)
{
return value("Conf/devGatewayEndpoint").toString();
m_gatewayEndpoint = endpoint;
setValue("Conf/gatewayEndpoint", endpoint);
}
QString SecureAppSettingsRepository::devGatewayProxyStorages() const
void SecureAppSettingsRepository::resetGatewayEndpoint()
{
return value("Conf/devGatewayProxyStorages").toString();
m_gatewayEndpoint = gatewayEndpoint;
setValue("Conf/gatewayEndpoint", gatewayEndpoint);
}
QString SecureAppSettingsRepository::devGatewayPublicKey() const
void SecureAppSettingsRepository::setDevGatewayEndpoint()
{
return value("Conf/devGatewayPublicKey").toString();
m_gatewayEndpoint = QString(DEV_AGW_ENDPOINT);
setValue("Conf/gatewayEndpoint", DEV_AGW_ENDPOINT);
}
void SecureAppSettingsRepository::setDevGatewayConfig(const QString &endpoint, const QString &proxyStorages,
const QString &publicKey)
bool SecureAppSettingsRepository::isDevGatewayEnv(bool isTestPurchase) const
{
setValue("Conf/devGatewayEndpoint", endpoint);
setValue("Conf/devGatewayProxyStorages", proxyStorages);
setValue("Conf/devGatewayPublicKey", publicKey);
}
bool SecureAppSettingsRepository::isDevGatewayEnv() const
{
return value("Conf/devGatewayEnv", false).toBool();
return isTestPurchase ? true : value("Conf/devGatewayEnv", false).toBool();
}
void SecureAppSettingsRepository::toggleDevGatewayEnv(bool enabled)
@@ -57,12 +57,11 @@ public:
bool isAppsSplitTunnelingEnabled() const;
void setAppsSplitTunnelingEnabled(bool enabled);
GatewayEnvironment gatewayEnvironment(bool isTestPurchase = false) const;
QString devGatewayEndpoint() const;
QString devGatewayProxyStorages() const;
QString devGatewayPublicKey() const;
void setDevGatewayConfig(const QString &endpoint, const QString &proxyStorages, const QString &publicKey);
bool isDevGatewayEnv() const;
QString getGatewayEndpoint(bool isTestPurchase = false) const;
void setGatewayEndpoint(const QString &endpoint);
void resetGatewayEndpoint();
void setDevGatewayEndpoint();
bool isDevGatewayEnv(bool isTestPurchase = false) const;
void toggleDevGatewayEnv(bool enabled);
QByteArray readGatewayProxyUrls(const QString &cacheKey) const;
void writeGatewayProxyUrls(const QString &cacheKey, const QByteArray &proxyUrlsEncrypted);
@@ -137,6 +136,7 @@ private:
void setValue(const QString &key, const QVariant &value);
SecureQSettings* m_settings;
QString m_gatewayEndpoint;
};
#endif // SECUREAPPSETTINGSREPOSITORY_H
-9
View File
@@ -39,15 +39,6 @@ namespace amnezia
QString secondaryDns;
};
struct GatewayEnvironment
{
QString endpoint;
QByteArray publicKey;
QString primaryProxyStorages;
QString fallbackProxyStorages;
bool isDev = false;
};
struct SplitTunnelingSettings
{
bool isSitesSplitTunnelingEnabled;
-2
View File
@@ -13,8 +13,6 @@ namespace amnezia
constexpr QLatin1String password("password");
constexpr QLatin1String port("port");
constexpr QLatin1String localPort("local_port");
constexpr QLatin1String cascadeEndpoint("cascade_endpoint");
constexpr QLatin1String cascadePort("cascade_port");
constexpr QLatin1String dns1("dns1");
constexpr QLatin1String dns2("dns2");
@@ -57,17 +57,7 @@ namespace amnezia
constexpr char shortidPath[] = "/opt/amnezia/xray/xray_short_id.key";
constexpr char tlsCertPath[] = "/opt/amnezia/xray/tls_cert.pem";
constexpr char tlsKeyPath[] = "/opt/amnezia/xray/tls_key.pem";
constexpr const char *defaultSites[] = {
"www.microsoft.com",
"www.apple.com",
"www.icloud.com",
"dl.google.com",
"www.bing.com",
"www.samsung.com",
"www.nvidia.com",
"www.mozilla.org",
"addons.mozilla.org",
};
constexpr char defaultSite[] = "www.googletagmanager.com";
constexpr char defaultPort[] = "443";
constexpr char defaultLocalProxyPort[] = "10808";
@@ -79,7 +69,8 @@ namespace amnezia
constexpr char defaultSecurity[] = "reality";
constexpr char defaultFlow[] = "xtls-rprx-vision";
constexpr char defaultTransport[] = "raw";
constexpr char defaultFingerprint[] = "firefox";
constexpr char defaultFingerprint[] = "hellochrome_120";
constexpr char defaultSni[] = "www.googletagmanager.com";
constexpr char defaultAlpn[] = "h2";
constexpr char defaultXhttpMode[] = "Stream-one";
@@ -208,7 +208,7 @@ amnezia::ScriptVars amnezia::genXrayVars(const ContainerConfig &containerConfig)
if (auto* xrayProtocolConfig = containerConfig.getXrayProtocolConfig()) {
const XrayServerConfig& config = xrayProtocolConfig->serverConfig;
vars.append({ { "$XRAY_SITE_NAME", config.site } });
vars.append({ { "$XRAY_SITE_NAME", config.site.isEmpty() ? protocols::xray::defaultSite : config.site } });
vars.append({ { "$XRAY_SERVER_PORT", config.port.isEmpty() ? protocols::xray::defaultPort : config.port } });
}
@@ -205,10 +205,10 @@ extension PacketTunnelProvider {
}
}
func stopXray(completionHandler: @escaping () -> Void) {
func stopXray(completionHandler: () -> Void) {
Socks5Tunnel.quit()
LibXrayStopXray()
hevSocksTunnelGroup.notify(queue: .main, execute: completionHandler)
completionHandler()
}
func sockCallback(fd: uintptr_t) {
@@ -345,13 +345,10 @@ extension PacketTunnelProvider {
return
}
hevSocksTunnelGroup.enter()
DispatchQueue.global().async { [hevSocksTunnelGroup] in
DispatchQueue.global().async {
xrayLog(.info, message: "Hev socks started")
completionHandler(nil)
let result = Socks5Tunnel.run(withConfig: configurationFilePath)
xrayLog(.info, message: "Hev socks stopped: \(result)")
hevSocksTunnelGroup.leave()
Socks5Tunnel.run(withConfig: configurationFilePath)
}
}
}
@@ -69,7 +69,6 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
var protoType: TunnelProtoType?
var activeIfaceIdx: UInt32 = 0
let hevSocksTunnelGroup = DispatchGroup()
func openVPNPacketFlow() -> OpenVPNAdapterPacketFlow {
openVPNPacketFlowAdapter
@@ -317,11 +316,10 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
updateActiveInterfaceIndex(for: changePath)
reasserting = true
xrayLog(.info, message: "Applying network change to xray tunnel")
stopXray { [weak self] in
self?.startXray { [weak self] error in
self?.reasserting = false
completion(error)
}
stopXray { }
startXray { [weak self] error in
self?.reasserting = false
completion(error)
}
}
+4 -3
View File
@@ -81,8 +81,9 @@ class ScreenProtection {
public func enable(for view: UIView) {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
guard self.pairs.isEmpty else { return }
self.pairs.append(ProtectionPair(from: view))
view.subviews.forEach {
self.pairs.append(ProtectionPair(from: $0))
}
}
}
@@ -127,7 +128,7 @@ struct ProtectionPair {
}
func removeProtection() {
textField.layer.superlayer?.insertSublayer(layer, above: textField.layer)
textField.superview?.superview?.layer.addSublayer(layer)
textField.layer.removeFromSuperlayer()
textField.removeFromSuperview()
}
+33
View File
@@ -323,6 +323,37 @@ if(NOT ANDROID)
)
endforeach()
endforeach()
qt6_add_resources(PAGES_UI_QRC
${CLIENT_QML_QRC_FILE}
../images/images.qrc
)
add_executable(test_pages_ui
pagesUi/main.cpp
pagesUi/pagesUiTestFixture.cpp
pagesUi/pagesUiTestFixture.h
pagesUi/testPageSetupWizardConfigSource.cpp
pagesUi/testPageHome.cpp
pagesUi/testPageShare.cpp
pagesUi/testPageShareConnection.cpp
pagesUi/testPageShareFullAccess.cpp
${PAGES_UI_QRC}
)
target_link_libraries(test_pages_ui PRIVATE
Qt6::Test
test_common
SortFilterProxyModel
)
if(COMMAND qt_import_qml_plugins)
qt_import_qml_plugins(test_pages_ui)
endif()
if(COMMAND qt_finalize_executable)
qt_finalize_executable(test_pages_ui)
endif()
endif() # NOT ANDROID
if(ANDROID)
@@ -492,6 +523,8 @@ if(NOT ANDROID)
add_test(NAME ConnectionTest COMMAND test_connection)
add_test(NAME OpenSSLLibraryTest COMMAND test_openssl_library)
add_test(NAME LogsControllerTest COMMAND test_logs_controller)
add_test(NAME PagesUiTest COMMAND test_pages_ui)
endif()
# Android tests are executed on-device via androidtestrunner in CI (see .github/workflows/tests.yml).
+41
View File
@@ -0,0 +1,41 @@
#include <QApplication>
#include <QQmlEngine>
#include <QQuickStyle>
#include <QUrl>
#include <QTest>
#include "ui/models/containerProps.h"
#include "ui/utils/pageEnum.h"
#include "core/utils/protocolEnum.h"
int runPageSetupWizardConfigSourceTests(int argc, char *argv[]);
int runPageHomeTests(int argc, char *argv[]);
int runPageShareTests(int argc, char *argv[]);
int runPageShareConnectionTests(int argc, char *argv[]);
int runPageShareFullAccessTests(int argc, char *argv[]);
int main(int argc, char *argv[])
{
QQuickStyle::setStyle(QStringLiteral("Basic"));
QApplication app(argc, argv);
PageLoader::declareQmlPageEnum();
qmlRegisterUncreatableMetaObject(amnezia::ProtocolEnumNS::staticMetaObject, "ProtocolEnum", 1, 0, "ProtocolEnum", QStringLiteral("Error: only enums"));
static ContainerProps containerProps;
qmlRegisterSingletonInstance("ContainerProps", 1, 0, "ContainerProps", &containerProps);
qmlRegisterSingletonType(QUrl(QStringLiteral("qrc:/ui/qml/Filters/ContainersModelFilters.qml")), "ContainersModelFilters", 1, 0, "ContainersModelFilters");
int result = 0;
result |= runPageSetupWizardConfigSourceTests(argc, argv);
result |= runPageHomeTests(argc, argv);
result |= runPageShareTests(argc, argv);
result |= runPageShareConnectionTests(argc, argv);
result |= runPageShareFullAccessTests(argc, argv);
return result;
}
+407
View File
@@ -0,0 +1,407 @@
#include "pagesUiTestFixture.h"
#include <QCoreApplication>
#include <QElapsedTimer>
#include <QEvent>
#include <QJSValue>
#include <QObject>
#include <QQuickStyle>
#include <QSet>
#include <QUuid>
#include <QVariant>
#include <QSignalSpy>
#include <vpnConnection.h>
#include "ui/utils/pageEnum.h"
bool PagesUiTestFixture::initialize(QObject *parent)
{
m_settings = new SecureQSettings("AmneziaVPN-PagesUiTest-" + QUuid::createUuid().toString(), "amnezia-client",
parent, false);
m_engine = new QQmlApplicationEngine(parent);
m_engine->addImportPath(QStringLiteral("qrc:/ui/qml/Modules/"));
m_engine->rootContext()->setContextProperty("IsMacOsNeBuild", false);
m_engine->rootContext()->setContextProperty("IsPlayBuild", false);
auto vpnConnection = QSharedPointer<VpnConnection>::create(nullptr, nullptr);
m_core = new TestCoreController(vpnConnection, m_settings, m_engine, parent);
m_pageController = m_core->pageController();
return m_pageController != nullptr;
}
void PagesUiTestFixture::cleanup()
{
closePage();
if (m_settings) {
m_settings->clearSettings();
}
delete m_core;
m_core = nullptr;
m_pageController = nullptr;
delete m_engine;
m_engine = nullptr;
delete m_settings;
m_settings = nullptr;
}
bool PagesUiTestFixture::loadPage(const QString &pageName)
{
closePage();
const QByteArray hostQml = QStringLiteral("import QtQuick\n"
"import QtQuick.Controls\n"
"import \"../Config\"\n"
"\n"
"ApplicationWindow {\n"
" width: 420\n"
" height: 800\n"
" visible: true\n"
" property var dialogs: Dialogs\n"
"\n"
" Loader {\n"
" objectName: \"pageLoader\"\n"
" anchors.fill: parent\n"
" source: \"qrc:/ui/qml/Pages2/%1.qml\"\n"
" }\n"
"}\n")
.arg(pageName)
.toUtf8();
m_engine->loadData(hostQml, QUrl(QStringLiteral("qrc:/ui/qml/Pages2/pagesUiTestHost.qml")));
if (m_engine->rootObjects().isEmpty()) {
return false;
}
m_window = qobject_cast<QQuickWindow *>(m_engine->rootObjects().last());
if (!m_window || !QTest::qWaitForWindowExposed(m_window)) {
return false;
}
m_window->requestActivate();
QTest::qWaitForWindowActive(m_window);
QObject *loader = m_window->findChild<QObject *>(QStringLiteral("pageLoader"));
if (!loader) {
return false;
}
if (!QTest::qWaitFor([loader] { return loader->property("status").toInt() == 1; }, 5000)) {
return false;
}
m_page = qvariant_cast<QQuickItem *>(loader->property("item"));
return m_page != nullptr;
}
bool PagesUiTestFixture::loadPageFromStartPage(PageLoader::PageEnum page)
{
if (!m_pageController || !m_pageController->isStartPageVisible()) {
return false;
}
// Load the actual application start page
if (!loadPage(QStringLiteral("PageStart"))) {
return false;
}
// Navigate through PageController
emit m_pageController->goToPage(page, false);
const QString pagePath = m_pageController->getPagePath(page);
QQuickItem *targetPage = nullptr;
const bool pageLoaded = QTest::qWaitFor(
[this, &targetPage, &pagePath]() {
targetPage = item(QStringLiteral("objectName"), pagePath, m_page);
return targetPage && targetPage->isVisible();
},
5000);
if (!pageLoaded) {
return false;
}
m_page = targetPage;
return true;
}
void PagesUiTestFixture::closePage()
{
m_page = nullptr;
if (!m_window) {
return;
}
m_window->close();
m_window->deleteLater();
m_window = nullptr;
QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
}
bool PagesUiTestFixture::loadEmptyWindow()
{
closePage();
const QByteArray hostQml = QStringLiteral("import QtQuick\n"
"import QtQuick.Controls\n"
"import \"../Config\"\n"
"\n"
"ApplicationWindow {\n"
" width: 420\n"
" height: 800\n"
" visible: true\n"
" property var dialogs: Dialogs\n"
"}\n")
.toUtf8();
m_engine->loadData(hostQml, QUrl(QStringLiteral("qrc:/ui/qml/Pages2/pagesUiTestHost.qml")));
if (m_engine->rootObjects().isEmpty()) {
return false;
}
m_window = qobject_cast<QQuickWindow *>(m_engine->rootObjects().last());
if (!m_window || !QTest::qWaitForWindowExposed(m_window)) {
closePage();
return false;
}
m_window->requestActivate();
QTest::qWaitForWindowActive(m_window);
return true;
}
static void collectFromObject(QObject *object, QList<QQuickItem *> &result, QSet<QObject *> &seen)
{
if (!object || seen.contains(object)) {
return;
}
seen.insert(object);
if (auto *item = qobject_cast<QQuickItem *>(object)) {
result.append(item);
for (QQuickItem *child : item->childItems()) {
collectFromObject(child, result, seen);
}
}
const QObjectList objectChildren = object->children();
for (QObject *child : objectChildren) {
collectFromObject(child, result, seen);
}
}
void PagesUiTestFixture::collectItems(QQuickItem *root, QList<QQuickItem *> &result)
{
QSet<QObject *> seen;
collectFromObject(root, result, seen);
}
QList<QQuickItem *> PagesUiTestFixture::items(QQuickItem *root) const
{
QList<QQuickItem *> result;
QSet<QObject *> seen;
if (root) {
collectFromObject(root, result, seen);
return result;
}
collectFromObject(m_page, result, seen);
if (m_window && m_window->contentItem()) {
collectFromObject(m_window->contentItem(), result, seen);
}
return result;
}
static bool isShown(QQuickItem *item)
{
if (!item || !item->isVisible()) {
return false;
}
for (QObject *object = item; object; object = object->parent()) {
if (object->inherits("QQuickPopup")) {
return object->property("visible").toBool();
}
}
return true;
}
bool PagesUiTestFixture::isQmlType(const QObject *object, const QString &qmlType)
{
if (!object) {
return false;
}
const QString className = QString::fromLatin1(object->metaObject()->className());
return className == qmlType || className.startsWith(qmlType + QLatin1Char('_'));
}
QList<QQuickItem *> PagesUiTestFixture::itemsOfType(const QString &qmlType, QQuickItem *root) const
{
QList<QQuickItem *> result;
for (QQuickItem *candidate : items(root)) {
if (isQmlType(candidate, qmlType)) {
result.append(candidate);
}
}
return result;
}
QQuickItem *PagesUiTestFixture::item(const QString &property, const QVariant &value, QQuickItem *root) const
{
for (QQuickItem *candidate : items(root)) {
const QVariant candidateValue = candidate->property(property.toUtf8().constData());
if (candidateValue.isValid() && candidateValue == value) {
return candidate;
}
}
return nullptr;
}
QQuickItem *PagesUiTestFixture::visibleItem(const QString &property, const QVariant &value, QQuickItem *root) const
{
for (QQuickItem *candidate : items(root)) {
const QVariant candidateValue = candidate->property(property.toUtf8().constData());
if (isShown(candidate) && candidateValue.isValid() && candidateValue == value) {
return candidate;
}
}
return nullptr;
}
QQuickItem *PagesUiTestFixture::clickable(const QString &text) const
{
for (QQuickItem *candidate : items()) {
const QVariant candidateText = candidate->property("text");
if (candidateText.isValid() && candidateText.toString() == text && isShown(candidate)
&& candidate->isEnabled()) {
return candidate;
}
}
return nullptr;
}
void PagesUiTestFixture::click(QQuickItem *target)
{
if (!target) {
return;
}
QPointF stablePoint;
bool haveStablePoint = false;
QElapsedTimer stableFor;
QTest::qWaitFor([&] {
QQuickWindow *window = target->window();
if (!window || !target->isVisible() || target->width() < 1 || target->height() < 1) {
haveStablePoint = false;
return false;
}
const QPointF point = target->mapToScene(QPointF(target->width() / 2.0, target->height() / 2.0));
const bool inside = point.x() >= 0 && point.y() >= 0 && point.x() < window->width() && point.y() < window->height();
const bool moved = !haveStablePoint || qAbs(point.x() - stablePoint.x()) > 1.0 || qAbs(point.y() - stablePoint.y()) > 1.0;
if (!inside || moved) {
stablePoint = point;
haveStablePoint = inside;
stableFor.restart();
return false;
}
return stableFor.elapsed() >= 200;
}, 5000);
QQuickWindow *window = target->window();
if (!window) {
return;
}
window->requestActivate();
QTest::qWaitForWindowExposed(window);
const QPointF center = target->mapToScene(QPointF(target->width() / 2.0, target->height() / 2.0));
QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, center.toPoint());
QTest::qWait(50);
}
void PagesUiTestFixture::typeText(QQuickItem *target, const QString &text)
{
if (!target || !m_window) {
return;
}
click(target);
for (const QChar character : text) {
QTest::keyClick(m_window, character.toLatin1());
}
}
void PagesUiTestFixture::clearAndType(QQuickItem *target, const QString &text)
{
if (!target || !m_window) {
return;
}
click(target);
QTest::keySequence(m_window, QKeySequence::SelectAll);
QTest::keyClick(m_window, Qt::Key_Backspace);
typeText(target, text);
}
bool PagesUiTestFixture::verifyNavigation(QQuickItem *target, PageLoader::PageEnum expectedPage)
{
if (!target || !m_pageController) {
return false;
}
QSignalSpy navigationSpy(m_pageController, &PageController::goToPage);
if (!navigationSpy.isValid()) {
return false;
}
click(target);
if (!QTest::qWaitFor([&navigationSpy] { return navigationSpy.count() == 1; }, 5000)) {
return false;
}
const QList<QVariant> arguments = navigationSpy.takeFirst();
return !arguments.isEmpty() && arguments.at(0).toInt() == static_cast<int>(expectedPage);
}
+73
View File
@@ -0,0 +1,73 @@
#pragma once
#include <QKeySequence>
#include <QQmlApplicationEngine>
#include <QQuickItem>
#include <QQuickWindow>
#include <QTest>
#include "secureQSettings.h"
#include "ui/controllers/qml/pageController.h"
#include "ui/utils/pageEnum.h"
#include "utils/testCoreController.h"
class PagesUiTestFixture
{
public:
bool initialize(QObject *parent);
void cleanup();
bool loadPage(const QString &pageName);
bool loadPageFromStartPage(PageLoader::PageEnum page);
void closePage();
bool loadEmptyWindow();
TestCoreController *core() const
{
return m_core;
}
QQmlApplicationEngine *engine() const
{
return m_engine;
}
PageController *pageController() const
{
return m_pageController;
}
QQuickWindow *window() const
{
return m_window;
}
QQuickItem *page() const
{
return m_page;
}
QList<QQuickItem *> items(QQuickItem *root = nullptr) const;
QList<QQuickItem *> itemsOfType(const QString &qmlType, QQuickItem *root = nullptr) const;
QQuickItem *item(const QString &property, const QVariant &value, QQuickItem *root = nullptr) const;
QQuickItem *visibleItem(const QString &property, const QVariant &value, QQuickItem *root = nullptr) const;
QQuickItem *clickable(const QString &text) const;
void click(QQuickItem *target);
void typeText(QQuickItem *target, const QString &text);
void clearAndType(QQuickItem *target, const QString &text);
bool verifyNavigation(QQuickItem *target, PageLoader::PageEnum expectedPage);
private:
static void collectItems(QQuickItem *root, QList<QQuickItem *> &result);
static bool isQmlType(const QObject *object, const QString &qmlType);
SecureQSettings *m_settings = nullptr;
QQmlApplicationEngine *m_engine = nullptr;
TestCoreController *m_core = nullptr;
PageController *m_pageController = nullptr;
QQuickWindow *m_window = nullptr;
QQuickItem *m_page = nullptr;
};
+247
View File
@@ -0,0 +1,247 @@
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QMetaObject>
#include <QObject>
#include <QTest>
#include <QVariant>
#include <QSignalSpy>
#include "core/controllers/selfhosted/importController.h"
#include "core/utils/constants/configKeys.h"
#include "core/utils/constants/protocolConstants.h"
#include "ui/models/serversModel.h"
#include "pagesUiTestFixture.h"
using namespace amnezia;
class PageHomeTest : public QObject
{
Q_OBJECT
private:
PagesUiTestFixture m_fixture;
QJsonObject createAwg2Config(const QString &serverName)
{
QJsonObject clientConfig;
clientConfig[configKey::mtu] = protocols::awg::defaultMtu;
clientConfig[configKey::junkPacketCount] = protocols::awg::defaultJunkPacketCount;
clientConfig[configKey::junkPacketMinSize] = protocols::awg::defaultJunkPacketMinSize;
clientConfig[configKey::junkPacketMaxSize] = protocols::awg::defaultJunkPacketMaxSize;
clientConfig[configKey::specialJunk1] = protocols::awg::defaultSpecialJunk1;
clientConfig[configKey::specialJunk2] = protocols::awg::defaultSpecialJunk2;
clientConfig[configKey::specialJunk3] = protocols::awg::defaultSpecialJunk3;
clientConfig[configKey::specialJunk4] = protocols::awg::defaultSpecialJunk4;
clientConfig[configKey::specialJunk5] = protocols::awg::defaultSpecialJunk5;
clientConfig[configKey::initPacketJunkSize] = QString::number(protocols::awg::initPacketJunkSizeMax);
clientConfig[configKey::responsePacketJunkSize] = QString::number(protocols::awg::responsePacketJunkSizeMax);
clientConfig[configKey::cookieReplyPacketJunkSize] = QString::number(protocols::awg::cookieReplyPacketJunkSizeMax);
clientConfig[configKey::transportPacketJunkSize] = protocols::awg::defaultPadding;
clientConfig[configKey::initPacketMagicHeader] = protocols::awg::defaultInitPacketMagicHeader;
clientConfig[configKey::responsePacketMagicHeader] = protocols::awg::defaultResponsePacketMagicHeader;
clientConfig[configKey::underloadPacketMagicHeader] = protocols::awg::defaultUnderloadPacketMagicHeader;
clientConfig[configKey::transportPacketMagicHeader] = protocols::awg::defaultTransportPacketMagicHeader;
clientConfig[configKey::clientPrivKey] = "test_client_private_key";
clientConfig[configKey::clientPubKey] = "test_client_public_key";
clientConfig[configKey::serverPubKey] = "test_server_public_key";
clientConfig[configKey::pskKey] = "test_psk_key";
clientConfig[configKey::clientIp] = "10.8.1.2";
clientConfig[configKey::allowedIps] = QJsonArray::fromStringList({ "0.0.0.0/0" });
QJsonObject awgConfig;
awgConfig[configKey::lastConfig] = QString(QJsonDocument(clientConfig).toJson());
awgConfig[configKey::port] = protocols::awg::defaultPort;
awgConfig[configKey::transportProto] = "udp";
awgConfig[configKey::protocolVersion] = protocols::awg::awgV2;
awgConfig[configKey::subnetAddress] = protocols::wireguard::defaultSubnetAddress;
awgConfig[configKey::junkPacketCount] = protocols::awg::defaultJunkPacketCount;
awgConfig[configKey::junkPacketMinSize] = protocols::awg::defaultJunkPacketMinSize;
awgConfig[configKey::junkPacketMaxSize] = protocols::awg::defaultJunkPacketMaxSize;
awgConfig[configKey::initPacketJunkSize] = QString::number(protocols::awg::initPacketJunkSizeMax);
awgConfig[configKey::responsePacketJunkSize] = QString::number(protocols::awg::responsePacketJunkSizeMax);
awgConfig[configKey::cookieReplyPacketJunkSize] = QString::number(protocols::awg::cookieReplyPacketJunkSizeMax);
awgConfig[configKey::transportPacketJunkSize] = protocols::awg::defaultPadding;
awgConfig[configKey::initPacketMagicHeader] = protocols::awg::defaultInitPacketMagicHeader;
awgConfig[configKey::responsePacketMagicHeader] = protocols::awg::defaultResponsePacketMagicHeader;
awgConfig[configKey::underloadPacketMagicHeader] = protocols::awg::defaultUnderloadPacketMagicHeader;
awgConfig[configKey::transportPacketMagicHeader] = protocols::awg::defaultTransportPacketMagicHeader;
awgConfig[configKey::specialJunk1] = protocols::awg::defaultSpecialJunk1;
awgConfig[configKey::specialJunk2] = protocols::awg::defaultSpecialJunk2;
awgConfig[configKey::specialJunk3] = protocols::awg::defaultSpecialJunk3;
awgConfig[configKey::specialJunk4] = protocols::awg::defaultSpecialJunk4;
awgConfig[configKey::specialJunk5] = protocols::awg::defaultSpecialJunk5;
awgConfig[configKey::isThirdPartyConfig] = true;
QJsonObject container;
container[configKey::container] = "amnezia-awg";
container[configKey::awg] = awgConfig;
QJsonArray containers;
containers.append(container);
QJsonObject config;
config[configKey::containers] = containers;
config[configKey::defaultContainer] = "amnezia-awg";
config[configKey::description] = serverName;
config[configKey::hostName] = "test.example.com";
return config;
}
private slots:
void initTestCase()
{
QVERIFY(m_fixture.initialize(this));
}
void cleanup()
{
m_fixture.closePage();
}
void cleanupTestCase()
{
m_fixture.cleanup();
}
void pageHomeLoads()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageHome")));
QVERIFY(m_fixture.page());
}
void apiProtocolStateIsInitiallyEmpty()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageHome")));
QCOMPARE(m_fixture.page()->property("apiAvailableProtocols").toList(), QVariantList { });
QCOMPARE(m_fixture.page()->property("apiCurrentProtocol").toString(), QString());
}
void protocolDisplayName_data()
{
QTest::addColumn<QString>("protocol");
QTest::addColumn<QString>("expectedName");
QTest::newRow("awg") << QStringLiteral("awg") << QStringLiteral("AmneziaWG");
QTest::newRow("vless") << QStringLiteral("vless") << QStringLiteral("VLESS");
QTest::newRow("wireguard") << QStringLiteral("wireguard") << QStringLiteral("wireguard");
QTest::newRow("empty") << QString() << QString();
}
void protocolDisplayName()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageHome")));
QFETCH(QString, protocol);
QFETCH(QString, expectedName);
QVariant result;
const bool invoked =
QMetaObject::invokeMethod(m_fixture.page(), "protocolDisplayName", Q_RETURN_ARG(QVariant, result),
Q_ARG(QVariant, QVariant(protocol)));
QVERIFY2(invoked, "Could not invoke PageHome.protocolDisplayName()");
QCOMPARE(result.toString(), expectedName);
}
void selectsServerFromExpandedList()
{
TestCoreController *core = m_fixture.core();
QVERIFY(core);
QVERIFY(core->m_importCoreController);
QVERIFY(core->m_serversRepository);
QVERIFY(core->m_serversModel);
// Import servers
QSignalSpy importFinishedSpy(core->m_importCoreController, &ImportController::importFinished);
core->m_importCoreController->importConfig(createAwg2Config(QStringLiteral("Server 1")));
core->m_importCoreController->importConfig(createAwg2Config(QStringLiteral("Server 2")));
QCOMPARE(importFinishedSpy.count(), 2);
QCOMPARE(core->m_serversRepository->serversCount(), 2);
QCOMPARE(core->m_serversModel->rowCount(), 2);
// Find a server that is not currently selected
const QString initialDefaultServerId = core->m_serversRepository->defaultServerId();
QVERIFY(!initialDefaultServerId.isEmpty());
int targetServerIndex = -1;
QString targetServerId;
QString targetServerName;
for (int row = 0; row < core->m_serversModel->rowCount(); ++row) {
const QModelIndex index = core->m_serversModel->index(row, 0);
const QString serverId = core->m_serversModel->data(index, ServersModel::ServerIdRole).toString();
if (serverId.isEmpty() || serverId == initialDefaultServerId) {
continue;
}
targetServerIndex = row;
targetServerId = serverId;
targetServerName = core->m_serversModel->data(index, ServersModel::NameRole).toString();
break;
}
QVERIFY2(targetServerIndex >= 0, "Could not find a server different from the default server");
QVERIFY(!targetServerId.isEmpty());
QVERIFY(!targetServerName.isEmpty());
// Load PageHome
QVERIFY(m_fixture.loadPage(QStringLiteral("PageHome")));
// Find the collapsed HomeServerSummary
const QList<QQuickItem *> summaries = m_fixture.itemsOfType(QStringLiteral("HomeServerSummary"));
QVERIFY(!summaries.isEmpty());
QQuickItem *collapsedSummary = nullptr;
for (QQuickItem *summary : summaries) {
const QVariant expanded = summary->property("expanded");
if (expanded.isValid() && !expanded.toBool()) {
collapsedSummary = summary;
break;
}
}
QVERIFY2(collapsedSummary, "Collapsed HomeServerSummary was not found");
// Open the server drawer
QVERIFY(QMetaObject::invokeMethod(collapsedSummary, "expandRequested"));
QQuickItem *targetServerItem = nullptr;
QTRY_VERIFY((targetServerItem = m_fixture.visibleItem(QStringLiteral("text"), targetServerName)) != nullptr);
QVERIFY(targetServerItem);
QVERIFY(targetServerItem->isEnabled());
// Select the target server through the UI
m_fixture.click(targetServerItem);
// Verify that the selected server has changed
QTRY_COMPARE(core->m_serversRepository->defaultServerId(), targetServerId);
// Verify that the selection is reflected in ServersModel
const QModelIndex selectedServerIndex = core->m_serversModel->index(targetServerIndex, 0);
QVERIFY(selectedServerIndex.isValid());
QCOMPARE(core->m_serversModel->data(selectedServerIndex, ServersModel::IsDefaultRole).toBool(), true);
}
};
int runPageHomeTests(int argc, char *argv[])
{
PageHomeTest test;
return QTest::qExec(&test, argc, argv);
}
#include "testPageHome.moc"
@@ -0,0 +1,203 @@
#include <QQmlProperty>
#include <QSignalSpy>
#include <QTest>
#include <QUrl>
#include "ui/utils/pageEnum.h"
#include "pagesUiTestFixture.h"
class TestPageSetupWizardConfigSource : public QObject
{
Q_OBJECT
private:
PagesUiTestFixture m_fixture;
QQuickItem *findCard(const QString &text) const
{
return m_fixture.item("text", text);
}
QQuickItem *findMoreButton() const
{
const QList<QQuickItem *> buttons = m_fixture.itemsOfType(QStringLiteral("IconButtonType"));
for (QQuickItem *button : buttons) {
if (!button->isVisible() || !button->isEnabled()) {
continue;
}
const QUrl source = QQmlProperty(button, QStringLiteral("icon.source")).read().toUrl();
if (source.toString().contains(QStringLiteral("more-vertical"))) {
return button;
}
}
return nullptr;
}
private slots:
void initTestCase()
{
QVERIFY(m_fixture.initialize(this));
}
void cleanup()
{
m_fixture.closePage();
}
void cleanupTestCase()
{
m_fixture.cleanup();
}
void pageLoads()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageSetupWizardConfigSource")));
QVERIFY(m_fixture.page());
}
void connectionOptionsAreVisible()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageSetupWizardConfigSource")));
QQuickItem *amneziaVpnCard = findCard(QStringLiteral("VPN by Amnezia"));
QQuickItem *selfHostedVpnCard = findCard(QStringLiteral("Self-hosted VPN"));
QVERIFY2(amneziaVpnCard, "VPN by Amnezia card was not found");
QVERIFY2(selfHostedVpnCard, "Self-hosted VPN card was not found");
QVERIFY(amneziaVpnCard->isVisible());
QVERIFY(selfHostedVpnCard->isVisible());
QVERIFY(amneziaVpnCard->isEnabled());
QVERIFY(selfHostedVpnCard->isEnabled());
}
void restoringBackupDisablesConnectionOptions()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageSetupWizardConfigSource")));
QQuickItem *amneziaVpnCard = findCard(QStringLiteral("VPN by Amnezia"));
QQuickItem *selfHostedVpnCard = findCard(QStringLiteral("Self-hosted VPN"));
QVERIFY(amneziaVpnCard);
QVERIFY(selfHostedVpnCard);
QVERIFY(m_fixture.page()->setProperty("isRestoringBackup", true));
QVERIFY(!amneziaVpnCard->isEnabled());
QVERIFY(!selfHostedVpnCard->isEnabled());
}
void finishingBackupRestoreEnablesConnectionOptions()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageSetupWizardConfigSource")));
QQuickItem *amneziaVpnCard = findCard(QStringLiteral("VPN by Amnezia"));
QQuickItem *selfHostedVpnCard = findCard(QStringLiteral("Self-hosted VPN"));
QVERIFY(amneziaVpnCard);
QVERIFY(selfHostedVpnCard);
QVERIFY(m_fixture.page()->setProperty("isRestoringBackup", true));
QVERIFY(!amneziaVpnCard->isEnabled());
QVERIFY(!selfHostedVpnCard->isEnabled());
QVERIFY(m_fixture.page()->setProperty("isRestoringBackup", false));
QVERIFY(amneziaVpnCard->isEnabled());
QVERIFY(selfHostedVpnCard->isEnabled());
}
void selectingSelfHostedVpnOpensCredentialsPage()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageSetupWizardConfigSource")));
QQuickItem *selfHostedVpnCard = findCard(QStringLiteral("Self-hosted VPN"));
QVERIFY(selfHostedVpnCard);
QVERIFY(selfHostedVpnCard->isVisible());
QVERIFY(selfHostedVpnCard->isEnabled());
QSignalSpy navigationSpy(m_fixture.pageController(), &PageController::goToPage);
QVERIFY(navigationSpy.isValid());
m_fixture.click(selfHostedVpnCard);
QTRY_COMPARE(navigationSpy.count(), 1);
const QList<QVariant> arguments = navigationSpy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), static_cast<int>(PageLoader::PageEnum::PageSetupWizardCredentials));
}
void moreMenuCanBeOpened()
{
QVERIFY(m_fixture.loadPageFromStartPage(PageLoader::PageEnum::PageSetupWizardConfigSource));
QVERIFY(m_fixture.pageController()->isStartPageVisible());
QQuickItem *moreButton = findMoreButton();
QVERIFY2(moreButton, "Visible More button was not found");
m_fixture.click(moreButton);
QTRY_VERIFY(m_fixture.visibleItem(QStringLiteral("text"), QStringLiteral("Settings")) != nullptr);
QTRY_VERIFY(m_fixture.visibleItem(QStringLiteral("text"), QStringLiteral("Enable logs")) != nullptr);
}
void loggingSwitchCanBeToggledFromMoreMenu()
{
QVERIFY(m_fixture.loadPageFromStartPage(PageLoader::PageEnum::PageSetupWizardConfigSource));
QVERIFY(m_fixture.pageController()->isStartPageVisible());
QQuickItem *moreButton = findMoreButton();
QVERIFY2(moreButton, "Visible More button was not found");
m_fixture.click(moreButton);
QQuickItem *loggingRow = nullptr;
QTRY_VERIFY((loggingRow = m_fixture.visibleItem(QStringLiteral("text"), QStringLiteral("Enable logs"))) != nullptr);
const QList<QQuickItem *> switches = m_fixture.itemsOfType(QStringLiteral("SwitchType"));
QVERIFY2(!switches.isEmpty(), "Logging switch was not found");
QQuickItem *loggingSwitch = nullptr;
for (QQuickItem *candidate : switches) {
if (candidate->isVisible() && candidate->property("checked").isValid()) {
loggingSwitch = candidate;
break;
}
}
QVERIFY2(loggingSwitch, "Visible logging switch was not found");
const bool initialState = loggingSwitch->property("checked").toBool();
m_fixture.click(loggingRow);
QTRY_VERIFY(loggingSwitch->property("checked").toBool() != initialState);
m_fixture.click(loggingRow);
QTRY_COMPARE(loggingSwitch->property("checked").toBool(), initialState);
}
};
int runPageSetupWizardConfigSourceTests(int argc, char *argv[])
{
TestPageSetupWizardConfigSource test;
return QTest::qExec(&test, argc, argv);
}
#include "testPageSetupWizardConfigSource.moc"
+165
View File
@@ -0,0 +1,165 @@
#include <QQuickItem>
#include <QQmlProperty>
#include <QTest>
#include "pagesUiTestFixture.h"
#include "ui/utils/pageEnum.h"
class TestPageShare : public QObject
{
Q_OBJECT
private:
PagesUiTestFixture m_fixture;
QQuickItem *segment(const QString &text) const
{
for (QQuickItem *item : m_fixture.itemsOfType(QStringLiteral("SegmentType"))) {
if (item->isVisible() && item->property("text").toString() == text) {
return item;
}
}
return nullptr;
}
private slots:
void initTestCase()
{
QVERIFY(m_fixture.initialize(this));
}
void cleanup()
{
m_fixture.closePage();
}
void cleanupTestCase()
{
m_fixture.cleanup();
}
void pageLoads()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageShare")));
QVERIFY(m_fixture.page());
}
void connectionFieldsAreVisible()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageShare")));
QVERIFY(m_fixture.visibleItem(QStringLiteral("headerText"), QStringLiteral("User name")));
QVERIFY(m_fixture.visibleItem(QStringLiteral("headerText"), QStringLiteral("Server")));
QVERIFY(m_fixture.visibleItem(QStringLiteral("headerText"), QStringLiteral("Protocol")));
QVERIFY(m_fixture.visibleItem(QStringLiteral("headerText"), QStringLiteral("Connection format")));
}
void switchesBetweenConnectionAndUsers()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageShare")));
QQuickItem *connectionSegment = segment(QStringLiteral("Connection"));
QQuickItem *usersSegment = segment(QStringLiteral("Users"));
QVERIFY(connectionSegment);
QVERIFY(usersSegment);
QCOMPARE(connectionSegment->property("checked").toBool(), true);
QCOMPARE(usersSegment->property("checked").toBool(), false);
m_fixture.click(usersSegment);
QTRY_VERIFY(usersSegment->property("checked").toBool());
QTRY_VERIFY(m_fixture.visibleItem(QStringLiteral("headerText"), QStringLiteral("Users")));
QVERIFY(!m_fixture.visibleItem(QStringLiteral("headerText"), QStringLiteral("User name")));
m_fixture.click(connectionSegment);
QTRY_VERIFY(connectionSegment->property("checked").toBool());
QVERIFY(m_fixture.visibleItem(QStringLiteral("headerText"), QStringLiteral("User name")));
}
void connectionFieldsAreHiddenOnUsersTab()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageShare")));
QQuickItem *usersSegment = segment(QStringLiteral("Users"));
QVERIFY(usersSegment);
m_fixture.click(usersSegment);
QTRY_VERIFY(usersSegment->property("checked").toBool());
QVERIFY(!m_fixture.visibleItem(QStringLiteral("headerText"), QStringLiteral("User name")));
QVERIFY(!m_fixture.visibleItem(QStringLiteral("headerText"), QStringLiteral("Connection format")));
}
void opensUsersSearch()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageShare")));
QQuickItem *usersSegment = segment(QStringLiteral("Users"));
QVERIFY(usersSegment);
m_fixture.click(usersSegment);
QTRY_VERIFY(usersSegment->property("checked").toBool());
QQuickItem *searchButton = nullptr;
for (QQuickItem *candidate : m_fixture.itemsOfType(QStringLiteral("IconButtonType"))) {
const QString iconSource = QQmlProperty(candidate, QStringLiteral("icon.source")).read().toString();
if (candidate->isVisible() && candidate->isEnabled() && iconSource.endsWith(QStringLiteral("search.svg"))) {
searchButton = candidate;
break;
}
}
QVERIFY2(searchButton, "Users search button was not found");
m_fixture.click(searchButton);
QTRY_VERIFY(m_fixture.page()->property("isSearchBarVisible").toBool());
}
void navigatesToPageShareFullAccess()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageShare")));
QQuickItem *moreButton = nullptr;
for (QQuickItem *candidate : m_fixture.itemsOfType(QStringLiteral("IconButtonType"))) {
const QString iconSource = QQmlProperty(candidate, QStringLiteral("icon.source")).read().toString();
if (candidate->isVisible() && candidate->isEnabled()
&& iconSource.endsWith(QStringLiteral("more-vertical.svg"))) {
moreButton = candidate;
break;
}
}
QVERIFY2(moreButton, "More actions button was not found");
m_fixture.click(moreButton);
QQuickItem *shareFullAccessButton = nullptr;
for (QQuickItem *candidate : m_fixture.itemsOfType(QStringLiteral("ListItemType"))) {
if (candidate->isVisible() && candidate->isEnabled()
&& candidate->property("text").toString() == QStringLiteral("Share")) {
shareFullAccessButton = candidate;
break;
}
}
QVERIFY2(shareFullAccessButton, "Share full access menu item was not found");
QVERIFY(m_fixture.verifyNavigation(shareFullAccessButton, PageLoader::PageEnum::PageShareFullAccess));
}
};
int runPageShareTests(int argc, char *argv[])
{
TestPageShare test;
return QTest::qExec(&test, argc, argv);
}
#include "testPageShare.moc"
@@ -0,0 +1,123 @@
#include <QQmlComponent>
#include <QQuickItem>
#include <QTest>
#include <QUrl>
#include "pagesUiTestFixture.h"
class TestPageShareConnection : public QObject
{
Q_OBJECT
private:
PagesUiTestFixture m_fixture;
QQuickItem *m_page = nullptr;
bool loadPage()
{
if (!m_fixture.loadEmptyWindow()) {
return false;
}
QQmlComponent component(m_fixture.engine(), QUrl(QStringLiteral("qrc:/ui/qml/Pages2/PageShareConnection.qml")));
if (component.isError()) {
qWarning() << component.errors();
return false;
}
QVariantMap properties;
properties.insert("headerText", QStringLiteral("Share"));
properties.insert("configContentHeaderText", QStringLiteral("Connection settings"));
properties.insert("isSelfHostedConfig", true);
QObject *object = component.createWithInitialProperties(properties, m_fixture.engine()->rootContext());
if (!object) {
qWarning() << component.errors();
return false;
}
m_page = qobject_cast<QQuickItem *>(object);
if (!m_page) {
delete object;
return false;
}
m_page->setParentItem(m_fixture.window()->contentItem());
m_page->setWidth(m_fixture.window()->width());
m_page->setHeight(m_fixture.window()->height());
return true;
}
private slots:
void initTestCase()
{
QVERIFY(m_fixture.initialize(this));
}
void cleanup()
{
delete m_page;
m_page = nullptr;
m_fixture.closePage();
}
void cleanupTestCase()
{
m_fixture.cleanup();
}
void pageLoads()
{
QVERIFY(loadPage());
QVERIFY(m_page);
}
void shareControlsAreVisible()
{
QVERIFY(loadPage());
QVERIFY(m_fixture.visibleItem(QStringLiteral("text"), QStringLiteral("Share"), m_page));
QVERIFY(m_fixture.visibleItem(QStringLiteral("text"), QStringLiteral("Copy"), m_page));
QVERIFY(m_fixture.visibleItem(QStringLiteral("text"), QStringLiteral("Show connection settings"), m_page));
}
void opensConnectionSettings()
{
QVERIFY(loadPage());
QCOMPARE(m_page->width(), m_fixture.window()->width());
QCOMPARE(m_page->height(), m_fixture.window()->height());
QQuickItem *settingsButton = m_fixture.visibleItem(QStringLiteral("text"), QStringLiteral("Show connection settings"), m_page);
QVERIFY(settingsButton);
QVERIFY(settingsButton->isEnabled());
QVERIFY(settingsButton->width() > 0);
QVERIFY(settingsButton->height() > 0);
m_fixture.click(settingsButton);
QTRY_VERIFY(m_fixture.visibleItem(QStringLiteral("headerText"), QStringLiteral("Connection settings")));
}
void nativeConfigStringButtonVisibility()
{
QVERIFY(loadPage());
QQuickItem *copyStringButton = m_fixture.visibleItem(QStringLiteral("text"), QStringLiteral("Copy config string"), m_page);
QVERIFY(!copyStringButton);
}
};
int runPageShareConnectionTests(int argc, char *argv[])
{
TestPageShareConnection test;
return QTest::qExec(&test, argc, argv);
}
#include "testPageShareConnection.moc"
@@ -0,0 +1,98 @@
#include <QQuickItem>
#include <QTest>
#include "pagesUiTestFixture.h"
class TestPageShareFullAccess : public QObject
{
Q_OBJECT
private:
PagesUiTestFixture m_fixture;
bool containsVisibleText(const QString &text) const
{
for (QQuickItem *item : m_fixture.items()) {
const QString itemText = item->property("text").toString();
if (item->isVisible() && itemText.contains(text)) {
return true;
}
}
return false;
}
private slots:
void initTestCase()
{
QVERIFY(m_fixture.initialize(this));
}
void cleanup()
{
m_fixture.closePage();
}
void cleanupTestCase()
{
m_fixture.cleanup();
}
void pageLoads()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageShareFullAccess")));
QVERIFY(m_fixture.page());
}
void pageTitleIsVisible()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageShareFullAccess")));
QQuickItem *title = m_fixture.visibleItem(QStringLiteral("text"), QStringLiteral("Full access to the server and VPN"));
QVERIFY2(title, "Page title was not found");
}
void fullAccessWarningIsVisible()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageShareFullAccess")));
QVERIFY(containsVisibleText(QStringLiteral("We recommend that you use full access")));
QVERIFY(containsVisibleText(QStringLiteral("they can remove and add protocols and services")));
}
void serverSelectorIsVisible()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageShareFullAccess")));
QQuickItem *serverSelector = nullptr;
for (QQuickItem *item : m_fixture.itemsOfType(QStringLiteral("DropDownType"))) {
if (item->isVisible() && item->property("descriptionText").toString() == QStringLiteral("Server")) {
serverSelector = item;
break;
}
}
QVERIFY2(serverSelector, "Server selector was not found");
QVERIFY(serverSelector->isEnabled());
}
void shareButtonIsVisibleAndEnabled()
{
QVERIFY(m_fixture.loadPage(QStringLiteral("PageShareFullAccess")));
QQuickItem *shareButton = m_fixture.visibleItem(QStringLiteral("text"), QStringLiteral("Share"));
QVERIFY2(shareButton, "Share button was not found");
QVERIFY(shareButton->isEnabled());
}
};
int runPageShareFullAccessTests(int argc, char *argv[])
{
TestPageShareFullAccess test;
return QTest::qExec(&test, argc, argv);
}
#include "testPageShareFullAccess.moc"
+9 -14
View File
@@ -176,24 +176,19 @@ private slots:
}
}
void testDevGatewaySignals()
{
QSignalSpy devGatewayConfigChangedSpy(m_coreController->m_settingsUiController,
&SettingsUiController::devGatewayConfigChanged);
void testGatewayEndpointSignals() {
QSignalSpy gatewayEndpointChangedSpy(m_coreController->m_settingsUiController, &SettingsUiController::gatewayEndpointChanged);
QSignalSpy devGatewayEnvChangedSpy(m_coreController->m_settingsUiController, &SettingsUiController::devGatewayEnvChanged);
QString initialEndpoint = m_coreController->m_settingsController->getGatewayEndpoint();
QString newEndpoint = "https://test-gateway.example.com";
QString newProxyStorages = "https://storage-1.example.com, https://storage-2.example.com";
QString newPublicKey = "dGVzdC1rZXk=";
m_coreController->m_settingsUiController->saveDevGatewayConfig(newEndpoint, newProxyStorages, newPublicKey);
QVERIFY2(devGatewayConfigChangedSpy.count() == 1, "devGatewayConfigChanged signal should be emitted");
QVERIFY2(m_coreController->m_settingsUiController->getDevGatewayEndpoint() == newEndpoint,
"Dev gateway endpoint should be available in SettingsUiController");
QVERIFY2(m_coreController->m_settingsUiController->getDevGatewayProxyStorages() == newProxyStorages,
"Dev gateway proxy storages should be available in SettingsUiController");
QVERIFY2(m_coreController->m_settingsUiController->getDevGatewayPublicKey() == newPublicKey,
"Dev gateway public key should be available in SettingsUiController");
m_coreController->m_settingsUiController->setGatewayEndpoint(newEndpoint);
QVERIFY2(gatewayEndpointChangedSpy.count() == 1, "gatewayEndpointChanged signal should be emitted");
QVERIFY2(gatewayEndpointChangedSpy.at(0).at(0).toString() == newEndpoint, "gatewayEndpointChanged should emit correct endpoint");
QVERIFY2(m_coreController->m_settingsController->getGatewayEndpoint() == newEndpoint, "Gateway endpoint should be updated in SettingsController");
QVERIFY2(m_coreController->m_settingsUiController->getGatewayEndpoint() == newEndpoint, "Gateway endpoint should be available in SettingsUiController");
QVERIFY2(m_coreController->m_appSettingsRepository->getGatewayEndpoint() == newEndpoint, "Gateway endpoint should be available in SecureAppSettingsRepository");
bool initialDevEnv = m_coreController->m_settingsController->isDevGatewayEnv();
m_coreController->m_settingsUiController->toggleDevGatewayEnv(!initialDevEnv);
+1 -1
View File
@@ -75,7 +75,7 @@ void TestXrayConfigModel::isValidSni_data()
{
QTest::addColumn<QString>("sni");
QTest::addColumn<bool>("valid");
QTest::newRow("empty") << "" << false;
QTest::newRow("empty") << "" << true;
QTest::newRow("domain") << "www.example.com" << true;
QTest::newRow("ipv4") << "203.0.113.10" << true;
QTest::newRow("star") << "*" << false;
+9 -13
View File
@@ -296,26 +296,21 @@ bool SettingsUiController::isDevModeEnabled()
return m_settingsController->isDevModeEnabled();
}
QString SettingsUiController::getDevGatewayEndpoint()
void SettingsUiController::resetGatewayEndpoint()
{
return m_settingsController->devGatewayEndpoint();
m_settingsController->resetGatewayEndpoint();
emit gatewayEndpointChanged(m_settingsController->getGatewayEndpoint());
}
QString SettingsUiController::getDevGatewayProxyStorages()
void SettingsUiController::setGatewayEndpoint(const QString &endpoint)
{
return m_settingsController->devGatewayProxyStorages();
m_settingsController->setGatewayEndpoint(endpoint);
emit gatewayEndpointChanged(endpoint);
}
QString SettingsUiController::getDevGatewayPublicKey()
QString SettingsUiController::getGatewayEndpoint()
{
return m_settingsController->devGatewayPublicKey();
}
void SettingsUiController::saveDevGatewayConfig(const QString &endpoint, const QString &proxyStorages,
const QString &publicKey)
{
m_settingsController->setDevGatewayConfig(endpoint, proxyStorages, publicKey);
emit devGatewayConfigChanged();
return m_settingsController->getGatewayEndpoint();
}
bool SettingsUiController::isDevGatewayEnv()
@@ -326,6 +321,7 @@ bool SettingsUiController::isDevGatewayEnv()
void SettingsUiController::toggleDevGatewayEnv(bool enabled)
{
m_settingsController->toggleDevGatewayEnv(enabled);
emit gatewayEndpointChanged(m_settingsController->getGatewayEndpoint());
emit devGatewayEnvChanged(enabled);
}
+5 -8
View File
@@ -25,9 +25,7 @@ public:
Q_PROPERTY(bool strictKillSwitchEnabled READ isStrictKillSwitchEnabled WRITE toggleStrictKillSwitch NOTIFY strictKillSwitchEnabledChanged)
Q_PROPERTY(bool isDevModeEnabled READ isDevModeEnabled NOTIFY devModeEnabled)
Q_PROPERTY(QString devGatewayEndpoint READ getDevGatewayEndpoint NOTIFY devGatewayConfigChanged)
Q_PROPERTY(QString devGatewayProxyStorages READ getDevGatewayProxyStorages NOTIFY devGatewayConfigChanged)
Q_PROPERTY(QString devGatewayPublicKey READ getDevGatewayPublicKey NOTIFY devGatewayConfigChanged)
Q_PROPERTY(QString gatewayEndpoint READ getGatewayEndpoint WRITE setGatewayEndpoint NOTIFY gatewayEndpointChanged)
Q_PROPERTY(bool isDevGatewayEnv READ isDevGatewayEnv WRITE toggleDevGatewayEnv NOTIFY devGatewayEnvChanged)
Q_PROPERTY(bool isHomeAdLabelVisible READ isHomeAdLabelVisible NOTIFY isHomeAdLabelVisibleChanged)
@@ -92,10 +90,9 @@ public slots:
void enableDevMode();
bool isDevModeEnabled();
QString getDevGatewayEndpoint();
QString getDevGatewayProxyStorages();
QString getDevGatewayPublicKey();
void saveDevGatewayConfig(const QString &endpoint, const QString &proxyStorages, const QString &publicKey);
void resetGatewayEndpoint();
void setGatewayEndpoint(const QString &endpoint);
QString getGatewayEndpoint();
bool isDevGatewayEnv();
void toggleDevGatewayEnv(bool enabled);
@@ -129,7 +126,7 @@ signals:
void onNotificationStateChanged();
void devModeEnabled();
void devGatewayConfigChanged();
void gatewayEndpointChanged(const QString &endpoint);
void devGatewayEnvChanged(bool enabled);
void activityPaused();
@@ -58,73 +58,6 @@ void AwgConfigModel::setPort(const QString &value)
emit changed();
}
QString AwgConfigModel::cascadeEndpoint() const
{
return m_protocolConfig.serverConfig.cascadeEndpoint;
}
void AwgConfigModel::setCascadeEndpoint(const QString &value)
{
if (m_protocolConfig.serverConfig.cascadeEndpoint == value) {
return;
}
m_protocolConfig.serverConfig.cascadeEndpoint = value;
emit changed();
}
QString AwgConfigModel::cascadePort() const
{
return m_protocolConfig.serverConfig.cascadePort;
}
void AwgConfigModel::setCascadePort(const QString &value)
{
if (m_protocolConfig.serverConfig.cascadePort == value) {
return;
}
m_protocolConfig.serverConfig.cascadePort = value;
emit changed();
}
QString AwgConfigModel::clientHostName() const
{
return m_protocolConfig.clientConfig->hostName;
}
QString AwgConfigModel::clientPort() const
{
const int port = m_protocolConfig.clientConfig->port;
return port > 0 ? QString::number(port) : QString();
}
QString AwgConfigModel::clientCascadeEndpoint() const
{
return m_protocolConfig.clientConfig->cascadeEndpoint;
}
void AwgConfigModel::setClientCascadeEndpoint(const QString &value)
{
if (m_protocolConfig.clientConfig->cascadeEndpoint == value) {
return;
}
m_protocolConfig.clientConfig->setCascade(value, m_protocolConfig.clientConfig->cascadePort);
emit changed();
}
QString AwgConfigModel::clientCascadePort() const
{
return m_protocolConfig.clientConfig->cascadePort;
}
void AwgConfigModel::setClientCascadePort(const QString &value)
{
if (m_protocolConfig.clientConfig->cascadePort == value) {
return;
}
m_protocolConfig.clientConfig->setCascade(m_protocolConfig.clientConfig->cascadeEndpoint, value);
emit changed();
}
QString AwgConfigModel::clientMtu() const
{
return m_protocolConfig.clientConfig->mtu;
@@ -776,15 +709,8 @@ amnezia::AwgProtocolConfig AwgConfigModel::getProtocolConfig()
{
bool serverSettingsChanged = !m_protocolConfig.serverConfig.hasEqualServerSettings(m_originalProtocolConfig.serverConfig);
const auto &serverConfig = m_protocolConfig.serverConfig;
const auto &originalServerConfig = m_originalProtocolConfig.serverConfig;
const bool cascadeChanged = serverConfig.cascadeEndpoint != originalServerConfig.cascadeEndpoint
|| serverConfig.cascadePort != originalServerConfig.cascadePort;
if (serverSettingsChanged) {
m_protocolConfig.clearClientConfig();
} else if (cascadeChanged) {
m_protocolConfig.clientConfig->setCascade(serverConfig.cascadeEndpoint, serverConfig.cascadePort);
}
return m_protocolConfig;
@@ -14,13 +14,7 @@ class AwgConfigModel : public QObject
Q_PROPERTY(QString subnetAddress READ subnetAddress WRITE setSubnetAddress NOTIFY changed)
Q_PROPERTY(QString port READ port WRITE setPort NOTIFY changed)
Q_PROPERTY(QString cascadeEndpoint READ cascadeEndpoint WRITE setCascadeEndpoint NOTIFY changed)
Q_PROPERTY(QString cascadePort READ cascadePort WRITE setCascadePort NOTIFY changed)
Q_PROPERTY(QString clientMtu READ clientMtu WRITE setClientMtu NOTIFY changed)
Q_PROPERTY(QString clientHostName READ clientHostName NOTIFY changed)
Q_PROPERTY(QString clientPort READ clientPort NOTIFY changed)
Q_PROPERTY(QString clientCascadeEndpoint READ clientCascadeEndpoint WRITE setClientCascadeEndpoint NOTIFY changed)
Q_PROPERTY(QString clientCascadePort READ clientCascadePort WRITE setClientCascadePort NOTIFY changed)
Q_PROPERTY(QString clientJunkPacketCount READ clientJunkPacketCount WRITE setClientJunkPacketCount NOTIFY changed)
Q_PROPERTY(QString clientJunkPacketMinSize READ clientJunkPacketMinSize WRITE setClientJunkPacketMinSize NOTIFY changed)
Q_PROPERTY(QString clientJunkPacketMaxSize READ clientJunkPacketMaxSize WRITE setClientJunkPacketMaxSize NOTIFY changed)
@@ -75,21 +69,6 @@ public:
QString port() const;
void setPort(const QString &value);
QString cascadeEndpoint() const;
void setCascadeEndpoint(const QString &value);
QString cascadePort() const;
void setCascadePort(const QString &value);
QString clientHostName() const;
QString clientPort() const;
QString clientCascadeEndpoint() const;
void setClientCascadeEndpoint(const QString &value);
QString clientCascadePort() const;
void setClientCascadePort(const QString &value);
QString clientMtu() const;
void setClientMtu(const QString &value);
@@ -40,73 +40,6 @@ void WireGuardConfigModel::setPort(const QString &value)
emit changed();
}
QString WireGuardConfigModel::cascadeEndpoint() const
{
return m_protocolConfig.serverConfig.cascadeEndpoint;
}
void WireGuardConfigModel::setCascadeEndpoint(const QString &value)
{
if (m_protocolConfig.serverConfig.cascadeEndpoint == value) {
return;
}
m_protocolConfig.serverConfig.cascadeEndpoint = value;
emit changed();
}
QString WireGuardConfigModel::cascadePort() const
{
return m_protocolConfig.serverConfig.cascadePort;
}
void WireGuardConfigModel::setCascadePort(const QString &value)
{
if (m_protocolConfig.serverConfig.cascadePort == value) {
return;
}
m_protocolConfig.serverConfig.cascadePort = value;
emit changed();
}
QString WireGuardConfigModel::clientHostName() const
{
return m_protocolConfig.clientConfig->hostName;
}
QString WireGuardConfigModel::clientPort() const
{
const int port = m_protocolConfig.clientConfig->port;
return port > 0 ? QString::number(port) : QString();
}
QString WireGuardConfigModel::clientCascadeEndpoint() const
{
return m_protocolConfig.clientConfig->cascadeEndpoint;
}
void WireGuardConfigModel::setClientCascadeEndpoint(const QString &value)
{
if (m_protocolConfig.clientConfig->cascadeEndpoint == value) {
return;
}
m_protocolConfig.clientConfig->setCascade(value, m_protocolConfig.clientConfig->cascadePort);
emit changed();
}
QString WireGuardConfigModel::clientCascadePort() const
{
return m_protocolConfig.clientConfig->cascadePort;
}
void WireGuardConfigModel::setClientCascadePort(const QString &value)
{
if (m_protocolConfig.clientConfig->cascadePort == value) {
return;
}
m_protocolConfig.clientConfig->setCascade(m_protocolConfig.clientConfig->cascadeEndpoint, value);
emit changed();
}
QString WireGuardConfigModel::clientMtu() const
{
if (m_protocolConfig.clientConfig.has_value()) {
@@ -163,15 +96,8 @@ amnezia::WireGuardProtocolConfig WireGuardConfigModel::getProtocolConfig()
{
bool serverSettingsChanged = !m_protocolConfig.serverConfig.hasEqualServerSettings(m_originalProtocolConfig.serverConfig);
const auto &serverConfig = m_protocolConfig.serverConfig;
const auto &originalServerConfig = m_originalProtocolConfig.serverConfig;
const bool cascadeChanged = serverConfig.cascadeEndpoint != originalServerConfig.cascadeEndpoint
|| serverConfig.cascadePort != originalServerConfig.cascadePort;
if (serverSettingsChanged) {
m_protocolConfig.clearClientConfig();
} else if (cascadeChanged) {
m_protocolConfig.clientConfig->setCascade(serverConfig.cascadeEndpoint, serverConfig.cascadePort);
}
return m_protocolConfig;
@@ -14,13 +14,7 @@ class WireGuardConfigModel : public QObject
Q_PROPERTY(QString subnetAddress READ subnetAddress WRITE setSubnetAddress NOTIFY changed)
Q_PROPERTY(QString port READ port WRITE setPort NOTIFY changed)
Q_PROPERTY(QString cascadeEndpoint READ cascadeEndpoint WRITE setCascadeEndpoint NOTIFY changed)
Q_PROPERTY(QString cascadePort READ cascadePort WRITE setCascadePort NOTIFY changed)
Q_PROPERTY(QString clientMtu READ clientMtu WRITE setClientMtu NOTIFY changed)
Q_PROPERTY(QString clientHostName READ clientHostName NOTIFY changed)
Q_PROPERTY(QString clientPort READ clientPort NOTIFY changed)
Q_PROPERTY(QString clientCascadeEndpoint READ clientCascadeEndpoint WRITE setClientCascadeEndpoint NOTIFY changed)
Q_PROPERTY(QString clientCascadePort READ clientCascadePort WRITE setClientCascadePort NOTIFY changed)
public:
explicit WireGuardConfigModel(QObject *parent = nullptr);
@@ -31,21 +25,6 @@ public:
QString port() const;
void setPort(const QString &value);
QString cascadeEndpoint() const;
void setCascadeEndpoint(const QString &value);
QString cascadePort() const;
void setCascadePort(const QString &value);
QString clientHostName() const;
QString clientPort() const;
QString clientCascadeEndpoint() const;
void setClientCascadeEndpoint(const QString &value);
QString clientCascadePort() const;
void setClientCascadePort(const QString &value);
QString clientMtu() const;
void setClientMtu(const QString &value);
+10 -2
View File
@@ -759,7 +759,7 @@ QStringList XrayConfigModel::transportOptions()
QStringList XrayConfigModel::fingerprintOptions()
{
return { "chrome", "firefox", "safari", "ios", "android", "edge", "360", "qq", "random" };
return { "hellochrome_120", "chrome", "firefox", "safari", "ios", "android", "edge", "360", "qq", "random" };
}
QStringList XrayConfigModel::alpnOptions()
@@ -833,6 +833,11 @@ QString XrayConfigModel::portDefault()
return QString::fromLatin1(protocols::xray::defaultPort);
}
QString XrayConfigModel::sniDefault()
{
return QString::fromLatin1(protocols::xray::defaultSni);
}
QString XrayConfigModel::xhttpHostDefault()
{
return QString::fromLatin1(protocols::xray::defaultXhttpHost);
@@ -928,7 +933,10 @@ bool XrayConfigModel::isValidHost(const QString &host)
bool XrayConfigModel::isValidSni(const QString &sni)
{
const QString t = sni.trimmed();
if (t.isEmpty() || t.contains(QLatin1Char('*'))) {
if (t.isEmpty()) {
return true;
}
if (t.contains(QLatin1Char('*'))) {
return false;
}
return isValidSingleHost(t);
@@ -251,6 +251,7 @@ public:
Q_INVOKABLE static QString mkcpDefaultCwndMultiplier();
Q_INVOKABLE static QString portDefault();
Q_INVOKABLE static QString sniDefault();
Q_INVOKABLE static QString xhttpHostDefault();
Q_INVOKABLE static QString xhttpUplinkChunkSizeDefault();
Q_INVOKABLE static QString scMaxEachPostBytesMinDefault();
@@ -1,87 +0,0 @@
import QtQuick
import QtQuick.Layouts
import MtProxyConfig 1.0
import "../Controls2"
import "../Controls2/TextTypes"
ColumnLayout {
id: root
property string endpoint
property string port
property string endpointPlaceholder
property string portPlaceholder
property bool warningVisible: false
property var scroller: null
signal endpointEdited(string text)
signal portEdited(string text)
spacing: 12
H2TextType {
Layout.fillWidth: true
Layout.topMargin: 28
Layout.leftMargin: 16
Layout.rightMargin: 16
text: qsTr("Cascade connection")
}
NotificationType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
visible: root.warningVisible
variant: NotificationType.Warning
text: qsTr("Cascade endpoint and port are the address and port of the entry server that forwards traffic to this server. New client configs will connect to them instead of this server's address and port. Existing configs are not changed")
}
TextFieldType {
id: endpointTextField
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("Cascade endpoint")
textField.placeholderText: root.endpointPlaceholder
textField.text: root.endpoint
textField.maximumLength: 253
textField.validator: PublicHostInputValidator {}
textField.onTextEdited: root.endpointEdited(textField.text.trim())
textField.onActiveFocusChanged: {
if (textField.activeFocus && root.scroller) {
root.scroller.scrollToItem(endpointTextField)
}
}
}
TextFieldType {
id: portTextField
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("Cascade port")
textField.placeholderText: root.portPlaceholder
textField.text: root.port
textField.maximumLength: 5
textField.validator: IntValidator { bottom: 1; top: 65535 }
textField.onTextEdited: root.portEdited(textField.text)
textField.onActiveFocusChanged: {
if (textField.activeFocus && root.scroller) {
root.scroller.scrollToItem(portTextField)
}
}
}
}
@@ -118,7 +118,6 @@ Item {
enabled: d.scrolled > 0
acceptedButtons: Qt.AllButtons
hoverEnabled: true
}
IconButtonType {
+10
View File
@@ -15,6 +15,16 @@ TabButton {
readonly property int maximumHorizontalPadding: root.size === TabButtonType.Large ? 24 : 10
implicitWidth: implicitContentWidth + 2 * root.maximumHorizontalPadding
width: {
if (!root.visible) {
return 0
}
const tabBar = root.TabBar.tabBar
if (!tabBar || tabBar.visibleTabCount === undefined) {
return implicitWidth
}
return tabBar.availableWidth / Math.max(1, tabBar.visibleTabCount)
}
implicitHeight: root.size === TabButtonType.Large ? 48 : 36
horizontalPadding: Math.max(4, Math.min(root.maximumHorizontalPadding, (root.width - implicitContentWidth) / 2))
+11
View File
@@ -4,6 +4,17 @@ import QtQuick.Controls
TabBar {
id: root
readonly property int visibleTabCount: {
let visibleCount = 0
for (let i = 0; i < root.count; ++i) {
const tab = root.itemAt(i)
if (tab && tab.visible) {
++visibleCount
}
}
return visibleCount
}
spacing: 0
background: null
}
+11 -23
View File
@@ -54,25 +54,14 @@ PageType {
Layout.fillWidth: true
headerText: qsTr("Gateway endpoint")
textField.text: SettingsController.devGatewayEndpoint
}
textField.text: SettingsController.gatewayEndpoint
TextFieldType {
id: gatewayProxyStoragesField
buttonImageSource: textField.text !== "" ? "qrc:/images/controls/refresh-cw.svg" : ""
Layout.fillWidth: true
headerText: qsTr("Gateway proxy storages")
textField.text: SettingsController.devGatewayProxyStorages
}
TextFieldType {
id: gatewayPublicKeyField
Layout.fillWidth: true
headerText: qsTr("Gateway public key")
textField.text: SettingsController.devGatewayPublicKey
clickedFunc: function() {
SettingsController.resetGatewayEndpoint()
gatewayEndpointField.textField.text = SettingsController.gatewayEndpoint
}
}
ButtonType {
@@ -83,12 +72,11 @@ PageType {
text: qsTr("Save")
onClicked: {
SettingsController.saveDevGatewayConfig(gatewayEndpointField.textField.text.trim(),
gatewayProxyStoragesField.textField.text.trim(),
gatewayPublicKeyField.textField.text.trim())
gatewayEndpointField.textField.text = SettingsController.devGatewayEndpoint
gatewayProxyStoragesField.textField.text = SettingsController.devGatewayProxyStorages
gatewayPublicKeyField.textField.text = SettingsController.devGatewayPublicKey
var trimmed = gatewayEndpointField.textField.text.replace(/^\s+|\s+$/g, '')
gatewayEndpointField.textField.text = trimmed
if (trimmed !== SettingsController.gatewayEndpoint) {
SettingsController.gatewayEndpoint = trimmed
}
PageController.showNotificationMessage(qsTr("Settings saved"))
}
}
@@ -271,20 +271,6 @@ PageType {
}
}
CascadeSettings {
Layout.fillWidth: true
scroller: smartScroll
endpoint: AwgConfigModel.clientCascadeEndpoint
port: AwgConfigModel.clientCascadePort
endpointPlaceholder: AwgConfigModel.clientHostName
portPlaceholder: AwgConfigModel.clientPort
onEndpointEdited: (text) => { AwgConfigModel.clientCascadeEndpoint = text }
onPortEdited: (text) => { AwgConfigModel.clientCascadePort = text }
}
H2TextType {
Layout.fillWidth: true
Layout.topMargin: 28
@@ -464,23 +464,6 @@ PageType {
}
}
}
CascadeSettings {
Layout.fillWidth: true
enabled: root.isEnabled
warningVisible: true
scroller: smartScroll
endpoint: AwgConfigModel.cascadeEndpoint
port: AwgConfigModel.cascadePort
endpointPlaceholder: ServersUiController.serverHostName(ServersUiController.processedServerId)
portPlaceholder: AwgConfigModel.port
onEndpointEdited: (text) => { AwgConfigModel.cascadeEndpoint = text }
onPortEdited: (text) => { AwgConfigModel.cascadePort = text }
}
}
}
@@ -60,18 +60,6 @@ PageType {
checkEmptyText: true
}
CascadeSettings {
Layout.fillWidth: true
endpoint: WireGuardConfigModel.clientCascadeEndpoint
port: WireGuardConfigModel.clientCascadePort
endpointPlaceholder: WireGuardConfigModel.clientHostName
portPlaceholder: WireGuardConfigModel.clientPort
onEndpointEdited: (text) => { WireGuardConfigModel.clientCascadeEndpoint = text }
onPortEdited: (text) => { WireGuardConfigModel.clientCascadePort = text }
}
H2TextType {
Layout.fillWidth: true
Layout.topMargin: 40
@@ -77,20 +77,6 @@ PageType {
checkEmptyText: true
}
CascadeSettings {
Layout.fillWidth: true
warningVisible: true
endpoint: WireGuardConfigModel.cascadeEndpoint
port: WireGuardConfigModel.cascadePort
endpointPlaceholder: ServersUiController.serverHostName(ServersUiController.processedServerId)
portPlaceholder: WireGuardConfigModel.port
onEndpointEdited: (text) => { WireGuardConfigModel.cascadeEndpoint = text }
onPortEdited: (text) => { WireGuardConfigModel.cascadePort = text }
}
}
}
@@ -159,6 +159,7 @@ PageType {
id: sniFieldTls
Layout.fillWidth: true
headerText: qsTr("Server Name (SNI)")
placeholderText: XrayConfigModel.sniDefault()
textField.text: XrayConfigModel.sni
textField.validator: RegularExpressionValidator { regularExpression: /^[A-Za-z0-9._-]*$/ }
textField.onTextEdited: XrayConfigModel.sni = textField.text
@@ -215,6 +216,7 @@ PageType {
id: sniFieldReality
Layout.fillWidth: true
headerText: qsTr("Server Name (SNI)")
placeholderText: XrayConfigModel.sniDefault()
textField.text: XrayConfigModel.sni
textField.validator: RegularExpressionValidator { regularExpression: /^[A-Za-z0-9._-]*$/ }
textField.onTextEdited: XrayConfigModel.sni = textField.text
@@ -160,8 +160,6 @@ PageType {
width: listView.width
implicitHeight: appItem.implicitHeight
enabled: root.pageEnabled
ListItemType {
id: appItem
+18 -28
View File
@@ -21,30 +21,13 @@ PageType {
readonly property int pageSettingsServerServices: 1
readonly property int pageSettingsServerData: 2
readonly property var tabTitles: [qsTr("Protocols"), qsTr("Services"), qsTr("Management")]
readonly property var availableTabs: {
const tabs = []
if (protocolsPage.installedProtocolsCount > 0) {
tabs.push(root.pageSettingsServerProtocols)
}
if (servicesPage.installedServicesCount > 0) {
tabs.push(root.pageSettingsServerServices)
}
tabs.push(root.pageSettingsServerData)
return tabs
}
property int currentTab: (ServersUiController.isServerFromApi(ServersUiController.processedServerId)
&& !ServersUiController.serverHasInstalledContainers(ServersUiController.processedServerId)) ?
root.pageSettingsServerData : root.pageSettingsServerProtocols
property var processedServer
Connections {
target: PageController
function onGoToPageSettingsServerServices() {
root.currentTab = root.pageSettingsServerServices
tabBar.setCurrentIndex(root.pageSettingsServerServices)
}
}
@@ -128,18 +111,25 @@ PageType {
Layout.leftMargin: 16
Layout.rightMargin: 16
currentIndex: root.availableTabs.indexOf(root.currentTab)
currentIndex: (ServersUiController.isServerFromApi(ServersUiController.processedServerId)
&& !ServersUiController.serverHasInstalledContainers(ServersUiController.processedServerId)) ?
root.pageSettingsServerData : root.pageSettingsServerProtocols
Repeater {
model: root.availableTabs
TabButtonType {
id: protocolsTab
visible: protocolsPage.installedProtocolsCount > 0
text: qsTr("Protocols")
}
TabButtonType {
required property int modelData
TabButtonType {
id: servicesTab
visible: servicesPage.installedServicesCount > 0
text: qsTr("Services")
}
text: root.tabTitles[modelData]
onClicked: root.currentTab = modelData
}
TabButtonType {
id: dataTab
text: qsTr("Management")
}
}
@@ -150,7 +140,7 @@ PageType {
Layout.fillHeight: true
Layout.topMargin: 24
currentIndex: root.currentTab
currentIndex: tabBar.currentIndex
PageSettingsServerProtocols {
id: protocolsPage
-3
View File
@@ -244,9 +244,6 @@ PageType {
}
function onBackgroundPurchaseCompleted(message) {
if (!root.isTabBarShown) {
PageController.goToPageHome()
}
PageController.showNotificationMessage(message)
}
-1
View File
@@ -1,7 +1,6 @@
<RCC>
<qresource prefix="/ui/qml">
<file>Components/CopyableValueRow.qml</file>
<file>Components/CascadeSettings.qml</file>
<file>Components/ConfigContentSheet.qml</file>
<file>Components/QrCodeCard.qml</file>
<file>Components/ShareClientInfoSheet.qml</file>
+1 -1
View File
@@ -34,7 +34,7 @@ class AmneziaVPN(ConanFile):
self.requires("v2ray-rules-dat/202603162227")
if has_ne:
self.requires("awg-apple/3.1.5")
self.requires("awg-apple/3.1.4")
self.requires("hev-socks5-tunnel/2.15.0", options={"as_framework": True})
self.requires("openvpnadapter/1.0.0")
-3
View File
@@ -35,7 +35,6 @@ while [[ $# -gt 0 ]]; do
--aab) : ${BUILD_AAB=true}; shift ;;
--apk) : ${BUILD_APK=true}; shift ;;
--play) : ${BUILD_PLAY=true}; shift ;;
--configure-only) : ${CONFIGURE_ONLY=true}; shift ;;
--help|-h|?)
echo "Usage: $0 [options]"
echo " Options:"
@@ -50,7 +49,6 @@ while [[ $# -gt 0 ]]; do
echo " --aab - whether to build AAB. only applicable to Android"
echo " --apk - whether to build APK. use with --play. only applicable to Android"
echo " --play - build Play flavor (Google Play Billing). use with --aab or --apk. only applicable to Android"
echo " --configure-only - run CMake configure and skip the build"
exit 0
;;
*) echo "Unknown arg \"$1\". Use $0 -h to get help"; exit 1 ;;
@@ -219,7 +217,6 @@ if [[ -n "$FORCE" ]]; then
fi
run_traced cmake -S "$SOURCE_PATH" -B "$BUILD_PATH" "${args[@]}"
[[ -n "$CONFIGURE_ONLY" ]] && exit 0
run_traced cmake --build "$BUILD_PATH" --config "$CMAKE_BUILD_TYPE" --parallel "$JOBS"
if [[ -n "$BUILD_AAB" ]]; then
-81
View File
@@ -1,81 +0,0 @@
def cmake_cache_value(name)
File.read("../build/CMakeCache.txt")[/^#{name}:\w+=(.*)$/, 1]
end
def archive_build(app_platform, profile_platform)
app_identifier = cmake_cache_value("BUILD_IOS_APP_IDENTIFIER")
build_app(
project: "build/AmneziaVPN.xcodeproj",
scheme: "AmneziaVPN",
configuration: "Release",
export_method: "app-store",
export_options: {
signingStyle: "manual",
provisioningProfiles: {
app_identifier => cmake_cache_value("CLIENT_#{profile_platform}_PROVISIONING_PROFILE_SPECIFIER"),
"#{app_identifier}.network-extension" => cmake_cache_value("CLIENT_#{profile_platform}_NE_PROVISIONING_PROFILE_SPECIFIER")
}
},
output_directory: "build/#{app_platform}",
output_name: "AmneziaVPN"
)
end
def authorize_app_store_connect
key = ENV.fetch("APPSTORE_CONNECT_PRIVATE_KEY")
app_store_connect_api_key(
key_id: ENV.fetch("APPSTORE_CONNECT_KEY_ID"),
issuer_id: ENV.fetch("APPSTORE_CONNECT_ISSUER_ID"),
key_content: key,
is_key_content_base64: !key.include?("PRIVATE KEY")
)
end
def upload_to_external_testers(package)
authorize_app_store_connect
upload_to_testflight(
**package,
distribute_external: true,
groups: ["test-external"],
changelog: "Improve stability"
)
rescue Spaceship::UnexpectedResponse => e
raise unless e.message.include?("already in beta review")
UI.important(e.message)
end
platform :ios do
lane :archive do
archive_build("ios", "IOS")
end
lane :testflight_upload do
upload_to_external_testers(ipa: "build/ios/AmneziaVPN.ipa")
end
end
platform :mac do
lane :archive do
archive_build("osx", "MACOS")
end
lane :testflight_upload do
upload_to_external_testers(app_platform: "osx", pkg: "build/osx/AmneziaVPN.pkg")
end
end
platform :android do
lane :play_upload do
upload_to_play_store(
package_name: "org.amnezia.vpn",
track: "beta",
release_status: "draft",
aab_paths: Dir["../build/android/*_play.aab"].map { |path| File.expand_path(path) },
json_key_data: ENV.fetch("GOOGLE_PLAY_SERVICE_ACCOUNT_JSON"),
skip_upload_metadata: true,
skip_upload_changelogs: true,
skip_upload_images: true,
skip_upload_screenshots: true
)
end
end
-2
View File
@@ -1,2 +0,0 @@
s/\(_ENDPOINT\\\{0,1\}=\\\{0,1\}"\)[^"]*/\1***/g
s/\(_AGW_PUBLIC_KEY_B64[\\"=]*\)[A-Za-z0-9+\/=]*/\1***/g
+2 -2
View File
@@ -9,7 +9,7 @@ import os
class AwgApple(ConanFile):
name = "awg-apple"
version = "3.1.5"
version = "3.1.4"
settings = "os", "arch", "compiler"
@property
@@ -45,7 +45,7 @@ class AwgApple(ConanFile):
def source(self):
get(self, f"https://github.com/amnezia-vpn/amneziawg-apple/archive/refs/tags/v{self.version}.zip",
sha256="b3bd3680fa966dae67162c261e1b0a42235a0bd706ec6ea67cc04e707ef3b7a8", strip_root=True
sha256="09d7b760d18232fdf121ed2286b2f171b501dc31137e5e7d557c1ee3a99ef772", strip_root=True
)
def generate(self):