From 879a237d26025c16a29b17c7f7ffcf2f8601a81b Mon Sep 17 00:00:00 2001 From: Florent Beauchamp Date: Wed, 19 Oct 2022 10:01:38 +0200 Subject: [PATCH] feat(xo-web): show encryption status of a remote --- packages/xo-web/src/common/intl/messages.js | 4 +++ .../src/xo-app/settings/remotes/index.js | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/packages/xo-web/src/common/intl/messages.js b/packages/xo-web/src/common/intl/messages.js index dd7f7bbbbbc..e0d59799124 100644 --- a/packages/xo-web/src/common/intl/messages.js +++ b/packages/xo-web/src/common/intl/messages.js @@ -611,6 +611,10 @@ const messages = { remoteEncryptionKey: 'Encrypt all new data sent to this remote', remoteEncryptionKeyStorageLocation: "You won't be able to get your data back if you lose the encryption key. The encryption key is saved in the XO config backup, they should be secured correctly. Be careful, if you saved it on an encrypted remote, then you won't be able to access it without the remote encryption key.", + remoteEncryption: 'Encryption', + remoteEncryptionLegacy: + 'A legacy encryption algorithm is used ({algorithm}), please create a new remote with the recommanded algorithm {recommendedAlgorithm}', + // ------ New Storage ----- newSr: 'New SR', diff --git a/packages/xo-web/src/xo-app/settings/remotes/index.js b/packages/xo-web/src/xo-app/settings/remotes/index.js index d3bc93383ee..74b4eb4046d 100644 --- a/packages/xo-web/src/xo-app/settings/remotes/index.js +++ b/packages/xo-web/src/xo-app/settings/remotes/index.js @@ -124,6 +124,35 @@ const COLUMN_PROXY = { name: _('proxy'), } +const COLUMN_ENCRYPTION = { + itemRenderer: remote => { + // remote is not sync, not a lot of data + if (remote.info?.encryption === undefined) { + return remote.encryptionKey !== undefined ? : null + } else { + // not encrypted + if (remote.info.encryption.algorithm === 'none') { + return null + } + const { algorithm, isLegacy, recommendedAlgorithm } = remote.info.encryption + return ( + + + + + + {isLegacy && ( + + + + )} + + ) + } + }, + name: _('remoteEncryption'), +} + const fixRemoteUrl = remote => editRemote(remote, { url: format(remote) }) const COLUMNS_LOCAL_REMOTE = [ COLUMN_NAME, @@ -141,6 +170,7 @@ const COLUMNS_LOCAL_REMOTE = [ }, COLUMN_STATE, COLUMN_DISK, + COLUMN_ENCRYPTION, COLUMN_SPEED, COLUMN_PROXY, ] @@ -198,6 +228,7 @@ const COLUMNS_NFS_REMOTE = [ }, COLUMN_STATE, COLUMN_DISK, + COLUMN_ENCRYPTION, COLUMN_SPEED, COLUMN_PROXY, ] @@ -245,6 +276,7 @@ const COLUMNS_SMB_REMOTE = [ ), name: _('remoteAuth'), }, + COLUMN_ENCRYPTION, COLUMN_SPEED, COLUMN_PROXY, ] @@ -300,6 +332,7 @@ const COLUMNS_S3_REMOTE = [ ), name: 'Key', }, + COLUMN_ENCRYPTION, COLUMN_SPEED, COLUMN_PROXY, ]