diff --git a/service/server/xray.cpp b/service/server/xray.cpp index 20345d426..fdc0099af 100644 --- a/service/server/xray.cpp +++ b/service/server/xray.cpp @@ -52,26 +52,19 @@ bool Xray::startXray(const QString &cfg) // Temporary aid for manual verification of SOCKS auth (inbounds.settings.accounts). // Debug: always writes. Release: set env AMNEZIA_SAVE_XRAY_CONFIG=1 (if the daemon inherits it). { -#if defined(MZ_DEBUG) - const bool saveForTest = true; -#else - const bool saveForTest = !qgetenv("AMNEZIA_SAVE_XRAY_CONFIG").isEmpty(); -#endif - if (saveForTest) { #ifdef Q_OS_WIN - const QString debugPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) - + QStringLiteral("/amnezia-xray-config.json"); + const QString debugPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + + QStringLiteral("/amnezia-xray-config.json"); #else - const QString debugPath = QStringLiteral("/tmp/amnezia-xray-config.json"); + const QString debugPath = QStringLiteral("/tmp/amnezia-xray-config.json"); #endif - QFile f(debugPath); - if (f.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - f.write(bytes); - f.close(); - qDebug() << "[xray] wrote last config for testing:" << debugPath; - } else { - qWarning() << "[xray] failed to write test config to" << debugPath; - } + QFile f(debugPath); + if (f.open(QIODevice::WriteOnly | QIODevice::Truncate)) { + f.write(bytes); + f.close(); + qDebug() << "[xray] wrote last config for testing:" << debugPath; + } else { + qWarning() << "[xray] failed to write test config to" << debugPath; } } if (auto err = amnezia_xray_configure(bytes.data()); err != nullptr) {