Compare commits

..

3 Commits

Author SHA1 Message Date
Dave Umrysh
8e6f80326b committing build files 2021-08-25 15:38:01 -06:00
Dave Umrysh
f95aef64d0 update readme about encryption.Fix bookmarlet syntax 2021-08-25 15:37:00 -06:00
Dave Umrysh
a91ca1a092 add a flag to disable encryption by default 2021-08-25 15:29:44 -06:00
8 changed files with 66 additions and 55 deletions

View File

@ -23,6 +23,7 @@ Built on:
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: 'yes',
}
EmbeddableChatbox.mount(config);
@ -41,6 +42,7 @@ Options:
| `exitMessage` (optional) | Text to show if the user rejects the Terms of Use. | `The chat is closed. You may close this window.` |
| `anonymousDisplayName` (optional) | The display name for the chat user. | `Anonymous` |
| `chatUnavailableMessage` (optional) | Text to show if no-one is available to respond | `The chat service is not available right now. Please try again later.` |
| `enableEncryption` (optional) | if set to "yes" then the chat will be encrypted by default | `yes` |
## Feature list
@ -80,7 +82,7 @@ You can try this out on the [live demo](https://nomadic-labs.github.io/safesuppo
Clone the project:
```
git clone https://github.com/nomadic-labs/safesupport-chatbox.git
git clone https://git.umycode.com/dave/safesupport-chatbox.git
```
Install the dependencies:
```

12
dist/bookmarklet.js vendored

File diff suppressed because one or more lines are too long

12
dist/chatbox.js vendored

File diff suppressed because one or more lines are too long

1
dist/index.html vendored
View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -1,17 +1,18 @@
import EmbeddableChatbox from './embeddable-chatbox';
const config = {
matrixServerUrl: 'https://matrix.safesupport.chat',
botId: '@help-bot:safesupport.chat',
roomName: 'Support Chat',
termsUrl: 'https://tosdr.org/',
introMessage: "This chat application does not collect any of your personal data or any data from your use of this service.",
agreementMessage: 'Do you want to continue?',
confirmationMessage: 'Waiting for a facilitator to join the chat...',
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',
}
matrixServerUrl: 'https://matrix.safesupport.chat',
botId: '@help-bot:safesupport.chat',
roomName: 'Support Chat',
termsUrl: 'https://tosdr.org/',
introMessage: 'This chat application does not collect any of your personal data or any data from your use of this service.',
agreementMessage: 'Do you want to continue?',
confirmationMessage: 'Waiting for a facilitator to join the chat...',
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() {
if (window.EmbeddableChatbox) {

View File

@ -2445,10 +2445,10 @@ bluebird@^3.5.5:
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.11.9:
version "4.12.0"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88"
integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==
bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0:
version "4.11.8"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f"
integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==
body-parser@1.19.0:
version "1.19.0"
@ -2514,7 +2514,7 @@ braces@^3.0.1:
dependencies:
fill-range "^7.0.1"
brorand@^1.0.1, brorand@^1.1.0:
brorand@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=
@ -2763,15 +2763,10 @@ camelcase@^5.0.0, camelcase@^5.3.1:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
caniuse-lite@^1.0.30001023:
version "1.0.30001023"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001023.tgz#b82155827f3f5009077bdd2df3d8968bcbcc6fc4"
integrity sha512-C5TDMiYG11EOhVOA62W1p3UsJ2z4DsHtMBQtjzp3ZsUglcQn62WOUgW0y795c7A5uZ+GCEIvzkMatLIlAsbNTA==
caniuse-lite@^1.0.30001036, caniuse-lite@^1.0.30001038:
version "1.0.30001038"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001038.tgz#44da3cbca2ab6cb6aa83d1be5d324e17f141caff"
integrity sha512-zii9quPo96XfOiRD4TrfYGs+QsGZpb2cGiMAzPjtf/hpFgB6zCPZgJb7I1+EATeMw/o+lG8FyRAnI+CWStHcaQ==
caniuse-lite@^1.0.30001023, caniuse-lite@^1.0.30001036, caniuse-lite@^1.0.30001038:
version "1.0.30001251"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz"
integrity sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A==
capture-exit@^2.0.0:
version "2.0.0"
@ -3732,17 +3727,17 @@ electron-to-chromium@^1.3.390:
integrity sha512-/hsgeVdReDsyTBE0aU9FRdh1wnNPrX3xlz3t61F+CJPOT+Umfi9DXHsCX85TEgWZQqlow0Rw44/4/jbU2Sqgkg==
elliptic@^6.0.0:
version "6.5.4"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb"
integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==
version "6.5.2"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.2.tgz#05c5678d7173c049d8ca433552224a495d0e3762"
integrity sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==
dependencies:
bn.js "^4.11.9"
brorand "^1.1.0"
bn.js "^4.4.0"
brorand "^1.0.1"
hash.js "^1.0.0"
hmac-drbg "^1.0.1"
inherits "^2.0.4"
minimalistic-assert "^1.0.1"
minimalistic-crypto-utils "^1.0.1"
hmac-drbg "^1.0.0"
inherits "^2.0.1"
minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.0"
email-addresses@^3.0.1:
version "3.1.0"
@ -5051,7 +5046,7 @@ hash.js@^1.0.0, hash.js@^1.0.3:
inherits "^2.0.3"
minimalistic-assert "^1.0.1"
hmac-drbg@^1.0.1:
hmac-drbg@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=
@ -5334,7 +5329,7 @@ inflight@^1.0.4:
once "^1.3.0"
wrappy "1"
inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3:
inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
@ -6872,7 +6867,7 @@ minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1:
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7"
integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==
minimalistic-crypto-utils@^1.0.1:
minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=