Files
DefaultVPN/client/settings.cpp

568 lines
15 KiB
C++
Raw Permalink Normal View History

2020-12-30 17:03:05 +03:00
#include "settings.h"
#include "QCoreApplication"
#include "QThread"
#include "core/networkUtilities.h"
#include "version.h"
2020-12-30 17:03:05 +03:00
2021-09-09 20:15:44 +03:00
#include "containers/containers_defs.h"
2022-12-28 13:41:45 +03:00
#include "logger.h"
2021-04-20 02:09:47 +03:00
namespace
{
const char cloudFlareNs1[] = "1.1.1.1";
const char cloudFlareNs2[] = "1.0.0.1";
constexpr char gatewayEndpoint[] = "http://gw.amnezia.org:80/";
}
2021-05-10 05:25:20 -07:00
Settings::Settings(QObject *parent) : QObject(parent), m_settings(ORGANIZATION_NAME, APPLICATION_NAME, this)
2020-12-30 17:03:05 +03:00
{
2021-04-20 02:09:47 +03:00
// Import old settings
if (serversCount() == 0) {
QString user = m_settings.value("Server/userName").toString();
QString password = m_settings.value("Server/password").toString();
QString serverName = m_settings.value("Server/serverName").toString();
int port = m_settings.value("Server/serverPort").toInt();
2021-04-20 02:09:47 +03:00
if (!user.isEmpty() && !password.isEmpty() && !serverName.isEmpty()) {
2021-04-20 02:09:47 +03:00
QJsonObject server;
2021-04-26 22:54:31 +03:00
server.insert(config_key::userName, user);
server.insert(config_key::password, password);
server.insert(config_key::hostName, serverName);
server.insert(config_key::port, port);
server.insert(config_key::description, tr("Server #1"));
2021-04-20 02:09:47 +03:00
addServer(server);
2021-05-10 05:25:20 -07:00
m_settings.remove("Server/userName");
m_settings.remove("Server/password");
m_settings.remove("Server/serverName");
m_settings.remove("Server/serverPort");
2021-04-20 02:09:47 +03:00
}
}
m_gatewayEndpoint = gatewayEndpoint;
2020-12-30 17:03:05 +03:00
}
2021-04-20 02:09:47 +03:00
int Settings::serversCount() const
2020-12-30 17:03:05 +03:00
{
2021-04-20 02:09:47 +03:00
return serversArray().size();
}
QJsonObject Settings::server(int index) const
{
const QJsonArray &servers = serversArray();
if (index >= servers.size())
return QJsonObject();
2021-04-20 02:09:47 +03:00
return servers.at(index).toObject();
2020-12-30 17:03:05 +03:00
}
2021-04-20 02:09:47 +03:00
void Settings::addServer(const QJsonObject &server)
2020-12-30 17:03:05 +03:00
{
2021-04-20 02:09:47 +03:00
QJsonArray servers = serversArray();
servers.append(server);
setServersArray(servers);
}
void Settings::removeServer(int index)
{
QJsonArray servers = serversArray();
if (index >= servers.size())
return;
2021-04-20 02:09:47 +03:00
servers.removeAt(index);
setServersArray(servers);
emit serverRemoved(index);
2021-04-20 02:09:47 +03:00
}
bool Settings::editServer(int index, const QJsonObject &server)
{
QJsonArray servers = serversArray();
if (index >= servers.size())
return false;
2021-04-20 02:09:47 +03:00
servers.replace(index, server);
setServersArray(servers);
return true;
2020-12-30 17:03:05 +03:00
}
2021-04-20 02:09:47 +03:00
void Settings::setDefaultContainer(int serverIndex, DockerContainer container)
2020-12-30 17:03:05 +03:00
{
2021-04-20 02:09:47 +03:00
QJsonObject s = server(serverIndex);
2021-09-20 21:51:28 +03:00
s.insert(config_key::defaultContainer, ContainerProps::containerToString(container));
2021-04-20 02:09:47 +03:00
editServer(serverIndex, s);
}
DockerContainer Settings::defaultContainer(int serverIndex) const
{
2021-09-20 21:51:28 +03:00
return ContainerProps::containerFromString(defaultContainerName(serverIndex));
2021-04-20 02:09:47 +03:00
}
QString Settings::defaultContainerName(int serverIndex) const
{
2021-04-26 22:54:31 +03:00
QString name = server(serverIndex).value(config_key::defaultContainer).toString();
2021-04-20 02:09:47 +03:00
if (name.isEmpty()) {
2021-09-20 21:51:28 +03:00
return ContainerProps::containerToString(DockerContainer::None);
} else
return name;
2021-04-20 02:09:47 +03:00
}
2021-05-07 23:28:37 +03:00
QMap<DockerContainer, QJsonObject> Settings::containers(int serverIndex) const
2021-04-26 22:54:31 +03:00
{
const QJsonArray &containers = server(serverIndex).value(config_key::containers).toArray();
2021-05-07 23:28:37 +03:00
QMap<DockerContainer, QJsonObject> containersMap;
2021-04-26 22:54:31 +03:00
for (const QJsonValue &val : containers) {
containersMap.insert(ContainerProps::containerFromString(val.toObject().value(config_key::container).toString()), val.toObject());
2021-05-07 23:28:37 +03:00
}
return containersMap;
}
void Settings::setContainers(int serverIndex, const QMap<DockerContainer, QJsonObject> &containers)
{
QJsonObject s = server(serverIndex);
QJsonArray c;
for (const QJsonObject &o : containers) {
2021-05-07 23:28:37 +03:00
c.append(o);
2021-04-26 22:54:31 +03:00
}
2021-05-07 23:28:37 +03:00
s.insert(config_key::containers, c);
editServer(serverIndex, s);
}
QJsonObject Settings::containerConfig(int serverIndex, DockerContainer container)
{
if (container == DockerContainer::None)
return QJsonObject();
2021-05-07 23:28:37 +03:00
return containers(serverIndex).value(container);
2021-04-26 22:54:31 +03:00
}
2021-05-07 23:28:37 +03:00
void Settings::setContainerConfig(int serverIndex, DockerContainer container, const QJsonObject &config)
{
2021-05-10 02:33:31 +03:00
if (container == DockerContainer::None) {
qCritical() << "Settings::setContainerConfig trying to set config for container == DockerContainer::None";
return;
}
2021-05-07 23:28:37 +03:00
auto c = containers(serverIndex);
c[container] = config;
2021-09-20 21:51:28 +03:00
c[container][config_key::container] = ContainerProps::containerToString(container);
2021-05-07 23:28:37 +03:00
setContainers(serverIndex, c);
}
void Settings::removeContainerConfig(int serverIndex, DockerContainer container)
{
2021-05-10 02:33:31 +03:00
if (container == DockerContainer::None) {
qCritical() << "Settings::removeContainerConfig trying to remove config for container == DockerContainer::None";
return;
}
2021-05-07 23:28:37 +03:00
auto c = containers(serverIndex);
c.remove(container);
setContainers(serverIndex, c);
}
QJsonObject Settings::protocolConfig(int serverIndex, DockerContainer container, Proto proto)
2021-04-26 22:54:31 +03:00
{
const QJsonObject &c = containerConfig(serverIndex, container);
2021-09-20 21:51:28 +03:00
return c.value(ProtocolProps::protoToString(proto)).toObject();
2021-05-07 23:28:37 +03:00
}
2021-04-26 22:54:31 +03:00
void Settings::setProtocolConfig(int serverIndex, DockerContainer container, Proto proto, const QJsonObject &config)
2021-05-07 23:28:37 +03:00
{
QJsonObject c = containerConfig(serverIndex, container);
2021-09-20 21:51:28 +03:00
c.insert(ProtocolProps::protoToString(proto), config);
2021-05-07 23:28:37 +03:00
setContainerConfig(serverIndex, container, c);
}
void Settings::clearLastConnectionConfig(int serverIndex, DockerContainer container, Proto proto)
2021-05-07 23:28:37 +03:00
{
2021-10-05 12:22:13 +03:00
// recursively remove
if (proto == Proto::Any) {
for (Proto p : ContainerProps::protocolsForContainer(container)) {
2021-05-07 23:28:37 +03:00
clearLastConnectionConfig(serverIndex, container, p);
}
return;
2021-04-26 22:54:31 +03:00
}
2021-05-07 23:28:37 +03:00
QJsonObject c = protocolConfig(serverIndex, container, proto);
c.remove(config_key::last_config);
setProtocolConfig(serverIndex, container, proto, c);
2021-04-26 22:54:31 +03:00
}
2021-05-10 14:19:36 +03:00
bool Settings::haveAuthData(int serverIndex) const
2021-04-20 02:09:47 +03:00
{
if (serverIndex < 0)
return false;
2021-05-10 14:19:36 +03:00
ServerCredentials cred = serverCredentials(serverIndex);
return (!cred.hostName.isEmpty() && !cred.userName.isEmpty() && !cred.secretData.isEmpty());
2021-04-20 02:09:47 +03:00
}
2021-04-26 22:54:31 +03:00
QString Settings::nextAvailableServerName() const
{
int i = 0;
bool nameExist = false;
do {
i++;
nameExist = false;
for (const QJsonValue &server : serversArray()) {
2021-04-26 22:54:31 +03:00
if (server.toObject().value(config_key::description).toString() == tr("Server") + " " + QString::number(i)) {
nameExist = true;
break;
}
}
} while (nameExist);
return tr("Server") + " " + QString::number(i);
}
void Settings::setSaveLogs(bool enabled)
{
m_settings.setValue("Conf/saveLogs", enabled);
#ifndef Q_OS_ANDROID
if (!isSaveLogs()) {
2022-12-28 13:41:45 +03:00
Logger::deInit();
} else {
if (!Logger::init(false)) {
qWarning() << "Initialization of debug subsystem failed";
}
}
#endif
Logger::setServiceLogsEnabled(enabled);
if (enabled) {
setLogEnableDate(QDateTime::currentDateTime());
}
emit saveLogsChanged(enabled);
}
QDateTime Settings::getLogEnableDate()
{
return m_settings.value("Conf/logEnableDate").toDateTime();
}
void Settings::setLogEnableDate(QDateTime date)
{
m_settings.setValue("Conf/logEnableDate", date);
}
2021-05-27 22:18:36 +03:00
QString Settings::routeModeString(RouteMode mode) const
{
switch (mode) {
case VpnAllSites: return "AllSites";
case VpnOnlyForwardSites: return "ForwardSites";
case VpnAllExceptSites: return "ExceptSites";
2021-05-27 22:18:36 +03:00
}
}
2023-09-10 17:40:18 -07:00
Settings::RouteMode Settings::routeMode() const
{
return static_cast<RouteMode>(m_settings.value("Conf/routeMode", 0).toInt());
}
bool Settings::isSitesSplitTunnelingEnabled() const
{
return m_settings.value("Conf/sitesSplitTunnelingEnabled", false).toBool();
}
void Settings::setSitesSplitTunnelingEnabled(bool enabled)
{
m_settings.setValue("Conf/sitesSplitTunnelingEnabled", enabled);
}
bool Settings::addVpnSite(RouteMode mode, const QString &site, const QString &ip)
2021-05-27 22:18:36 +03:00
{
QVariantMap sites = vpnSites(mode);
if (sites.contains(site) && ip.isEmpty())
return false;
2021-05-27 22:18:36 +03:00
sites.insert(site, ip);
setVpnSites(mode, sites);
return true;
2021-05-27 22:18:36 +03:00
}
2022-01-23 19:16:40 +03:00
void Settings::addVpnSites(RouteMode mode, const QMap<QString, QString> &sites)
{
QVariantMap allSites = vpnSites(mode);
for (auto i = sites.constBegin(); i != sites.constEnd(); ++i) {
const QString &site = i.key();
const QString &ip = i.value();
if (allSites.contains(site) && allSites.value(site) == ip)
continue;
2022-01-23 19:16:40 +03:00
allSites.insert(site, ip);
}
setVpnSites(mode, allSites);
}
2021-05-27 22:18:36 +03:00
QStringList Settings::getVpnIps(RouteMode mode) const
{
QStringList ips;
const QVariantMap &m = vpnSites(mode);
for (auto i = m.constBegin(); i != m.constEnd(); ++i) {
if (NetworkUtilities::checkIpSubnetFormat(i.key())) {
2021-05-27 22:18:36 +03:00
ips.append(i.key());
} else if (NetworkUtilities::checkIpSubnetFormat(i.value().toString())) {
2021-05-27 22:18:36 +03:00
ips.append(i.value().toString());
}
}
ips.removeDuplicates();
return ips;
}
void Settings::removeVpnSite(RouteMode mode, const QString &site)
{
QVariantMap sites = vpnSites(mode);
if (!sites.contains(site))
return;
2021-05-27 22:18:36 +03:00
sites.remove(site);
setVpnSites(mode, sites);
}
void Settings::addVpnIps(RouteMode mode, const QStringList &ips)
{
QVariantMap sites = vpnSites(mode);
for (const QString &ip : ips) {
if (ip.isEmpty())
continue;
2021-05-27 22:18:36 +03:00
sites.insert(ip, "");
}
setVpnSites(mode, sites);
}
void Settings::removeVpnSites(RouteMode mode, const QStringList &sites)
{
QVariantMap sitesMap = vpnSites(mode);
for (const QString &site : sites) {
if (site.isEmpty())
continue;
2021-05-27 22:18:36 +03:00
sitesMap.remove(site);
}
setVpnSites(mode, sitesMap);
}
void Settings::removeAllVpnSites(RouteMode mode)
{
setVpnSites(mode, QVariantMap());
}
QString Settings::primaryDns() const
{
return m_settings.value("Conf/primaryDns", cloudFlareNs1).toString();
}
QString Settings::secondaryDns() const
{
return m_settings.value("Conf/secondaryDns", cloudFlareNs2).toString();
}
2021-05-10 05:25:20 -07:00
void Settings::clearSettings()
{
auto uuid = getInstallationUuid(false);
m_settings.clearSettings();
setInstallationUuid(uuid);
emit settingsCleared();
}
2021-05-10 05:25:20 -07:00
QString Settings::appsRouteModeString(AppsRouteMode mode) const
{
switch (mode) {
case VpnAllApps: return "AllApps";
case VpnOnlyForwardApps: return "ForwardApps";
case VpnAllExceptApps: return "ExceptApps";
}
}
Settings::AppsRouteMode Settings::getAppsRouteMode() const
{
return static_cast<AppsRouteMode>(m_settings.value("Conf/appsRouteMode", 0).toInt());
}
void Settings::setAppsRouteMode(AppsRouteMode mode)
{
m_settings.setValue("Conf/appsRouteMode", mode);
}
QVector<InstalledAppInfo> Settings::getVpnApps(AppsRouteMode mode) const
{
QVector<InstalledAppInfo> apps;
auto appsArray = m_settings.value("Conf/" + appsRouteModeString(mode)).toJsonArray();
for (const auto &app : appsArray) {
InstalledAppInfo appInfo;
appInfo.appName = app.toObject().value("appName").toString();
appInfo.packageName = app.toObject().value("packageName").toString();
appInfo.appPath = app.toObject().value("appPath").toString();
apps.push_back(appInfo);
}
return apps;
}
void Settings::setVpnApps(AppsRouteMode mode, const QVector<InstalledAppInfo> &apps)
{
QJsonArray appsArray;
for (const auto &app : apps) {
QJsonObject appInfo;
appInfo.insert("appName", app.appName);
appInfo.insert("packageName", app.packageName);
appInfo.insert("appPath", app.appPath);
appsArray.push_back(appInfo);
}
m_settings.setValue("Conf/" + appsRouteModeString(mode), appsArray);
}
bool Settings::isAppsSplitTunnelingEnabled() const
{
return m_settings.value("Conf/appsSplitTunnelingEnabled", false).toBool();
}
void Settings::setAppsSplitTunnelingEnabled(bool enabled)
{
m_settings.setValue("Conf/appsSplitTunnelingEnabled", enabled);
}
bool Settings::isKillSwitchEnabled() const
{
return m_settings.value("Conf/killSwitchEnabled", true).toBool();
}
void Settings::setKillSwitchEnabled(bool enabled)
{
m_settings.setValue("Conf/killSwitchEnabled", enabled);
}
feature: fillswitch strict mode (#1333) * Add allowed DNS list for killswitch * Windows killswitch strict mode backend part * Killswitch strict mode for Linux and MacOS * Windows fixes * feature: Add Kill Switch settings page with strict mode option * fix windows build after merge * Refresh killswitch mode when it toggled * Use HLM to store strictMode flag * Some Linux updates * feat: Enhance VerticalRadioButton with improved styling and disabled states * Refresh killSwitch state update * Fix build * refactor: Modularize header components * Change kill switch radio button styling * Fix strict kill switch mode handling * Refactor: Replace HeaderType with new Types for headers in QML pages * Remove deprecated HeaderType QML component * Refresh strict mode killswitch after global toggle change * Implement model, controller and UI for killswitch dns exceptions * Connect backend part and UI * Change label text to DNS exceptions * Remove HeaderType from PageSettingsApiDevices * Some pretty fixes * Fix problem with definition sequence of PageSettingsKillSwitchExceptions.pml elements * Add exclusion method for Windows firewall * Change ubuntu version in deploy script * Update ubuntu version in GH actions * Add confirmation popup for strict killswitch mode * Add qt standard path for build script * Add method to killswitch for expanding strickt mode exceptions list and fix allowTrafficTo() for Windows. Also Added cache in KillSwitch class for exceptions * Add insertion of gateway address to strict killswitch exceptions * Review fixes * buildfix and naming --------- Co-authored-by: aiamnezia <ai@amnezia.org>
2025-05-02 23:54:36 -07:00
bool Settings::isStrictKillSwitchEnabled() const
{
return m_settings.value("Conf/strictKillSwitchEnabled", false).toBool();
feature: fillswitch strict mode (#1333) * Add allowed DNS list for killswitch * Windows killswitch strict mode backend part * Killswitch strict mode for Linux and MacOS * Windows fixes * feature: Add Kill Switch settings page with strict mode option * fix windows build after merge * Refresh killswitch mode when it toggled * Use HLM to store strictMode flag * Some Linux updates * feat: Enhance VerticalRadioButton with improved styling and disabled states * Refresh killSwitch state update * Fix build * refactor: Modularize header components * Change kill switch radio button styling * Fix strict kill switch mode handling * Refactor: Replace HeaderType with new Types for headers in QML pages * Remove deprecated HeaderType QML component * Refresh strict mode killswitch after global toggle change * Implement model, controller and UI for killswitch dns exceptions * Connect backend part and UI * Change label text to DNS exceptions * Remove HeaderType from PageSettingsApiDevices * Some pretty fixes * Fix problem with definition sequence of PageSettingsKillSwitchExceptions.pml elements * Add exclusion method for Windows firewall * Change ubuntu version in deploy script * Update ubuntu version in GH actions * Add confirmation popup for strict killswitch mode * Add qt standard path for build script * Add method to killswitch for expanding strickt mode exceptions list and fix allowTrafficTo() for Windows. Also Added cache in KillSwitch class for exceptions * Add insertion of gateway address to strict killswitch exceptions * Review fixes * buildfix and naming --------- Co-authored-by: aiamnezia <ai@amnezia.org>
2025-05-02 23:54:36 -07:00
}
void Settings::setStrictKillSwitchEnabled(bool enabled)
{
m_settings.setValue("Conf/strictKillSwitchEnabled", enabled);
feature: fillswitch strict mode (#1333) * Add allowed DNS list for killswitch * Windows killswitch strict mode backend part * Killswitch strict mode for Linux and MacOS * Windows fixes * feature: Add Kill Switch settings page with strict mode option * fix windows build after merge * Refresh killswitch mode when it toggled * Use HLM to store strictMode flag * Some Linux updates * feat: Enhance VerticalRadioButton with improved styling and disabled states * Refresh killSwitch state update * Fix build * refactor: Modularize header components * Change kill switch radio button styling * Fix strict kill switch mode handling * Refactor: Replace HeaderType with new Types for headers in QML pages * Remove deprecated HeaderType QML component * Refresh strict mode killswitch after global toggle change * Implement model, controller and UI for killswitch dns exceptions * Connect backend part and UI * Change label text to DNS exceptions * Remove HeaderType from PageSettingsApiDevices * Some pretty fixes * Fix problem with definition sequence of PageSettingsKillSwitchExceptions.pml elements * Add exclusion method for Windows firewall * Change ubuntu version in deploy script * Update ubuntu version in GH actions * Add confirmation popup for strict killswitch mode * Add qt standard path for build script * Add method to killswitch for expanding strickt mode exceptions list and fix allowTrafficTo() for Windows. Also Added cache in KillSwitch class for exceptions * Add insertion of gateway address to strict killswitch exceptions * Review fixes * buildfix and naming --------- Co-authored-by: aiamnezia <ai@amnezia.org>
2025-05-02 23:54:36 -07:00
}
QString Settings::getInstallationUuid(const bool needCreate)
{
auto uuid = m_settings.value("Conf/installationUuid", "").toString();
if (needCreate && uuid.isEmpty()) {
uuid = QUuid::createUuid().toString();
//remove {} from uuid
uuid.remove(0, 1);
uuid.chop(1);
setInstallationUuid(uuid);
} else if (uuid.contains("{") && uuid.contains("}")) {
//remove {} from old uuid
uuid.remove(0, 1);
uuid.chop(1);
setInstallationUuid(uuid);
}
return uuid;
}
void Settings::setInstallationUuid(const QString &uuid)
{
m_settings.setValue("Conf/installationUuid", uuid);
}
2021-04-20 02:09:47 +03:00
ServerCredentials Settings::defaultServerCredentials() const
{
2021-04-26 22:54:31 +03:00
return serverCredentials(defaultServerIndex());
}
ServerCredentials Settings::serverCredentials(int index) const
{
const QJsonObject &s = server(index);
2021-04-20 02:09:47 +03:00
2021-01-06 17:12:24 +03:00
ServerCredentials credentials;
2021-04-26 22:54:31 +03:00
credentials.hostName = s.value(config_key::hostName).toString();
credentials.userName = s.value(config_key::userName).toString();
credentials.secretData = s.value(config_key::password).toString();
2021-04-26 22:54:31 +03:00
credentials.port = s.value(config_key::port).toInt();
2021-01-06 17:12:24 +03:00
return credentials;
2020-12-30 17:03:05 +03:00
}
void Settings::resetGatewayEndpoint()
{
m_gatewayEndpoint = gatewayEndpoint;
}
void Settings::setGatewayEndpoint(const QString &endpoint)
{
m_gatewayEndpoint = endpoint;
}
void Settings::setDevGatewayEndpoint()
{
m_gatewayEndpoint = DEV_AGW_ENDPOINT;
}
QString Settings::getGatewayEndpoint(bool isTestPurchase)
{
return isTestPurchase ? DEV_AGW_ENDPOINT : m_gatewayEndpoint;
}
bool Settings::isDevGatewayEnv(bool isTestPurchase)
{
return isTestPurchase ? true : m_settings.value("Conf/devGatewayEnv", false).toBool();
}
void Settings::toggleDevGatewayEnv(bool enabled)
{
m_settings.setValue("Conf/devGatewayEnv", enabled);
}
bool Settings::isHomeAdLabelVisible()
{
return m_settings.value("Conf/homeAdLabelVisible", true).toBool();
}
void Settings::disableHomeAdLabel()
{
m_settings.setValue("Conf/homeAdLabelVisible", false);
}
feature: fillswitch strict mode (#1333) * Add allowed DNS list for killswitch * Windows killswitch strict mode backend part * Killswitch strict mode for Linux and MacOS * Windows fixes * feature: Add Kill Switch settings page with strict mode option * fix windows build after merge * Refresh killswitch mode when it toggled * Use HLM to store strictMode flag * Some Linux updates * feat: Enhance VerticalRadioButton with improved styling and disabled states * Refresh killSwitch state update * Fix build * refactor: Modularize header components * Change kill switch radio button styling * Fix strict kill switch mode handling * Refactor: Replace HeaderType with new Types for headers in QML pages * Remove deprecated HeaderType QML component * Refresh strict mode killswitch after global toggle change * Implement model, controller and UI for killswitch dns exceptions * Connect backend part and UI * Change label text to DNS exceptions * Remove HeaderType from PageSettingsApiDevices * Some pretty fixes * Fix problem with definition sequence of PageSettingsKillSwitchExceptions.pml elements * Add exclusion method for Windows firewall * Change ubuntu version in deploy script * Update ubuntu version in GH actions * Add confirmation popup for strict killswitch mode * Add qt standard path for build script * Add method to killswitch for expanding strickt mode exceptions list and fix allowTrafficTo() for Windows. Also Added cache in KillSwitch class for exceptions * Add insertion of gateway address to strict killswitch exceptions * Review fixes * buildfix and naming --------- Co-authored-by: aiamnezia <ai@amnezia.org>
2025-05-02 23:54:36 -07:00
bool Settings::isPremV1MigrationReminderActive()
{
return m_settings.value("Conf/premV1MigrationReminderActive", false).toBool();
}
void Settings::disablePremV1MigrationReminder()
{
m_settings.setValue("Conf/premV1MigrationReminderActive", false);
}
feature: fillswitch strict mode (#1333) * Add allowed DNS list for killswitch * Windows killswitch strict mode backend part * Killswitch strict mode for Linux and MacOS * Windows fixes * feature: Add Kill Switch settings page with strict mode option * fix windows build after merge * Refresh killswitch mode when it toggled * Use HLM to store strictMode flag * Some Linux updates * feat: Enhance VerticalRadioButton with improved styling and disabled states * Refresh killSwitch state update * Fix build * refactor: Modularize header components * Change kill switch radio button styling * Fix strict kill switch mode handling * Refactor: Replace HeaderType with new Types for headers in QML pages * Remove deprecated HeaderType QML component * Refresh strict mode killswitch after global toggle change * Implement model, controller and UI for killswitch dns exceptions * Connect backend part and UI * Change label text to DNS exceptions * Remove HeaderType from PageSettingsApiDevices * Some pretty fixes * Fix problem with definition sequence of PageSettingsKillSwitchExceptions.pml elements * Add exclusion method for Windows firewall * Change ubuntu version in deploy script * Update ubuntu version in GH actions * Add confirmation popup for strict killswitch mode * Add qt standard path for build script * Add method to killswitch for expanding strickt mode exceptions list and fix allowTrafficTo() for Windows. Also Added cache in KillSwitch class for exceptions * Add insertion of gateway address to strict killswitch exceptions * Review fixes * buildfix and naming --------- Co-authored-by: aiamnezia <ai@amnezia.org>
2025-05-02 23:54:36 -07:00
QStringList Settings::allowedDnsServers() const
{
return m_settings.value("Conf/allowedDnsServers").toStringList();
feature: fillswitch strict mode (#1333) * Add allowed DNS list for killswitch * Windows killswitch strict mode backend part * Killswitch strict mode for Linux and MacOS * Windows fixes * feature: Add Kill Switch settings page with strict mode option * fix windows build after merge * Refresh killswitch mode when it toggled * Use HLM to store strictMode flag * Some Linux updates * feat: Enhance VerticalRadioButton with improved styling and disabled states * Refresh killSwitch state update * Fix build * refactor: Modularize header components * Change kill switch radio button styling * Fix strict kill switch mode handling * Refactor: Replace HeaderType with new Types for headers in QML pages * Remove deprecated HeaderType QML component * Refresh strict mode killswitch after global toggle change * Implement model, controller and UI for killswitch dns exceptions * Connect backend part and UI * Change label text to DNS exceptions * Remove HeaderType from PageSettingsApiDevices * Some pretty fixes * Fix problem with definition sequence of PageSettingsKillSwitchExceptions.pml elements * Add exclusion method for Windows firewall * Change ubuntu version in deploy script * Update ubuntu version in GH actions * Add confirmation popup for strict killswitch mode * Add qt standard path for build script * Add method to killswitch for expanding strickt mode exceptions list and fix allowTrafficTo() for Windows. Also Added cache in KillSwitch class for exceptions * Add insertion of gateway address to strict killswitch exceptions * Review fixes * buildfix and naming --------- Co-authored-by: aiamnezia <ai@amnezia.org>
2025-05-02 23:54:36 -07:00
}
void Settings::setAllowedDnsServers(const QStringList &servers)
{
m_settings.setValue("Conf/allowedDnsServers", servers);
feature: fillswitch strict mode (#1333) * Add allowed DNS list for killswitch * Windows killswitch strict mode backend part * Killswitch strict mode for Linux and MacOS * Windows fixes * feature: Add Kill Switch settings page with strict mode option * fix windows build after merge * Refresh killswitch mode when it toggled * Use HLM to store strictMode flag * Some Linux updates * feat: Enhance VerticalRadioButton with improved styling and disabled states * Refresh killSwitch state update * Fix build * refactor: Modularize header components * Change kill switch radio button styling * Fix strict kill switch mode handling * Refactor: Replace HeaderType with new Types for headers in QML pages * Remove deprecated HeaderType QML component * Refresh strict mode killswitch after global toggle change * Implement model, controller and UI for killswitch dns exceptions * Connect backend part and UI * Change label text to DNS exceptions * Remove HeaderType from PageSettingsApiDevices * Some pretty fixes * Fix problem with definition sequence of PageSettingsKillSwitchExceptions.pml elements * Add exclusion method for Windows firewall * Change ubuntu version in deploy script * Update ubuntu version in GH actions * Add confirmation popup for strict killswitch mode * Add qt standard path for build script * Add method to killswitch for expanding strickt mode exceptions list and fix allowTrafficTo() for Windows. Also Added cache in KillSwitch class for exceptions * Add insertion of gateway address to strict killswitch exceptions * Review fixes * buildfix and naming --------- Co-authored-by: aiamnezia <ai@amnezia.org>
2025-05-02 23:54:36 -07:00
}
QStringList Settings::readNewsIds() const
{
return m_settings.value("News/readIds").toStringList();
}
void Settings::setReadNewsIds(const QStringList &ids)
{
m_settings.setValue("News/readIds", ids);
}