feat: Deployment Fingerprint (#30411)
parent
aab18ef654
commit
ec1b2b9846
@ -0,0 +1,10 @@ |
||||
--- |
||||
"@rocket.chat/meteor": minor |
||||
"@rocket.chat/core-typings": minor |
||||
"@rocket.chat/model-typings": minor |
||||
"@rocket.chat/rest-typings": minor |
||||
--- |
||||
|
||||
Create a deployment fingerprint to identify possible deployment changes caused by database cloning. A question to the admin will confirm if it's a regular deployment change or an intent of a new deployment and correct identification values as needed. |
||||
The fingerprint is composed by `${siteUrl}${dbConnectionString}` and hashed via `sha256` in `base64`. |
||||
An environment variable named `AUTO_ACCEPT_FINGERPRINT`, when set to `true`, can be used to auto-accept an expected fingerprint change as a regular deployment update. |
||||
@ -0,0 +1,44 @@ |
||||
import { Box } from '@rocket.chat/fuselage'; |
||||
import { useTranslation } from '@rocket.chat/ui-contexts'; |
||||
import type { ReactElement } from 'react'; |
||||
import React from 'react'; |
||||
|
||||
import GenericModal from './GenericModal'; |
||||
|
||||
type FingerprintChangeModalProps = { |
||||
onConfirm: () => void; |
||||
onCancel: () => void; |
||||
onClose: () => void; |
||||
}; |
||||
|
||||
const FingerprintChangeModal = ({ onConfirm, onCancel, onClose }: FingerprintChangeModalProps): ReactElement => { |
||||
const t = useTranslation(); |
||||
return ( |
||||
<GenericModal |
||||
variant='warning' |
||||
title={t('Unique_ID_change_detected')} |
||||
onConfirm={onConfirm} |
||||
onClose={onClose} |
||||
onCancel={onCancel} |
||||
confirmText={t('New_workspace')} |
||||
cancelText={t('Configuration_update')} |
||||
> |
||||
<Box |
||||
is='p' |
||||
mbe={16} |
||||
dangerouslySetInnerHTML={{ |
||||
__html: t('Unique_ID_change_detected_description'), |
||||
}} |
||||
/> |
||||
<Box |
||||
is='p' |
||||
mbe={16} |
||||
dangerouslySetInnerHTML={{ |
||||
__html: t('Unique_ID_change_detected_learn_more_link'), |
||||
}} |
||||
/> |
||||
</GenericModal> |
||||
); |
||||
}; |
||||
|
||||
export default FingerprintChangeModal; |
||||
@ -0,0 +1,47 @@ |
||||
import { Box } from '@rocket.chat/fuselage'; |
||||
import { useTranslation } from '@rocket.chat/ui-contexts'; |
||||
import type { ReactElement } from 'react'; |
||||
import React from 'react'; |
||||
|
||||
import GenericModal from './GenericModal'; |
||||
|
||||
type FingerprintChangeModalConfirmationProps = { |
||||
onConfirm: () => void; |
||||
onCancel: () => void; |
||||
newWorkspace: boolean; |
||||
}; |
||||
|
||||
const FingerprintChangeModalConfirmation = ({ |
||||
onConfirm, |
||||
onCancel, |
||||
newWorkspace, |
||||
}: FingerprintChangeModalConfirmationProps): ReactElement => { |
||||
const t = useTranslation(); |
||||
return ( |
||||
<GenericModal |
||||
variant='warning' |
||||
title={newWorkspace ? t('Confirm_new_workspace') : t('Confirm_configuration_update')} |
||||
onConfirm={onConfirm} |
||||
onCancel={onCancel} |
||||
cancelText={t('Back')} |
||||
confirmText={newWorkspace ? t('Confirm_new_workspace') : t('Confirm_configuration_update')} |
||||
> |
||||
<Box |
||||
is='p' |
||||
mbe={16} |
||||
dangerouslySetInnerHTML={{ |
||||
__html: newWorkspace ? t('Confirm_new_workspace_description') : t('Confirm_configuration_update_description'), |
||||
}} |
||||
/> |
||||
<Box |
||||
is='p' |
||||
mbe={16} |
||||
dangerouslySetInnerHTML={{ |
||||
__html: t('Unique_ID_change_detected_learn_more_link'), |
||||
}} |
||||
/> |
||||
</GenericModal> |
||||
); |
||||
}; |
||||
|
||||
export default FingerprintChangeModalConfirmation; |
||||
@ -0,0 +1,8 @@ |
||||
import type { LogLevelSetting } from '@rocket.chat/logger'; |
||||
import { logLevel } from '@rocket.chat/logger'; |
||||
import { Settings } from '@rocket.chat/models'; |
||||
|
||||
const LogLevel = await Settings.getValueById('Log_Level'); |
||||
if (LogLevel) { |
||||
logLevel.emit('changed', LogLevel as LogLevelSetting); |
||||
} |
||||
Loading…
Reference in new issue