Skip to content

Commit e938ab2

Browse files
committed
Fix problem with activation when add configs and Bump version
1 parent 39f7caa commit e938ab2

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.25)
22

3-
project(desktopproxy VERSION 0.1.0.7 LANGUAGES CXX)
3+
project(desktopproxy VERSION 0.1.0.8 LANGUAGES CXX)
44

55
set(CMAKE_CXX_STANDARD 17)
66
set(CMAKE_CXX_STANDARD_REQUIRED ON)

deploy/installer/config/windows.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Installer>
33
<Name>Censor Tracker Proxy</Name>
4-
<Version>0.1.0.7</Version>
4+
<Version>0.1.0.8</Version>
55
<Title>Censor Tracker Proxy</Title>
66
<Publisher>Censor Tracker</Publisher>
77
<StartMenuDir>Censor Tracker Proxy</StartMenuDir>

deploy/installer/packages/org.censortracker.proxy/meta/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Package>
33
<DisplayName>Censor Tracker Proxy</DisplayName>
44
<Description>Installation package for Censor Tracker Proxy</Description>
5-
<Version>0.1.0.7</Version>
5+
<Version>0.1.0.8</Version>
66
<ReleaseDate>2025-02-18</ReleaseDate>
77
<Default>true</Default>
88
<Script>installscript.qs</Script>

proxyserver/src/configmanager.cpp

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ bool ConfigManager::addConfigs(const QStringList &serializedConfigs)
288288
return false;
289289
}
290290

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

319+
// Store current active config UUID
320+
bool needToActivateNew = (getActiveConfigUuid() == uuid);
321+
322+
// Remove config from the list
319323
configs.remove(uuid);
320-
321-
// If removing active config, activate another one first
322-
if (getActiveConfigUuid() == uuid)
324+
325+
// Save updated configs list (without changing activeConfigUuid)
326+
configsInfo["configs"] = configs;
327+
Logger::getInstance().debug("Writing updated configs info to file");
328+
if (!writeConfigsInfo(configsInfo))
329+
{
330+
Logger::getInstance().error("Failed to write configs info");
331+
return false;
332+
}
333+
334+
// If active config was removed, activate a new one
335+
if (needToActivateNew)
323336
{
324-
Logger::getInstance().info("Removing active config, need to activate another one");
337+
Logger::getInstance().info("Removed active config, need to activate a new one");
325338
if (configs.isEmpty())
326339
{
327340
Logger::getInstance().info("No configs left, clearing active config");
@@ -342,10 +355,8 @@ bool ConfigManager::removeConfig(const QString &uuid)
342355
}
343356
}
344357
}
345-
346-
configsInfo["configs"] = configs;
347-
Logger::getInstance().debug("Writing updated configs info to file");
348-
return writeConfigsInfo(configsInfo);
358+
359+
return true;
349360
}
350361

351362
bool ConfigManager::activateConfig(const QString &uuid)

0 commit comments

Comments
 (0)