diff --git a/public/index.html b/public/index.html
index 059bc37..8704ad3 100644
--- a/public/index.html
+++ b/public/index.html
@@ -23,6 +23,7 @@
exitMessage: 'The chat is closed. You may close this window.',
chatUnavailableMessage: 'The chat service is not available right now. Please try again later.',
anonymousDisplayName: 'Anonymous',
+ enableEncryption: 'no',
}
EmbeddableChatbox.mount(config);
diff --git a/src/components/chatbox.jsx b/src/components/chatbox.jsx
index e49168e..6f5fc5b 100644
--- a/src/components/chatbox.jsx
+++ b/src/components/chatbox.jsx
@@ -38,6 +38,7 @@ const DEFAULT_EXIT_MESSAGE = "The chat is closed. You may close this window."
const DEFAULT_ANONYMOUS_DISPLAY_NAME="Anonymous"
const DEFAULT_CHAT_UNAVAILABLE_MESSAGE = "The chat service is not available right now. Please try again later."
const DEFAULT_WAIT_MESSAGE = "Please be patient, our online facilitators are currently responding to other support requests."
+const DEFAULT_ENCRYPTION = "yes"
class ChatBox extends React.Component {
@@ -229,9 +230,13 @@ class ChatBox extends React.Component {
client.setDisplayName(this.props.anonymousDisplayName)
this.setMatrixListeners(client)
- try {
- await client.initCrypto()
- } catch(err) {
+ if(this.props.enableEncryption == "yes"){
+ try {
+ await client.initCrypto()
+ } catch(err) {
+ return this.initializeUnencryptedChat()
+ }
+ }else{
return this.initializeUnencryptedChat()
}
@@ -257,7 +262,9 @@ class ChatBox extends React.Component {
isCryptoEnabled: false,
})
- this.displayBotMessage({ body: RESTARTING_UNENCRYPTED_CHAT_MESSAGE })
+ if(this.props.enableEncryption == "yes"){
+ this.displayBotMessage({ body: RESTARTING_UNENCRYPTED_CHAT_MESSAGE })
+ }
let opts = {
baseUrl: this.props.matrixServerUrl,
@@ -277,7 +284,9 @@ class ChatBox extends React.Component {
client.setDisplayName(this.props.anonymousDisplayName)
await this.createRoom(client)
await client.startClient()
- this.displayBotMessage({ body: UNENCRYPTION_NOTICE })
+ if(this.props.enableEncryption == "yes"){
+ this.displayBotMessage({ body: UNENCRYPTION_NOTICE })
+ }
} catch(err) {
console.log("error", err)
this.handleInitError(err)
@@ -715,6 +724,7 @@ ChatBox.propTypes = {
chatUnavailableMessage: PropTypes.string,
anonymousDisplayName: PropTypes.string,
waitMessage: PropTypes.string,
+ enableEncryption: PropTypes.string,
}
ChatBox.defaultProps = {
@@ -729,6 +739,7 @@ ChatBox.defaultProps = {
anonymousDisplayName: DEFAULT_ANONYMOUS_DISPLAY_NAME,
chatUnavailableMessage: DEFAULT_CHAT_UNAVAILABLE_MESSAGE,
waitMessage: DEFAULT_WAIT_MESSAGE,
+ enableEncryption: DEFAULT_ENCRYPTION,
}
export default ChatBox;
diff --git a/src/outputs/bookmarklet.js b/src/outputs/bookmarklet.js
index 0b8359e..25371ed 100644
--- a/src/outputs/bookmarklet.js
+++ b/src/outputs/bookmarklet.js
@@ -11,6 +11,7 @@ const config = {
exitMessage: 'The chat is closed. You may close this window.',
chatUnavailableMessage: 'The chat service is not available right now. Please try again later.',
anonymousDisplayName: 'Anonymous',
+ enableEncryption: 'no',
}
export default function bookmarklet() {