- matrix-js-sdk updated to v20.0.0

- olm updated to v3.2.13 https://gitlab.matrix.org/matrix-org/olm/-/packages/136
- console messages now only appear if Node-RED's settings.js `logging.console.level` is info, debug, or trace
This commit is contained in:
Skylar Sadlier 2022-12-05 19:49:55 -07:00
parent bd4f6ea486
commit 462f9670c2
3 changed files with 8715 additions and 4710 deletions

13403
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,9 +6,10 @@
"fs-extra": "^10.0.1",
"got": "^12.0.2",
"isomorphic-webcrypto": "^2.3.8",
"matrix-js-sdk": "^16.0.0",
"matrix-js-sdk": "^20.0.0",
"node-localstorage": "^2.2.1",
"olm": "https://gitlab.matrix.org/matrix-org/olm/-/package_files/271/download",
"olm": "https://gitlab.matrix.org/matrix-org/olm/-/package_files/472/download",
"request": "^2.88.2",
"utf8": "^3.0.0"
},
"node-red": {

View File

@ -5,8 +5,20 @@ const { resolve } = require('path');
const { LocalStorage } = require('node-localstorage');
const { LocalStorageCryptoStore } = require('matrix-js-sdk/lib/crypto/store/localStorage-crypto-store');
const {RoomEvent, RoomMemberEvent, HttpApiEvent, ClientEvent} = require("matrix-js-sdk");
const request = require("request");
module.exports = function(RED) {
// disable logging if set to "off"
let loggingSettings = RED.settings.get('logging');
if(
typeof loggingSettings.console !== 'undefined' &&
typeof loggingSettings.console.level !== 'undefined' &&
['info','debug','trace'].indexOf(loggingSettings.console.level.toLowerCase()) >= 0
) {
const { logger } = require('matrix-js-sdk/lib/logger');
logger.disableAll();
}
function MatrixFolderNameFromUserId(name) {
return name.replace(/[^a-z0-9]/gi, '_').toLowerCase();
}
@ -116,10 +128,10 @@ module.exports = function(RED) {
node.matrixClient = sdk.createClient({
baseUrl: this.url,
accessToken: this.credentials.accessToken,
sessionStore: new sdk.WebStorageSessionStore(localStorage),
cryptoStore: new LocalStorageCryptoStore(localStorage),
userId: this.userId,
deviceId: (this.deviceId || getStoredDeviceId(localStorage)) || undefined,
request
// verificationMethods: ["m.sas.v1"]
});
@ -411,7 +423,8 @@ module.exports = function(RED) {
const matrixClient = sdk.createClient({
baseUrl: baseUrl,
deviceId: deviceId,
localTimeoutMs: '30000'
localTimeoutMs: '30000',
request
});
matrixClient.login(