mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-20 02:00:55 +07:00
remove comment
This commit is contained in:
@@ -16,45 +16,6 @@ set_target_properties(${PROJECT} PROPERTIES
|
||||
QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android
|
||||
)
|
||||
|
||||
# libQt6Core is built against a recent LLVM libc++; if androiddeployqt packs an older
|
||||
# libc++_shared.so (e.g. from NDK 25), dlopen fails on std::pmr::monotonic_buffer_resource.
|
||||
# Pin the STL to the same NDK CMake uses (Qt 6.9.x expects NDK r27 — see Qt wiki).
|
||||
if(CMAKE_ANDROID_NDK)
|
||||
file(GLOB _amnz_ndk_prebuilts
|
||||
LIST_DIRECTORIES true
|
||||
"${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/*")
|
||||
set(_amnz_ndk_prebuilt "")
|
||||
foreach(_amnz_d IN LISTS _amnz_ndk_prebuilts)
|
||||
if(IS_DIRECTORY "${_amnz_d}")
|
||||
set(_amnz_ndk_prebuilt "${_amnz_d}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
if(CMAKE_ANDROID_ARCH_ABI STREQUAL "arm64-v8a")
|
||||
set(_amnz_libcxx_triple "aarch64-linux-android")
|
||||
elseif(CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a")
|
||||
set(_amnz_libcxx_triple "armv7a-linux-androideabi")
|
||||
elseif(CMAKE_ANDROID_ARCH_ABI STREQUAL "x86")
|
||||
set(_amnz_libcxx_triple "i686-linux-android")
|
||||
elseif(CMAKE_ANDROID_ARCH_ABI STREQUAL "x86_64")
|
||||
set(_amnz_libcxx_triple "x86_64-linux-android")
|
||||
else()
|
||||
set(_amnz_libcxx_triple "")
|
||||
endif()
|
||||
if(_amnz_ndk_prebuilt AND _amnz_libcxx_triple)
|
||||
set(_amnz_libcxx_shared
|
||||
"${_amnz_ndk_prebuilt}/sysroot/usr/lib/${_amnz_libcxx_triple}/libc++_shared.so")
|
||||
if(EXISTS "${_amnz_libcxx_shared}")
|
||||
set_property(TARGET ${PROJECT} PROPERTY QT_ANDROID_EXTRA_LIBS "${_amnz_libcxx_shared}")
|
||||
message(STATUS "Android: QT_ANDROID_EXTRA_LIBS libc++_shared from NDK: ${_amnz_libcxx_shared}")
|
||||
else()
|
||||
message(WARNING "Android: libc++_shared not found at ${_amnz_libcxx_shared} (check CMAKE_ANDROID_NDK=${CMAKE_ANDROID_NDK})")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Android: could not resolve NDK prebuilt under ${CMAKE_ANDROID_NDK}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(QT_ANDROID_MULTI_ABI_FORWARD_VARS "QT_NO_GLOBAL_APK_TARGET_PART_OF_ALL;CMAKE_BUILD_TYPE")
|
||||
|
||||
# We need to include qtprivate api's
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
|
||||
class SecureAppSettingsRepository;
|
||||
|
||||
/**
|
||||
* Core API for QR pairing against Amnezia gateway (POST /v1/generate_qr, /v1/scan_qr).
|
||||
* Phase 1: transport via GatewayController, error mapping incl. gateway `http_status` wrapper and OpenAPI-style bodies.
|
||||
*/
|
||||
class PairingController
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -27,7 +27,6 @@ public:
|
||||
const bool isStrictKillSwitchEnabled, QObject *parent = nullptr);
|
||||
|
||||
amnezia::ErrorCode post(const QString &endpoint, const QJsonObject apiPayload, QByteArray &responseBody);
|
||||
/** If \a activeReplyOut is non-null, the underlying QNetworkReply is written for abort/cancel (not owned by caller). */
|
||||
QFuture<QPair<amnezia::ErrorCode, QByteArray>> postAsync(const QString &endpoint, const QJsonObject &apiPayload,
|
||||
QNetworkReply **activeReplyOut = nullptr,
|
||||
const QSharedPointer<GatewayController> &keepAlive = {});
|
||||
|
||||
@@ -247,15 +247,6 @@ void SecureAppSettingsRepository::setAppsSplitTunnelingEnabled(bool enabled)
|
||||
QString SecureAppSettingsRepository::getGatewayEndpoint(bool isTestPurchase) const
|
||||
{
|
||||
if (isTestPurchase) {
|
||||
// App Store / sandbox subscriptions set isTestPurchase; the stock rule swaps the base URL to
|
||||
// DEV_AGW_ENDPOINT. For tools/local_gateway (127.0.0.1 / localhost) that sends encrypted
|
||||
// traffic to the wrong host, decryption fails, shouldBypassProxy pulls S3 — crash or "Send failed".
|
||||
const QString &base = m_gatewayEndpoint;
|
||||
if (base.contains(QStringLiteral("127.0.0.1"), Qt::CaseInsensitive)
|
||||
|| base.contains(QStringLiteral("localhost"), Qt::CaseInsensitive)
|
||||
|| base.contains(QStringLiteral("[::1]"), Qt::CaseInsensitive)) {
|
||||
return m_gatewayEndpoint;
|
||||
}
|
||||
return QString(DEV_AGW_ENDPOINT);
|
||||
}
|
||||
return m_gatewayEndpoint;
|
||||
|
||||
@@ -139,26 +139,16 @@ amnezia::ErrorCode apiUtils::errorCodeFromGatewayJsonHttpStatus(const QJsonObjec
|
||||
}
|
||||
const int st = jsonObj.value(QStringLiteral("http_status")).toInt(-1);
|
||||
switch (st) {
|
||||
case 200:
|
||||
return amnezia::ErrorCode::NoError;
|
||||
case 400:
|
||||
return amnezia::ErrorCode::ApiConfigEmptyError;
|
||||
case 403:
|
||||
return amnezia::ErrorCode::ApiPairingForbiddenError;
|
||||
case 404:
|
||||
return amnezia::ErrorCode::ApiNotFoundError;
|
||||
case 408:
|
||||
return amnezia::ErrorCode::ApiConfigTimeoutError;
|
||||
case 409:
|
||||
return amnezia::ErrorCode::ApiPairingConflictError;
|
||||
case 429:
|
||||
return amnezia::ErrorCode::ApiPairingRateLimitedError;
|
||||
case 500:
|
||||
return amnezia::ErrorCode::ApiConfigDownloadError;
|
||||
case 503:
|
||||
return amnezia::ErrorCode::ApiPairingServiceUnavailableError;
|
||||
default:
|
||||
return amnezia::ErrorCode::ApiConfigDownloadError;
|
||||
case 200: return amnezia::ErrorCode::NoError;
|
||||
case 400: return amnezia::ErrorCode::ApiConfigEmptyError;
|
||||
case 403: return amnezia::ErrorCode::ApiPairingForbiddenError;
|
||||
case 404: return amnezia::ErrorCode::ApiNotFoundError;
|
||||
case 408: return amnezia::ErrorCode::ApiConfigTimeoutError;
|
||||
case 409: return amnezia::ErrorCode::ApiPairingConflictError;
|
||||
case 429: return amnezia::ErrorCode::ApiPairingRateLimitedError;
|
||||
case 500: return amnezia::ErrorCode::ApiConfigDownloadError;
|
||||
case 503: return amnezia::ErrorCode::ApiPairingServiceUnavailableError;
|
||||
default: return amnezia::ErrorCode::ApiConfigDownloadError;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ namespace apiUtils
|
||||
const QNetworkReply::NetworkError &replyError, const int httpStatusCode,
|
||||
const QByteArray &responseBody);
|
||||
|
||||
/** Maps gateway JSON `http_status` field (when present) to ErrorCode. Returns NoError if field is missing. */
|
||||
amnezia::ErrorCode errorCodeFromGatewayJsonHttpStatus(const QJsonObject &jsonObj);
|
||||
|
||||
QString getPremiumV1VpnKey(const QJsonObject &serverConfigObject);
|
||||
|
||||
@@ -31,7 +31,6 @@ public:
|
||||
static QString ipAddressFromIpWithSubnet(const QString ip);
|
||||
static QStringList summarizeRoutes(const QStringList &ips, const QString cidr);
|
||||
|
||||
/// True for RFC1918 / IPv4 link-local / IPv6 ULA or IPv6 link-local (dev-only LAN gateway with tools/local_gateway).
|
||||
static bool hostIsPrivateLanAddress(const QString &host);
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace qrCodeUtils
|
||||
constexpr const qint16 qrMagicCode = 1984;
|
||||
|
||||
QList<QString> generateQrCodeImageSeries(const QByteArray &data);
|
||||
/** QR payload is raw UTF-8 text (e.g. hyphenated session UUID) so phone cameras return a parsable string. */
|
||||
QList<QString> generateQrCodeImageSeriesPlainText(const QByteArray &utf8Text);
|
||||
qrcodegen::QrCode generateQrCode(const QByteArray &data);
|
||||
QString svgToBase64(const QString &image);
|
||||
|
||||
@@ -17,7 +17,6 @@ public slots:
|
||||
void stopReading();
|
||||
void setCameraSize(QRect value);
|
||||
void setTorchEnabled(bool on);
|
||||
/// Called from AVFoundation delegate on the main queue; emits codeReaded.
|
||||
void notifyCodeRead(const QString &code);
|
||||
|
||||
signals:
|
||||
|
||||
@@ -7,16 +7,10 @@ bool amneziaIosPairingCameraAccessGranted();
|
||||
void amneziaIosRequestPairingCameraAccess(const std::function<void(bool)> &onDone);
|
||||
void amneziaIosOpenApplicationSettings();
|
||||
|
||||
/** When true, makes Qt's root UIView non-opaque so window-layer camera preview shows through transparent QML. */
|
||||
void amneziaIosApplyEmbeddedCameraUnderlayToQtView(bool enable);
|
||||
|
||||
/**
|
||||
* Extra height (points) added to the bottom native dim strip above UIKit safe-area bottom, when the Qt root view
|
||||
* fills the host (tab bar lives in QML). Typically set from QML scanDimBleedBottom. Pass 0 to clear.
|
||||
*/
|
||||
void amneziaIosSetPairingEmbeddedCameraNativeBottomExtraPt(int extraPt);
|
||||
|
||||
/** Call after AVCaptureVideoPreviewLayer is inserted on UIWindow so the window-layer mask stacks above it. */
|
||||
void amneziaIosPairingRelayoutChromeIfNeeded(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* iOS-only: UIWindow + UIKit capture for API “send pairing” QR scan.
|
||||
* UTF-8 scan payload is valid only for the duration of the callback.
|
||||
*/
|
||||
using AmneziaPairingQrScannedUtf8Handler = std::function<void(const char *)>;
|
||||
using AmneziaPairingQrOverlayBackHandler = std::function<void()>;
|
||||
|
||||
|
||||
@@ -19,9 +19,7 @@ import "../Components"
|
||||
PageType {
|
||||
id: root
|
||||
|
||||
/** True after "Add Device via QR" until permission result or navigation. */
|
||||
property bool pendingOpenQrPageAfterCamera: false
|
||||
/** True after denial: user may enable camera in system settings; resume opens QR page when granted. */
|
||||
property bool waitingSettingsReturnForQrPage: false
|
||||
|
||||
function proceedOpenQrPairingPage() {
|
||||
|
||||
@@ -13,14 +13,12 @@ PageType {
|
||||
id: root
|
||||
|
||||
property int qrImageIndex: 0
|
||||
/** Same window as gateway long-poll: new QR / session on each tick. */
|
||||
readonly property int qrRefreshIntervalMs: Math.max(5000, PairingUiController.tvPairingWaitWindowSeconds * 1000)
|
||||
|
||||
function scrollPairingToBottom() {
|
||||
receiveScroll.contentY = Math.max(0, receiveScroll.contentHeight - receiveScroll.height)
|
||||
}
|
||||
|
||||
/** StackView often creates the page already visible — onVisibleChanged may not fire for the initial true. */
|
||||
function beginReceiveFlow() {
|
||||
PairingUiController.startTvQrSession()
|
||||
qrRotationTimer.restart()
|
||||
|
||||
Reference in New Issue
Block a user