Skip to content

Commit

Permalink
Fix problem with activation when add configs and Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
aiamnezia committed Mar 2, 2025
1 parent 39f7caa commit e938ab2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.25)

project(desktopproxy VERSION 0.1.0.7 LANGUAGES CXX)
project(desktopproxy VERSION 0.1.0.8 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
2 changes: 1 addition & 1 deletion deploy/installer/config/windows.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Installer>
<Name>Censor Tracker Proxy</Name>
<Version>0.1.0.7</Version>
<Version>0.1.0.8</Version>
<Title>Censor Tracker Proxy</Title>
<Publisher>Censor Tracker</Publisher>
<StartMenuDir>Censor Tracker Proxy</StartMenuDir>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Package>
<DisplayName>Censor Tracker Proxy</DisplayName>
<Description>Installation package for Censor Tracker Proxy</Description>
<Version>0.1.0.7</Version>
<Version>0.1.0.8</Version>
<ReleaseDate>2025-02-18</ReleaseDate>
<Default>true</Default>
<Script>installscript.qs</Script>
Expand Down
29 changes: 20 additions & 9 deletions proxyserver/src/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ bool ConfigManager::addConfigs(const QStringList &serializedConfigs)
return false;
}

// If there's no active config, activate the first added one
// If there's no active config, activate the first added one
if (activeUuid.isEmpty() && !firstUuid.isEmpty())
{
Logger::getInstance().info(QString("No active config, activating first added config: %1").arg(firstUuid));
Expand Down Expand Up @@ -316,12 +316,25 @@ bool ConfigManager::removeConfig(const QString &uuid)
.arg(configToRemove["name"].toString())
.arg(configToRemove["protocol"].toString()));

// Store current active config UUID
bool needToActivateNew = (getActiveConfigUuid() == uuid);

// Remove config from the list
configs.remove(uuid);

// If removing active config, activate another one first
if (getActiveConfigUuid() == uuid)

// Save updated configs list (without changing activeConfigUuid)
configsInfo["configs"] = configs;
Logger::getInstance().debug("Writing updated configs info to file");
if (!writeConfigsInfo(configsInfo))
{
Logger::getInstance().error("Failed to write configs info");
return false;
}

// If active config was removed, activate a new one
if (needToActivateNew)
{
Logger::getInstance().info("Removing active config, need to activate another one");
Logger::getInstance().info("Removed active config, need to activate a new one");
if (configs.isEmpty())
{
Logger::getInstance().info("No configs left, clearing active config");
Expand All @@ -342,10 +355,8 @@ bool ConfigManager::removeConfig(const QString &uuid)
}
}
}

configsInfo["configs"] = configs;
Logger::getInstance().debug("Writing updated configs info to file");
return writeConfigsInfo(configsInfo);

return true;
}

bool ConfigManager::activateConfig(const QString &uuid)
Expand Down

0 comments on commit e938ab2

Please sign in to comment.