From a400055fcc8923115286c6f52649f122741f7009 Mon Sep 17 00:00:00 2001 From: aiamnezia Date: Fri, 14 Feb 2025 17:00:43 +0400 Subject: [PATCH] Change response of /api/v1/config/active from raw xray config to serialized config with meta-info --- CMakeLists.txt | 2 +- deploy/installer/config/windows.xml | 2 +- .../meta/package.xml | 2 +- proxyserver/src/configmanager.cpp | 15 ++++++++++++++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd1407a..dfd9ce3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.25) -project(desktopproxy VERSION 0.1.0.0 LANGUAGES CXX) +project(desktopproxy VERSION 0.1.0.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/deploy/installer/config/windows.xml b/deploy/installer/config/windows.xml index 98c1d41..06bb726 100644 --- a/deploy/installer/config/windows.xml +++ b/deploy/installer/config/windows.xml @@ -1,7 +1,7 @@ Censortracker Proxy Server - 0.1.0.0 + 0.1.0.1 Censortracker Proxy Server Censortracker Censortracker diff --git a/deploy/installer/packages/org.censortracker.proxyserver/meta/package.xml b/deploy/installer/packages/org.censortracker.proxyserver/meta/package.xml index 0127f41..1599b78 100644 --- a/deploy/installer/packages/org.censortracker.proxyserver/meta/package.xml +++ b/deploy/installer/packages/org.censortracker.proxyserver/meta/package.xml @@ -2,7 +2,7 @@ Censortracker Proxy Server Installation package for Censortracker Proxy Server - 0.1.0.0 + 0.1.0.1 2025-02-11 true diff --git a/proxyserver/src/configmanager.cpp b/proxyserver/src/configmanager.cpp index 39ba070..c95944f 100644 --- a/proxyserver/src/configmanager.cpp +++ b/proxyserver/src/configmanager.cpp @@ -396,7 +396,20 @@ bool ConfigManager::activateConfig(const QString &uuid) QJsonObject ConfigManager::getActiveConfig() const { - return readActiveConfig(); + Logger::getInstance().debug("Getting active config info"); + QJsonObject configsInfo = readConfigsInfo(); + QJsonObject configs = configsInfo["configs"].toObject(); + QString activeUuid = getActiveConfigUuid(); + + if (activeUuid.isEmpty() || !configs.contains(activeUuid)) { + Logger::getInstance().debug("No active config found"); + return QJsonObject(); + } + + Logger::getInstance().debug(QString("Retrieved active config info for UUID: %1").arg(activeUuid)); + QJsonObject result = configs[activeUuid].toObject(); + result["id"] = activeUuid; + return result; } QMap ConfigManager::getAllConfigs() const