mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Remove KeePassHTTP attribute conversion (#8007)
Co-authored-by: varjolintu <sami.vanttinen@protonmail.com>
This commit is contained in:
parent
55571b5d1b
commit
ce51534c3a
@ -892,52 +892,6 @@ Do you want to delete the entry?
|
||||
</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Converting attributes to custom data…</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Abort</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>KeePassXC: Converted KeePassHTTP attributes</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Successfully converted attributes from %1 entry(s).
|
||||
Moved %2 keys to custom data.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<source>Successfully moved %n keys to custom data.</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>KeePassXC: No entry with KeePassHTTP attributes found!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The active database does not contain an entry with KeePassHTTP attributes.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Don't show this warning again</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>KeePassXC: Legacy browser integration settings detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Your KeePassXC-Browser settings need to be moved into the database settings.
|
||||
This is necessary to maintain your current browser connections.
|
||||
Would you like to migrate your existing settings now?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BrowserSettingsWidget</name>
|
||||
@ -1646,14 +1600,6 @@ If you do not have a key file, please leave the field empty.</source>
|
||||
<source>KeePassXC-Browser settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Convert KeePassHTTP data</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Convert legacy KeePassHTTP attributes to KeePassXC-Browser compatible custom data</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refresh database root group ID</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -1763,15 +1709,6 @@ Permissions to access entries will be revoked.</source>
|
||||
<source>The active database does not contain an entry with permissions.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Move KeePassHTTP attributes to custom data</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Do you really want to convert all legacy browser integration data to the latest standard?
|
||||
This is necessary to maintain compatibility with the browser plugin.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refresh database ID</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Francois Ferrand
|
||||
* Copyright (C) 2022 KeePassXC Team <team@keepassxc.org>
|
||||
* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
|
||||
* Copyright (C) 2013 Francois Ferrand
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -781,79 +782,6 @@ BrowserService::searchEntries(const QString& siteUrl, const QString& formUrl, co
|
||||
return entries;
|
||||
}
|
||||
|
||||
void BrowserService::convertAttributesToCustomData(QSharedPointer<Database> db)
|
||||
{
|
||||
if (!db) {
|
||||
return;
|
||||
}
|
||||
|
||||
QList<Entry*> entries = db->rootGroup()->entriesRecursive();
|
||||
QProgressDialog progress(tr("Converting attributes to custom data…"), tr("Abort"), 0, entries.count());
|
||||
progress.setWindowModality(Qt::WindowModal);
|
||||
|
||||
int counter = 0;
|
||||
int keyCounter = 0;
|
||||
for (auto* entry : entries) {
|
||||
if (progress.wasCanceled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (moveSettingsToCustomData(entry, KEEPASSHTTP_NAME)) {
|
||||
++counter;
|
||||
}
|
||||
|
||||
if (moveSettingsToCustomData(entry, KEEPASSXCBROWSER_OLD_NAME)) {
|
||||
++counter;
|
||||
}
|
||||
|
||||
if (moveSettingsToCustomData(entry, KEEPASSXCBROWSER_NAME)) {
|
||||
++counter;
|
||||
}
|
||||
|
||||
if (entry->title() == KEEPASSHTTP_NAME || entry->title().contains(KEEPASSXCBROWSER_NAME, Qt::CaseInsensitive)) {
|
||||
keyCounter += moveKeysToCustomData(entry, db);
|
||||
db->recycleEntry(entry);
|
||||
}
|
||||
|
||||
progress.setValue(progress.value() + 1);
|
||||
}
|
||||
progress.reset();
|
||||
|
||||
if (counter > 0) {
|
||||
MessageBox::information(nullptr,
|
||||
tr("KeePassXC: Converted KeePassHTTP attributes"),
|
||||
tr("Successfully converted attributes from %1 entry(s).\n"
|
||||
"Moved %2 keys to custom data.",
|
||||
"")
|
||||
.arg(counter)
|
||||
.arg(keyCounter),
|
||||
MessageBox::Ok);
|
||||
} else if (counter == 0 && keyCounter > 0) {
|
||||
MessageBox::information(nullptr,
|
||||
tr("KeePassXC: Converted KeePassHTTP attributes"),
|
||||
tr("Successfully moved %n keys to custom data.", "", keyCounter),
|
||||
MessageBox::Ok);
|
||||
} else {
|
||||
MessageBox::information(nullptr,
|
||||
tr("KeePassXC: No entry with KeePassHTTP attributes found!"),
|
||||
tr("The active database does not contain an entry with KeePassHTTP attributes."),
|
||||
MessageBox::Ok);
|
||||
}
|
||||
|
||||
// Rename password groupName
|
||||
Group* rootGroup = db->rootGroup();
|
||||
if (!rootGroup) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto* g : rootGroup->groupsRecursive(true)) {
|
||||
if (g->name() == KEEPASSHTTP_GROUP_NAME) {
|
||||
g->setName(KEEPASSXCBROWSER_GROUP_NAME);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserService::requestGlobalAutoType(const QString& search)
|
||||
{
|
||||
emit osUtils->globalShortcutTriggered("autotype", search);
|
||||
@ -1264,84 +1192,6 @@ QSharedPointer<Database> BrowserService::selectedDatabase()
|
||||
return getDatabase();
|
||||
}
|
||||
|
||||
bool BrowserService::moveSettingsToCustomData(Entry* entry, const QString& name)
|
||||
{
|
||||
if (entry->attributes()->contains(name)) {
|
||||
QString attr = entry->attributes()->value(name);
|
||||
entry->beginUpdate();
|
||||
if (!attr.isEmpty()) {
|
||||
entry->customData()->set(KEEPASSXCBROWSER_NAME, attr);
|
||||
}
|
||||
entry->attributes()->remove(name);
|
||||
entry->endUpdate();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int BrowserService::moveKeysToCustomData(Entry* entry, QSharedPointer<Database> db)
|
||||
{
|
||||
int keyCounter = 0;
|
||||
for (const auto& key : entry->attributes()->keys()) {
|
||||
if (key.contains(CustomData::BrowserLegacyKeyPrefix)) {
|
||||
QString publicKey = key;
|
||||
publicKey.remove(CustomData::BrowserLegacyKeyPrefix);
|
||||
|
||||
// Add key to database custom data
|
||||
if (db && !db->metadata()->customData()->contains(CustomData::BrowserKeyPrefix + publicKey)) {
|
||||
db->metadata()->customData()->set(CustomData::BrowserKeyPrefix + publicKey,
|
||||
entry->attributes()->value(key));
|
||||
++keyCounter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return keyCounter;
|
||||
}
|
||||
|
||||
bool BrowserService::checkLegacySettings(QSharedPointer<Database> db)
|
||||
{
|
||||
if (!db || !browserSettings()->isEnabled() || browserSettings()->noMigrationPrompt()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool legacySettingsFound = false;
|
||||
QList<Entry*> entries = db->rootGroup()->entriesRecursive();
|
||||
for (const auto& e : entries) {
|
||||
if (e->isRecycled()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((e->attributes()->contains(KEEPASSHTTP_NAME) || e->attributes()->contains(KEEPASSXCBROWSER_NAME))
|
||||
|| (e->title() == KEEPASSHTTP_NAME || e->title().contains(KEEPASSXCBROWSER_NAME, Qt::CaseInsensitive))) {
|
||||
legacySettingsFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!legacySettingsFound) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto* checkbox = new QCheckBox(tr("Don't show this warning again"));
|
||||
QObject::connect(checkbox, &QCheckBox::stateChanged, [&](int state) {
|
||||
browserSettings()->setNoMigrationPrompt(static_cast<Qt::CheckState>(state) == Qt::CheckState::Checked);
|
||||
});
|
||||
|
||||
auto dialogResult =
|
||||
MessageBox::warning(nullptr,
|
||||
tr("KeePassXC: Legacy browser integration settings detected"),
|
||||
tr("Your KeePassXC-Browser settings need to be moved into the database settings.\n"
|
||||
"This is necessary to maintain your current browser connections.\n"
|
||||
"Would you like to migrate your existing settings now?"),
|
||||
MessageBox::Yes | MessageBox::No,
|
||||
MessageBox::NoButton,
|
||||
MessageBox::Raise,
|
||||
checkbox);
|
||||
|
||||
return dialogResult == MessageBox::Yes;
|
||||
}
|
||||
|
||||
QStringList BrowserService::getEntryURLs(const Entry* entry)
|
||||
{
|
||||
QStringList urlList;
|
||||
@ -1440,11 +1290,6 @@ void BrowserService::databaseUnlocked(DatabaseWidget* dbWidget)
|
||||
QJsonObject msg;
|
||||
msg["action"] = QString("database-unlocked");
|
||||
m_browserHost->broadcastClientMessage(msg);
|
||||
|
||||
auto db = dbWidget->database();
|
||||
if (checkLegacySettings(db)) {
|
||||
convertAttributesToCustomData(db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Francois Ferrand
|
||||
* Copyright (C) 2022 KeePassXC Team <team@keepassxc.org>
|
||||
* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
|
||||
* Copyright (C) 2013 Francois Ferrand
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -88,7 +89,6 @@ public:
|
||||
const StringPairList& keyList,
|
||||
const bool httpAuth = false);
|
||||
void requestGlobalAutoType(const QString& search);
|
||||
static void convertAttributesToCustomData(QSharedPointer<Database> db);
|
||||
|
||||
static const QString KEEPASSXCBROWSER_NAME;
|
||||
static const QString KEEPASSXCBROWSER_OLD_NAME;
|
||||
@ -157,16 +157,11 @@ private:
|
||||
QSharedPointer<Database> selectedDatabase();
|
||||
QString getDatabaseRootUuid();
|
||||
QString getDatabaseRecycleBinUuid();
|
||||
bool checkLegacySettings(QSharedPointer<Database> db);
|
||||
QStringList getEntryURLs(const Entry* entry);
|
||||
void hideWindow() const;
|
||||
void raiseWindow(const bool force = false);
|
||||
|
||||
void updateWindowState();
|
||||
|
||||
static bool moveSettingsToCustomData(Entry* entry, const QString& name);
|
||||
static int moveKeysToCustomData(Entry* entry, QSharedPointer<Database> db);
|
||||
|
||||
QPointer<BrowserHost> m_browserHost;
|
||||
QHash<QString, QSharedPointer<BrowserAction>> m_browserClients;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
|
||||
* Copyright (C) 2022 KeePassXC Team <team@keepassxc.org>
|
||||
* Copyright (C) 2018 Sami Vänttinen <sami.vanttinen@protonmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -48,8 +48,6 @@ DatabaseSettingsWidgetBrowser::DatabaseSettingsWidgetBrowser(QWidget* parent)
|
||||
// clang-format on
|
||||
|
||||
connect(m_ui->removeCustomDataButton, SIGNAL(clicked()), SLOT(removeSelectedKey()));
|
||||
connect(m_ui->convertToCustomData, SIGNAL(clicked()), this, SLOT(convertAttributesToCustomData()));
|
||||
connect(m_ui->convertToCustomData, SIGNAL(clicked()), this, SLOT(updateSharedKeyList()));
|
||||
connect(m_ui->removeSharedEncryptionKeys, SIGNAL(clicked()), this, SLOT(removeSharedEncryptionKeys()));
|
||||
connect(m_ui->removeSharedEncryptionKeys, SIGNAL(clicked()), this, SLOT(updateSharedKeyList()));
|
||||
connect(m_ui->removeStoredPermissions, SIGNAL(clicked()), this, SLOT(removeStoredPermissions()));
|
||||
@ -141,7 +139,6 @@ void DatabaseSettingsWidgetBrowser::updateModel()
|
||||
void DatabaseSettingsWidgetBrowser::settingsWarning()
|
||||
{
|
||||
if (!browserSettings()->isEnabled()) {
|
||||
m_ui->convertToCustomData->setEnabled(false);
|
||||
m_ui->removeSharedEncryptionKeys->setEnabled(false);
|
||||
m_ui->removeStoredPermissions->setEnabled(false);
|
||||
m_ui->customDataTable->setEnabled(false);
|
||||
@ -150,7 +147,6 @@ void DatabaseSettingsWidgetBrowser::settingsWarning()
|
||||
m_ui->warningWidget->setCloseButtonVisible(false);
|
||||
m_ui->warningWidget->setAutoHideTimeout(-1);
|
||||
} else {
|
||||
m_ui->convertToCustomData->setEnabled(true);
|
||||
m_ui->removeSharedEncryptionKeys->setEnabled(true);
|
||||
m_ui->removeStoredPermissions->setEnabled(true);
|
||||
m_ui->customDataTable->setEnabled(true);
|
||||
@ -242,22 +238,6 @@ void DatabaseSettingsWidgetBrowser::removeStoredPermissions()
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseSettingsWidgetBrowser::convertAttributesToCustomData()
|
||||
{
|
||||
if (MessageBox::Yes
|
||||
!= MessageBox::question(
|
||||
this,
|
||||
tr("Move KeePassHTTP attributes to custom data"),
|
||||
tr("Do you really want to convert all legacy browser integration data to the latest standard?\n"
|
||||
"This is necessary to maintain compatibility with the browser plugin."),
|
||||
MessageBox::Yes | MessageBox::Cancel,
|
||||
MessageBox::Cancel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
BrowserService::convertAttributesToCustomData(m_db);
|
||||
}
|
||||
|
||||
void DatabaseSettingsWidgetBrowser::refreshDatabaseID()
|
||||
{
|
||||
if (MessageBox::Yes
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
|
||||
* Copyright (C) 2022 KeePassXC Team <team@keepassxc.org>
|
||||
* Copyright (C) 2018 Sami Vänttinen <sami.vanttinen@protonmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -59,7 +59,6 @@ private slots:
|
||||
void updateSharedKeyList();
|
||||
void removeSharedEncryptionKeys();
|
||||
void removeStoredPermissions();
|
||||
void convertAttributesToCustomData();
|
||||
void refreshDatabaseID();
|
||||
void editIndex(const QModelIndex& index);
|
||||
void editFinished(QStandardItem* item);
|
||||
|
@ -51,35 +51,6 @@
|
||||
<string>KeePassXC-Browser settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="convertToCustomData">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Convert KeePassHTTP data</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Convert legacy KeePassHTTP attributes to KeePassXC-Browser compatible custom data</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="refreshDatabaseID">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Refresh database root group ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="removeSharedEncryptionKeys">
|
||||
<property name="sizePolicy">
|
||||
@ -106,6 +77,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="refreshDatabaseID">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Refresh database root group ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -186,7 +170,6 @@
|
||||
<tabstops>
|
||||
<tabstop>removeSharedEncryptionKeys</tabstop>
|
||||
<tabstop>removeStoredPermissions</tabstop>
|
||||
<tabstop>convertToCustomData</tabstop>
|
||||
<tabstop>refreshDatabaseID</tabstop>
|
||||
<tabstop>customDataTable</tabstop>
|
||||
<tabstop>removeCustomDataButton</tabstop>
|
||||
|
Loading…
Reference in New Issue
Block a user