mirror of
https://github.com/Safe-Support-Chat/ocrcc-chatbox
synced 2024-11-22 02:34:55 +00:00
use legacy olm to git rid of dep on olm.wasm
This commit is contained in:
parent
59c65064fa
commit
774d5be1ba
33
dist/bookmarklet.js
vendored
33
dist/bookmarklet.js
vendored
File diff suppressed because one or more lines are too long
33
dist/chatbox.js
vendored
33
dist/chatbox.js
vendored
File diff suppressed because one or more lines are too long
@ -6,7 +6,7 @@ import * as os from "os";
|
|||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { LocalStorage } from "node-localstorage";
|
import { LocalStorage } from "node-localstorage";
|
||||||
import * as olm from "olm"
|
import * as olm from "olm/olm_legacy.js"
|
||||||
global.Olm = olm
|
global.Olm = olm
|
||||||
|
|
||||||
import * as matrix from "matrix-js-sdk";
|
import * as matrix from "matrix-js-sdk";
|
||||||
@ -25,6 +25,7 @@ const ENCRYPTION_NOTICE = "Messages in this chat are secured with end-to-end enc
|
|||||||
const UNENCRYPTION_NOTICE = "Messages in this chat are not encrypted."
|
const UNENCRYPTION_NOTICE = "Messages in this chat are not encrypted."
|
||||||
const RESTARTING_UNENCRYPTED_CHAT_MESSAGE = "Restarting chat without encryption."
|
const RESTARTING_UNENCRYPTED_CHAT_MESSAGE = "Restarting chat without encryption."
|
||||||
const WAIT_TIME_MS = 120000 // 2 minutes
|
const WAIT_TIME_MS = 120000 // 2 minutes
|
||||||
|
const CHAT_IS_OFFLINE_NOTICE = "Chat is offline"
|
||||||
|
|
||||||
const DEFAULT_MATRIX_SERVER = "https://matrix.rhok.space/"
|
const DEFAULT_MATRIX_SERVER = "https://matrix.rhok.space/"
|
||||||
const DEFAULT_BOT_ID = "@help-bot:rhok.space"
|
const DEFAULT_BOT_ID = "@help-bot:rhok.space"
|
||||||
@ -483,15 +484,22 @@ class ChatBox extends React.Component {
|
|||||||
if (eventType === "m.room.member" && content.membership === "join" && sender !== this.props.botId && sender !== this.state.userId) {
|
if (eventType === "m.room.member" && content.membership === "join" && sender !== this.props.botId && sender !== this.state.userId) {
|
||||||
this.verifyAllRoomDevices(client, room)
|
this.verifyAllRoomDevices(client, room)
|
||||||
this.setState({ facilitatorId: sender, ready: true })
|
this.setState({ facilitatorId: sender, ready: true })
|
||||||
window.clearTimeout(this.state.timeoutId)
|
window.clearInterval(this.state.timeoutId)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
client.on("Event.decrypted", (event, err) => {
|
client.on("Event.decrypted", (event, err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return this.handleDecryptionError(event, err)
|
return this.handleDecryptionError(event, err)
|
||||||
}
|
}
|
||||||
if (event.getType() === "m.room.message") {
|
if (event.getType() === "m.room.message") {
|
||||||
|
const content = event.getContent()
|
||||||
|
|
||||||
|
if (content.msgtype === "m.notice" && content.body === CHAT_IS_OFFLINE_NOTICE) {
|
||||||
|
this.setState({ ready: true })
|
||||||
|
return window.clearInterval(this.state.timeoutId)
|
||||||
|
}
|
||||||
this.handleMessageEvent(event)
|
this.handleMessageEvent(event)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const increaseSpecificity = require('postcss-increase-specificity');
|
const increaseSpecificity = require('postcss-increase-specificity');
|
||||||
const autoprefixer = require('autoprefixer');
|
const autoprefixer = require('autoprefixer');
|
||||||
const JavaScriptObfuscator = require('webpack-obfuscator');
|
|
||||||
const CopyPlugin = require('copy-webpack-plugin');
|
const CopyPlugin = require('copy-webpack-plugin');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
@ -27,8 +26,7 @@ const defaultConfig = {
|
|||||||
new CopyPlugin([
|
new CopyPlugin([
|
||||||
{ from: 'public', to: '.' },
|
{ from: 'public', to: '.' },
|
||||||
]),
|
]),
|
||||||
devMode ? null : new JavaScriptObfuscator(),
|
],
|
||||||
].filter(i => i),
|
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user