Support remote database access using external tools (#7222)

* Provide remote database sync capability

Allow arbitrary commands to be defined and executed for syncing databases with remote services. This includes sftp, scp, rsync, etc. 

Remote commands are stored per-database and sync operations are manually triggered by the user from the Database -> Remote Sync menu. 

---------

Co-authored-by: Stefan Forstenlechner <t-h-e@users.noreply.github.com>
Co-authored-by: Jonathan White <support@dmapps.us>
This commit is contained in:
sforst 2024-06-13 12:23:41 +02:00 committed by GitHub
parent ad8a00d56b
commit 1ca607792d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 1780 additions and 21 deletions

View file

@ -19,7 +19,6 @@
#ifndef KEEPASSX_DATABASEWIDGET_H
#define KEEPASSX_DATABASEWIDGET_H
#include <QBuffer>
#include <QStackedWidget>
#include "core/Database.h"
@ -27,6 +26,7 @@
#include "core/Metadata.h"
#include "gui/MessageWidget.h"
#include "gui/entry/EntryModel.h"
#include "remote/RemoteHandler.h"
class DatabaseOpenDialog;
class DatabaseOpenWidget;
@ -45,6 +45,8 @@ class QLabel;
class EntryPreviewWidget;
class TagView;
class ElidedLabel;
class RemoteSettings;
struct RemoteParams;
namespace Ui
{
@ -122,6 +124,10 @@ public:
void setSplitterSizes(const QHash<Config::ConfigKey, QList<int>>& sizes);
void setSearchStringForAutoType(const QString& search);
void syncWithRemote(const RemoteParams* params);
void syncDatabaseWithLockedDatabase(const QString& filePath, const RemoteParams* params);
QList<RemoteParams*> getRemoteParams() const;
signals:
// relayed Database signals
void databaseFilePathChanged(const QString& oldPath, const QString& newPath);
@ -142,6 +148,13 @@ signals:
void
requestOpenDatabase(const QString& filePath, bool inBackground, const QString& password, const QString& keyFile);
void databaseMerged(QSharedPointer<Database> mergedDb);
void databaseSyncInProgress();
void databaseSyncCompleted(const QString& syncName);
void databaseSyncFailed(const QString& syncName, const QString& error);
void databaseSyncUnlockFailed(const RemoteHandler::RemoteResult& result);
void databaseSyncUnlocked(const RemoteHandler::RemoteResult& result);
void unlockDatabaseInDialogForSync(const QString& filePath);
void updateSyncProgress(int percentage, QString message);
void groupContextMenuRequested(const QPoint& globalPos);
void entryContextMenuRequested(const QPoint& globalPos);
void listModeAboutToActivate();
@ -209,6 +222,7 @@ public slots:
void switchToDatabaseSecurity();
void switchToDatabaseReports();
void switchToDatabaseSettings();
void switchToRemoteSettings();
#ifdef WITH_XC_BROWSER_PASSKEYS
void switchToPasskeys();
void showImportPasskeyDialog(bool isEntry = false);
@ -260,6 +274,10 @@ private slots:
void loadDatabase(bool accepted);
void unlockDatabase(bool accepted);
void mergeDatabase(bool accepted);
void syncUnlockedDatabase(bool accepted);
bool syncWithDatabase(const QSharedPointer<Database>& otherDb, QString& error);
void uploadAndFinishSync(const RemoteParams* params, RemoteHandler::RemoteResult result);
void finishSync(const RemoteParams* params, RemoteHandler::RemoteResult result);
void emitCurrentModeChanged();
// Database autoreload slots
void reloadDatabaseFile();
@ -302,6 +320,8 @@ private:
int m_saveAttempts;
QScopedPointer<RemoteSettings> m_remoteSettings;
// Search state
QScopedPointer<EntrySearcher> m_entrySearcher;
QString m_lastSearchText;