mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
fixed macros
This commit is contained in:
@@ -33,6 +33,10 @@ 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}")
|
||||
|
||||
if(AMNEZIA_LOCAL_GATEWAY)
|
||||
add_definitions(-DAMNEZIA_LOCAL_GATEWAY="$ENV{AMNEZIA_LOCAL_GATEWAY}")
|
||||
endif()
|
||||
|
||||
if(WIN32 OR (APPLE AND NOT IOS) OR (LINUX AND NOT ANDROID))
|
||||
set(PACKAGES ${PACKAGES} Widgets)
|
||||
endif()
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace
|
||||
|
||||
constexpr QLatin1String unprocessableSubscriptionMessage("Failed to retrieve subscription information. Is it activated?");
|
||||
|
||||
#if AMNEZIA_GATEWAY_PLAINTEXT_MOCK
|
||||
#ifdef AMNEZIA_LOCAL_GATEWAY
|
||||
bool gatewayUrlIsPlaintextMockTarget(const QString &gatewayEndpoint, const QString &proxyUrl)
|
||||
{
|
||||
const auto hostOf = [](const QString &urlString) -> QString {
|
||||
@@ -88,7 +88,7 @@ GatewayController::EncryptedRequestData GatewayController::prepareRequest(const
|
||||
encRequestData.request.setRawHeader(QString("X-Client-Request-ID").toUtf8(), QUuid::createUuid().toString(QUuid::WithoutBraces).toUtf8());
|
||||
encRequestData.request.setUrl(endpoint.arg(m_proxyUrl.isEmpty() ? m_gatewayEndpoint : m_proxyUrl));
|
||||
|
||||
#if AMNEZIA_GATEWAY_PLAINTEXT_MOCK
|
||||
#ifdef AMNEZIA_LOCAL_GATEWAY
|
||||
if (gatewayUrlIsPlaintextMockTarget(m_gatewayEndpoint, m_proxyUrl)) {
|
||||
encRequestData.requestBody = QJsonDocument(apiPayload).toJson();
|
||||
encRequestData.key.clear();
|
||||
@@ -203,7 +203,7 @@ ErrorCode GatewayController::post(const QString &endpoint, const QJsonObject api
|
||||
|
||||
reply->deleteLater();
|
||||
|
||||
#if AMNEZIA_GATEWAY_PLAINTEXT_MOCK
|
||||
#ifdef AMNEZIA_LOCAL_GATEWAY
|
||||
const bool plaintextMock = encRequestData.key.isEmpty();
|
||||
DecryptionResult decryptionResult;
|
||||
decryptionResult.decryptedBody = encryptedResponseBody;
|
||||
@@ -284,7 +284,7 @@ QFuture<QPair<ErrorCode, QByteArray>> GatewayController::postAsync(const QString
|
||||
|
||||
reply->deleteLater();
|
||||
|
||||
#if AMNEZIA_GATEWAY_PLAINTEXT_MOCK
|
||||
#ifdef AMNEZIA_LOCAL_GATEWAY
|
||||
const bool plaintextMock = encRequestData.key.isEmpty();
|
||||
DecryptionResult decryptionResult;
|
||||
decryptionResult.decryptedBody = encryptedResponseBody;
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace
|
||||
const char cloudFlareNs1[] = "1.1.1.1";
|
||||
const char cloudFlareNs2[] = "1.0.0.1";
|
||||
|
||||
#if AMNEZIA_FORCE_DEV_GATEWAY
|
||||
constexpr char gatewayEndpoint[] = DEFAULT_GATEWAY_ENDPOINT;
|
||||
#ifdef AMNEZIA_LOCAL_GATEWAY
|
||||
constexpr char gatewayEndpoint[] = "http://localhost:8080/";
|
||||
#else
|
||||
constexpr char gatewayEndpoint[] = "http://gw.amnezia.org:80/";
|
||||
#endif
|
||||
@@ -48,9 +48,8 @@ Settings::Settings(QObject *parent) : QObject(parent), m_settings(ORGANIZATION_N
|
||||
}
|
||||
|
||||
m_gatewayEndpoint = gatewayEndpoint;
|
||||
#if AMNEZIA_FORCE_DEV_GATEWAY
|
||||
#ifdef AMNEZIA_LOCAL_GATEWAY
|
||||
m_settings.setValue(QStringLiteral("Conf/devGatewayEnv"), true);
|
||||
m_gatewayEndpoint = QString::fromUtf8(DEV_AGW_ENDPOINT);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user