github Skylar-Tech/node-red-contrib-matrix-chat v1.1.0

4 hours ago

Warning

This release has a few breaking changes. Most flows are not affected: they only matter if your flows use the matrix-js-sdk objects some nodes used to output, or rely on the old Upload File, Send Image or Typing behaviour. Please still check the list below before upgrading.

v1.1.0 is a bug fix release. It fixes the memory leak that slowly ran Node-RED out of memory, auto-join ignoring room invites, images and files arriving in clients as plain attachments, and Receive nodes sharing one message, along with a long list of smaller bugs found while going through every node.

The memory leak was in fake-indexeddb, the in-memory IndexedDB we use for the Rust crypto store. It never let go of finished transactions, so an account with encryption grew by up to a gigabyte a day until Node-RED crashed. I reported it upstream (dumbmatter/fakeIndexedDB#170), it was fixed in 6.2.6, and this release requires that version.

There is also a new Clear encryption data button on the server configuration for recovering from a broken encryption store.

Breaking changes

  • msg.user on the Receive node, and the Get User output, are now plain objects. They no longer have the matrix-js-sdk User methods.
  • Join Room's msg.payload is now { roomId, name, canonicalAlias, membership } instead of the SDK Room object.
  • Upload File's message type now follows the content type, so a .png uploaded with msg.contentType = "application/octet-stream" is sent as a file. msg.msgtype still overrides it.
  • Send Image now outputs the authenticated media URL, which needs the access token in an Authorization header to download.
  • The Typing node's error output sets msg.error instead of replacing msg.payload.
  • With auto-join off, invites that are still pending are reported again each time Node-RED starts.

Encryption

  • Memory leak fixed
    fake-indexeddb kept every finished transaction, along with the old value of every record it overwrote. The Rust crypto store writes all the time, even when the bot is idle, so memory only ever went up. fake-indexeddb is now on 6.2.6, which fixes this. #145

  • Clear encryption data
    The server configuration has a new button for when encryption fails to start, for example after a store was corrupted by an update. You have to type delete to confirm. The bot then stays disconnected, even across deploys and restarts, until it logs in as a new session: the homeserver still has the old session's keys and rejects new ones for it, so reconnecting with the same session would leave every encrypted message undecryptable. After clearing, the dialog walks you through logging in again, and the server configuration shows a notice while the bot is waiting for that.

  • Encrypted uploads could not be decrypted
    Upload File put a corrupt IV and hash on encrypted files, so the people receiving them could not decrypt them. Encrypted uploads also told the homeserver the real file name and type; they are now uploaded as an anonymous blob, like Element does, and the name and type only live inside the encrypted message.

  • Closing during startup could wipe the saved encryption store
    Deploying again while an encrypted account was still starting could overwrite the saved encryption store with an empty one, losing the bot's keys. This is fixed, and the clearer "Encryption initialization failed" error now says how to recover.

Messages and media

  • Images and files show up properly in clients
    Send Image sent no image details at all, so clients showed images as plain files. It now sends the type, size and dimensions. Upload File picked the message type from the file name, so a buffer named without an extension was sent as a file even when its content type was an image; the content type decides now. #80

  • Send File keeps the file name and type
    Files were sent with an empty name and no type. #88

  • Each Receive node gets its own message
    Every Receive node was handed the same message object, so a change made in one flow showed up in every other flow, and even in the Matrix client's own copy of the event. Each node now gets its own copy. Room Invite nodes had the same problem and are fixed too. #144

  • Thumbnails
    Received images and videos lost unencrypted thumbnails, and Decrypt File only decrypted thumbnails for images. Upload File thumbnails are now always PNG, are never scaled up past the original, and work for encrypted uploads.

  • Media URLs in encrypted rooms
    Stickers, and plain media sent into an encrypted room, came through the Receive node without a URL.

Rooms

  • Auto-join works again
    Invites arrive without a timestamp, so the check that skips events from before Node-RED started skipped every invite. Invites are now joined, including ones that were still pending while Node-RED was offline, and the Room Invite node includes the room name instead of null. #141

  • Duplicate messages after deploying modified nodes
    A "Modified Nodes" deploy left the old copy of each redeployed node listening, so a Receive node sent one more copy of every message after each deploy. Nodes now clean up after themselves, and nodes added while the bot is already connected no longer get stuck showing "disconnected".

  • Room State Events
    Setting a space parent or child wrote a power levels event instead. The Room setting and JSONata values now work, and getters return the event content.

  • Paginate Room no longer throws when the first page is short, and no longer keeps a listener on the room forever for every pagination key.

  • Join Room no longer crashes when its output is wired to more than one node.

Connection

  • No more endless retries on a bad access token
    An invalid or logged-out access token was retried every 15 seconds forever. The node now says the token is invalid and stops.

  • Faster startup on local servers
    With a server URL like http://192.168.1.10:8008 or http://localhost:8008, every start could wait 5 seconds for a .well-known lookup that could never succeed. It now connects straight away, and servers that delegate through .well-known still work.

  • Deploying during startup
    Deploying again while the bot was still connecting could leave the old client running in the background (with encryption, two copies on one device), or crash Node-RED.

  • matrix-js-sdk logging follows the Node-RED log level
    The check was inverted: the SDK was silenced at the default level and flooded the console when the log level was turned down. Its debug output now only shows at debug or trace, and its warnings and errors follow your log level.

Various fixes

  • Errors from every node now reach Catch nodes and the node's error output, with msg.error set.
  • An error inside an event handler is reported instead of crashing Node-RED.
  • Send Message no longer turns & into & in messages with markdown escapes.
  • Send Location no longer sends the setting's name (for example geo_uri) when a field is left empty.
  • The Typing node no longer starts typing when given the string "false".
  • Mark Read works for messages that are not in the loaded timeline.
  • Reactions without a target no longer throw, and audio messages get a filename and mimetype.
  • Whois User works when msg.payload is set.
  • User Settings JSONata values work, and a node with no rules passes the message on.
  • Get User no longer fails when the server will not share presence, reads the status message correctly, and returns a plain copy of the user.
  • Synapse Register works with non-ASCII passwords, sets the display name, handles a trailing slash in the URL, and no longer crashes on deploy. The password is never included in errors.
  • Leave Room reports a failed leave instead of claiming success.
  • Synapse Users can filter out guests (guests=false), and Synapse Deactivate User's erase option works.
  • Checkbox settings no longer show as undefined in the editor's Info panel.
  • Help text fixed for Kick, Ban, Room Invite, Get Event, Get User, Join Room, Upload File and others.

Don't miss a new node-red-contrib-matrix-chat release

NewReleases is sending notifications on new releases.