mirror of
https://github.com/Skylar-Tech/node-red-contrib-matrix-chat.git
synced 2025-04-20 04:53:06 -06:00
- Upgraded to rust crypto but old libolm data will not migrate
This commit is contained in:
parent
512b7320d5
commit
db14bd96a7
21625
package-lock.json
generated
21625
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,7 @@
|
|||||||
"version": "0.8.0",
|
"version": "0.8.0",
|
||||||
"description": "Matrix chat server client for Node-RED",
|
"description": "Matrix chat server client for Node-RED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@matrix-org/matrix-sdk-crypto-nodejs": "^0.2.0-beta.1",
|
||||||
"abort-controller": "^3.0.0",
|
"abort-controller": "^3.0.0",
|
||||||
"fluent-ffmpeg": "^2.1.2",
|
"fluent-ffmpeg": "^2.1.2",
|
||||||
"fs-extra": "^11.1.0",
|
"fs-extra": "^11.1.0",
|
||||||
@ -14,7 +15,6 @@
|
|||||||
"node-fetch": "^3.3.0",
|
"node-fetch": "^3.3.0",
|
||||||
"node-localstorage": "^2.2.1",
|
"node-localstorage": "^2.2.1",
|
||||||
"olm": "https://gitlab.matrix.org/matrix-org/olm/-/package_files/2572/download",
|
"olm": "https://gitlab.matrix.org/matrix-org/olm/-/package_files/2572/download",
|
||||||
"request": "^2.88.2",
|
|
||||||
"sharp": "^0.33.4",
|
"sharp": "^0.33.4",
|
||||||
"tmp": "^0.2.1",
|
"tmp": "^0.2.1",
|
||||||
"utf8": "^3.0.0"
|
"utf8": "^3.0.0"
|
||||||
|
@ -2,7 +2,7 @@ global.Olm = require('olm');
|
|||||||
const fs = require("fs-extra");
|
const fs = require("fs-extra");
|
||||||
const { resolve } = require('path');
|
const { resolve } = require('path');
|
||||||
const { LocalStorage } = require('node-localstorage');
|
const { LocalStorage } = require('node-localstorage');
|
||||||
const request = require("request");
|
globalThis.crypto = require('crypto');
|
||||||
require("abort-controller/polyfill"); // polyfill abort-controller if we don't have it
|
require("abort-controller/polyfill"); // polyfill abort-controller if we don't have it
|
||||||
|
|
||||||
if (!globalThis.fetch) {
|
if (!globalThis.fetch) {
|
||||||
@ -21,16 +21,16 @@ module.exports = function(RED) {
|
|||||||
const loggerPromise = import('matrix-js-sdk/lib/logger.js');
|
const loggerPromise = import('matrix-js-sdk/lib/logger.js');
|
||||||
|
|
||||||
// disable logging if set to "off"
|
// disable logging if set to "off"
|
||||||
let loggingSettings = RED.settings.get('logging');
|
// let loggingSettings = RED.settings.get('logging');
|
||||||
if(
|
// if(
|
||||||
typeof loggingSettings.console !== 'undefined' &&
|
// typeof loggingSettings.console !== 'undefined' &&
|
||||||
typeof loggingSettings.console.level !== 'undefined' &&
|
// typeof loggingSettings.console.level !== 'undefined' &&
|
||||||
['info','debug','trace'].indexOf(loggingSettings.console.level.toLowerCase()) >= 0
|
// ['info','debug','trace'].indexOf(loggingSettings.console.level.toLowerCase()) >= 0
|
||||||
) {
|
// ) {
|
||||||
loggerPromise.then(({ logger }) => {
|
// loggerPromise.then(({ logger }) => {
|
||||||
logger.disableAll();
|
// logger.disableAll();
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
function MatrixFolderNameFromUserId(name) {
|
function MatrixFolderNameFromUserId(name) {
|
||||||
return name.replace(/[^a-z0-9]/gi, '_').toLowerCase();
|
return name.replace(/[^a-z0-9]/gi, '_').toLowerCase();
|
||||||
@ -161,8 +161,7 @@ module.exports = function(RED) {
|
|||||||
localStorage: localStorage,
|
localStorage: localStorage,
|
||||||
}),
|
}),
|
||||||
userId: this.userId,
|
userId: this.userId,
|
||||||
deviceId: (this.deviceId || getStoredDeviceId(localStorage)) || undefined,
|
deviceId: (this.deviceId || getStoredDeviceId(localStorage)) || undefined
|
||||||
request
|
|
||||||
// verificationMethods: ["m.sas.v1"]
|
// verificationMethods: ["m.sas.v1"]
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -373,8 +372,13 @@ module.exports = function(RED) {
|
|||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
if(node.e2ee){
|
if(node.e2ee){
|
||||||
node.log("Initializing crypto...");
|
node.matrixClient.on("crypto.legacyCryptoStoreMigrationProgress", function(progress, total){
|
||||||
await node.matrixClient.initCrypto();
|
node.log(`Migrating from legacy crypto to rust crypto. ${progress}/${total}`);
|
||||||
|
});
|
||||||
|
await node.matrixClient.initRustCrypto({
|
||||||
|
useIndexedDB: false
|
||||||
|
});
|
||||||
|
console.log(`CRYPTO VERSION: ${node.matrixClient.getCrypto()?.getVersion()}`);
|
||||||
node.matrixClient.getCrypto().globalBlacklistUnverifiedDevices = false; // prevent errors from unverified devices
|
node.matrixClient.getCrypto().globalBlacklistUnverifiedDevices = false; // prevent errors from unverified devices
|
||||||
}
|
}
|
||||||
node.log("Connecting to Matrix server...");
|
node.log("Connecting to Matrix server...");
|
||||||
@ -382,6 +386,7 @@ module.exports = function(RED) {
|
|||||||
initialSyncLimit: node.initialSyncLimit
|
initialSyncLimit: node.initialSyncLimit
|
||||||
});
|
});
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
|
node.error(error);
|
||||||
node.error(error, {});
|
node.error(error, {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user