Skip to content

Commit

Permalink
feat(xo-web): show encryption status of a remote
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeauchamp committed Oct 19, 2022
1 parent 3b38d59 commit 879a237
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/xo-web/src/common/intl/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
33 changes: 33 additions & 0 deletions packages/xo-web/src/xo-app/settings/remotes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? <Icon size='lg' icon='lock' /> : null
} else {
// not encrypted
if (remote.info.encryption.algorithm === 'none') {
return null
}
const { algorithm, isLegacy, recommendedAlgorithm } = remote.info.encryption
return (
<span>
<Tooltip content={algorithm}>
<Icon icon='lock' size='lg' />
</Tooltip>

{isLegacy && (
<Tooltip content={_('remoteEncryptionLegacy', { algorithm, recommendedAlgorithm })}>
<Icon icon='error' size='lg' />
</Tooltip>
)}
</span>
)
}
},
name: _('remoteEncryption'),
}

const fixRemoteUrl = remote => editRemote(remote, { url: format(remote) })
const COLUMNS_LOCAL_REMOTE = [
COLUMN_NAME,
Expand All @@ -141,6 +170,7 @@ const COLUMNS_LOCAL_REMOTE = [
},
COLUMN_STATE,
COLUMN_DISK,
COLUMN_ENCRYPTION,
COLUMN_SPEED,
COLUMN_PROXY,
]
Expand Down Expand Up @@ -198,6 +228,7 @@ const COLUMNS_NFS_REMOTE = [
},
COLUMN_STATE,
COLUMN_DISK,
COLUMN_ENCRYPTION,
COLUMN_SPEED,
COLUMN_PROXY,
]
Expand Down Expand Up @@ -245,6 +276,7 @@ const COLUMNS_SMB_REMOTE = [
),
name: _('remoteAuth'),
},
COLUMN_ENCRYPTION,
COLUMN_SPEED,
COLUMN_PROXY,
]
Expand Down Expand Up @@ -300,6 +332,7 @@ const COLUMNS_S3_REMOTE = [
),
name: 'Key',
},
COLUMN_ENCRYPTION,
COLUMN_SPEED,
COLUMN_PROXY,
]
Expand Down

0 comments on commit 879a237

Please sign in to comment.