mirror of
https://github.com/outbackdingo/amnezia-client.git
synced 2026-01-27 02:18:09 +00:00
Filter settings fields to backup
This commit is contained in:
@@ -124,8 +124,27 @@ QByteArray SecureQSettings::backupAppConfig() const
|
||||
{
|
||||
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()) {
|
||||
if (key == "Conf/installationUuid") {
|
||||
|
||||
if (!needToBackup(key))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,10 @@ private:
|
||||
mutable QMap<QString, QVariant> m_cache;
|
||||
|
||||
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_iv;
|
||||
|
||||
Reference in New Issue
Block a user