forked from Github/ocrcc-chatbox
disable encryption flag
This commit is contained in:
parent
eae9c737d7
commit
758af0c29b
@ -23,6 +23,7 @@ Built on:
|
|||||||
exitMessage: 'The chat is closed. You may close this window.',
|
exitMessage: 'The chat is closed. You may close this window.',
|
||||||
chatUnavailableMessage: 'The chat service is not available right now. Please try again later.',
|
chatUnavailableMessage: 'The chat service is not available right now. Please try again later.',
|
||||||
anonymousDisplayName: 'Anonymous',
|
anonymousDisplayName: 'Anonymous',
|
||||||
|
enableEncryption: 'yes',
|
||||||
}
|
}
|
||||||
|
|
||||||
EmbeddableChatbox.mount(config);
|
EmbeddableChatbox.mount(config);
|
||||||
@ -46,6 +47,7 @@ Options:
|
|||||||
| `size` (optional) | The size of the start button. Can be 'small' or 'large' | `large` |
|
| `size` (optional) | The size of the start button. Can be 'small' or 'large' | `large` |
|
||||||
| `position` (optional) | The position of the start button. Can be 'top left', 'top right', 'bottom left', 'bottom right'. | `bottom right` |
|
| `position` (optional) | The position of the start button. Can be 'top left', 'top right', 'bottom left', 'bottom right'. | `bottom right` |
|
||||||
| `waitInterval` (optional) | The interval (in ms) at which the bot sends the wait message | 120000 |
|
| `waitInterval` (optional) | The interval (in ms) at which the bot sends the wait message | 120000 |
|
||||||
|
| `enableEncryption` (optional) | if set to "yes" then the chat will be encrypted by default | `yes` |
|
||||||
|
|
||||||
|
|
||||||
## Feature list
|
## Feature list
|
||||||
@ -86,7 +88,7 @@ You can try this out on the [live demo](https://nomadic-labs.github.io/safesuppo
|
|||||||
|
|
||||||
Clone the project:
|
Clone the project:
|
||||||
```
|
```
|
||||||
git clone https://github.com/Safe-Support-Chat/ocrcc-chatbox.git
|
git clone https://git.umycode.com/dave/ocrcc-chatbox.git
|
||||||
```
|
```
|
||||||
Install the dependencies:
|
Install the dependencies:
|
||||||
```
|
```
|
||||||
|
@ -221,9 +221,14 @@ class ChatBox extends React.Component {
|
|||||||
this.setState({ ready: false })
|
this.setState({ ready: false })
|
||||||
|
|
||||||
const client = await this.createClientWithAccount()
|
const client = await this.createClientWithAccount()
|
||||||
try {
|
|
||||||
await client.initCrypto()
|
if(this.props.enableEncryption == "yes"){
|
||||||
} catch(err) {
|
try {
|
||||||
|
await client.initCrypto()
|
||||||
|
} catch(err) {
|
||||||
|
return this.restartWithoutCrypto()
|
||||||
|
}
|
||||||
|
}else{
|
||||||
return this.restartWithoutCrypto()
|
return this.restartWithoutCrypto()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +262,9 @@ class ChatBox extends React.Component {
|
|||||||
isCryptoEnabled: false,
|
isCryptoEnabled: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
this.displayBotMessage({ body: RESTARTING_UNENCRYPTED_CHAT_MESSAGE })
|
if(this.props.enableEncryption == "yes"){
|
||||||
|
this.displayBotMessage({ body: RESTARTING_UNENCRYPTED_CHAT_MESSAGE })
|
||||||
|
}
|
||||||
|
|
||||||
let opts = {
|
let opts = {
|
||||||
baseUrl: this.props.matrixServerUrl,
|
baseUrl: this.props.matrixServerUrl,
|
||||||
@ -277,7 +284,9 @@ class ChatBox extends React.Component {
|
|||||||
client.setDisplayName(this.props.displayName)
|
client.setDisplayName(this.props.displayName)
|
||||||
this.setMatrixListeners(client)
|
this.setMatrixListeners(client)
|
||||||
await this.createRoom(client)
|
await this.createRoom(client)
|
||||||
this.displayBotMessage({ body: UNENCRYPTION_NOTICE })
|
if(this.props.enableEncryption == "yes"){
|
||||||
|
this.displayBotMessage({ body: UNENCRYPTION_NOTICE })
|
||||||
|
}
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.log("error", err)
|
console.log("error", err)
|
||||||
this.handleInitError(err)
|
this.handleInitError(err)
|
||||||
@ -767,6 +776,7 @@ ChatBox.propTypes = {
|
|||||||
chatUnavailableMessage: PropTypes.string,
|
chatUnavailableMessage: PropTypes.string,
|
||||||
displayName: PropTypes.string,
|
displayName: PropTypes.string,
|
||||||
waitMessage: PropTypes.string,
|
waitMessage: PropTypes.string,
|
||||||
|
enableEncryption: PropTypes.string,
|
||||||
chatOfflineMessage: PropTypes.string,
|
chatOfflineMessage: PropTypes.string,
|
||||||
isEncryptionDisabled: PropTypes.bool,
|
isEncryptionDisabled: PropTypes.bool,
|
||||||
position: PropTypes.oneOf(['top left', 'top right', 'bottom left', 'bottom right']),
|
position: PropTypes.oneOf(['top left', 'top right', 'bottom left', 'bottom right']),
|
||||||
|
@ -15,6 +15,7 @@ const DEFAULT_WAIT_INTERVAL_MS = 120000; // 2 minutes
|
|||||||
const DEFAULT_DOCK_LABEL = 'Start a new chat';
|
const DEFAULT_DOCK_LABEL = 'Start a new chat';
|
||||||
const DEFAULT_ENABLED = true;
|
const DEFAULT_ENABLED = true;
|
||||||
const DEFAULT_AVAILABLE = true;
|
const DEFAULT_AVAILABLE = true;
|
||||||
|
const DEFAULT_ENCRYPTION = "yes"
|
||||||
|
|
||||||
const defaultConfig = {
|
const defaultConfig = {
|
||||||
termsUrl: DEFAULT_TERMS_URL,
|
termsUrl: DEFAULT_TERMS_URL,
|
||||||
@ -26,6 +27,7 @@ const defaultConfig = {
|
|||||||
displayName: DEFAULT_DISPLAY_NAME,
|
displayName: DEFAULT_DISPLAY_NAME,
|
||||||
chatUnavailableMessage: DEFAULT_CHAT_UNAVAILABLE_MESSAGE,
|
chatUnavailableMessage: DEFAULT_CHAT_UNAVAILABLE_MESSAGE,
|
||||||
waitMessage: DEFAULT_WAIT_MESSAGE,
|
waitMessage: DEFAULT_WAIT_MESSAGE,
|
||||||
|
enableEncryption: DEFAULT_ENCRYPTION,
|
||||||
chatOfflineMessage: DEFAULT_CHAT_OFFLINE_MESSAGE,
|
chatOfflineMessage: DEFAULT_CHAT_OFFLINE_MESSAGE,
|
||||||
isEncryptionDisabled: DEFAULT_ENCRYPTION_DISABLED,
|
isEncryptionDisabled: DEFAULT_ENCRYPTION_DISABLED,
|
||||||
position: DEFAULT_POSITION,
|
position: DEFAULT_POSITION,
|
||||||
|
Loading…
Reference in New Issue
Block a user