mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-21 02:01:03 +07:00
Filter settings fields to backup
This commit is contained in:
@@ -124,8 +124,27 @@ QByteArray SecureQSettings::backupAppConfig() const
|
|||||||
{
|
{
|
||||||
QJsonObject cfg;
|
QJsonObject cfg;
|
||||||
|
|
||||||
|
const auto needToBackup = [this](const auto &key) {
|
||||||
|
for (const auto &item : m_fieldsToBackup)
|
||||||
|
{
|
||||||
|
if (key == "Conf/installationUuid")
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key.startsWith(item))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
for (const QString &key : m_settings.allKeys()) {
|
for (const QString &key : m_settings.allKeys()) {
|
||||||
if (key == "Conf/installationUuid") {
|
|
||||||
|
if (!needToBackup(key))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ private:
|
|||||||
mutable QMap<QString, QVariant> m_cache;
|
mutable QMap<QString, QVariant> m_cache;
|
||||||
|
|
||||||
QStringList encryptedKeys; // encode only key listed here
|
QStringList encryptedKeys; // encode only key listed here
|
||||||
|
// only this fields need for backup
|
||||||
|
QStringList m_fieldsToBackup = {
|
||||||
|
"Conf/", "Servers/",
|
||||||
|
};
|
||||||
|
|
||||||
mutable QByteArray m_key;
|
mutable QByteArray m_key;
|
||||||
mutable QByteArray m_iv;
|
mutable QByteArray m_iv;
|
||||||
|
|||||||
Reference in New Issue
Block a user