diff --git a/client/src/builtin/E2EE.js b/client/src/builtin/E2EE.js index 0ca2c0f3..c0c6a658 100644 --- a/client/src/builtin/E2EE.js +++ b/client/src/builtin/E2EE.js @@ -22,6 +22,7 @@ export default new class E2EE extends BuiltinModule { constructor() { super(); this.master = this.encrypt(seed, 'temporarymasterkey'); + this.encryptNewMessages = true; } setMaster(key) { @@ -36,7 +37,7 @@ export default new class E2EE extends BuiltinModule { } get database() { - return Settings.getSet('security').settings.find(s => s.id === 'e2eedb').settings[0].value; + return Settings.getSetting('security', 'e2eedb', 'e2ekvps').value; } encrypt(key, content, prefix = '') { @@ -109,7 +110,7 @@ export default new class E2EE extends BuiltinModule { handleChannelTextAreaSubmit(component, args, retVal) { const key = this.getKey(DiscordApi.currentChannel.id); - if (!key) return; + if (!this.encryptNewMessages || !key) return; component.props.value = this.encrypt(this.decrypt(this.decrypt(seed, this.master), key), component.props.value, '$:'); } diff --git a/client/src/builtin/E2EEComponent.vue b/client/src/builtin/E2EEComponent.vue index 18228efa..cd8fdb38 100644 --- a/client/src/builtin/E2EEComponent.vue +++ b/client/src/builtin/E2EEComponent.vue @@ -10,21 +10,19 @@ @@ -33,10 +31,12 @@ import { E2EE } from 'builtin'; import { DiscordApi } from 'modules'; import { MiLock } from '../ui/components/common/MaterialIcon'; + export default { components: { MiLock }, data() { return { + E2EE, state: 'loading', error: null };