Skip to content

Commit

Permalink
Merge pull request #19 from Skylar-Tech/dev
Browse files Browse the repository at this point in the history
0.2.0 release
  • Loading branch information
skylord123 authored Sep 3, 2021
2 parents f894fab + 2cf8ba1 commit d5519a6
Show file tree
Hide file tree
Showing 31 changed files with 290 additions and 265 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ npm install node-red-contrib-matrix-chat
### End-to-End Encryption Notes
Currently this module has no way of getting encryption keys from other devices on the same account. Therefore it is recommended you use the bot exclusively with Node-RED after it's creation. Failure to do so will lead to your bot being unable to receive messages from e2ee rooms it joined from another client. Shared secret registration makes this super easy since it returns a token and device ID.

This module stores a folder in your Node-RED directory called `matrix-local-storage` and is it vital that you periodically back this up if you are using e2ee. This is where the client stores all the keys necessary to decrypt messages and if lost you will lose access to e2e rooms. If you move your client to another NR install make sure to migrate this folder as well (and do not let both the old and new client run at same time).
This module stores a folder in your Node-RED directory called `matrix-client-storage` and is it vital that you periodically back this up if you are using e2ee. This is where the client stores all the keys necessary to decrypt messages and if lost you will lose access to e2e rooms. If you move your client to another NR install make sure to migrate this folder as well (and do not let both the old and new client run at same time).

Want to contribute? Any help on getting the last pieces of e2ee figured out would be greatly appreciated :)

Expand Down
39 changes: 10 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "node-red-contrib-matrix-chat",
"version": "0.1.8",
"version": "0.2.0",
"description": "Matrix chat server client for Node-RED",
"dependencies": {
"fs-extra": "^9.1.0",
"got": "^11.8.2",
"isomorphic-webcrypto": "^2.3.8",
"matrix-js-sdk": "^12.2.0",
"node-localstorage": "^2.2.1",
"olm": "https://packages.matrix.org/npm/olm/olm-3.1.4.tgz",
"utf8": "^3.0.0",
"node-localstorage": "^2.2.1"
"utf8": "^3.0.0"
},
"node-red": {
"nodes": {
Expand Down
21 changes: 5 additions & 16 deletions src/matrix-create-room.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,19 @@
<label for="node-input-server"><i class="fa fa-user"></i> Matrix Server Config</label>
<input type="text" id="node-input-server">
</div>

<div class="form-tips" style="margin-bottom: 12px;">
User must be an admin to use this endpoint.
</div>
</script>

<script type="text/html" data-help-name="matrix-create-room">
<h3>Details</h3>
<p>
Create a room with the defined options in <code>msg.payload</code>
</p>
<a href="https://matrix-org.github.io/synapse/develop/admin_api/room_membership.html#edit-room-membership-api" target="_blank">Synapse API Endpoint Information</a>
<p>Create a Matrix room</p>
<a href="https://matrix.org/docs/spec/client_server/r0.4.0#id266" target="_blank">Matrix API Endpoint Information</a>

<h3>Inputs</h3>
<dl class="message-properties">
<dt>msg.payload
<span class="property-type">string</span>
</dt>
<dd> a list of options to pass to the /createRoom API. <a href="https://matrix.org/docs/spec/client_server/r0.4.0#id266">Click here</a> for information about what can be passed.</dd>

<dt>msg.userId
<span class="property-type">string</span>
<dt class="optional">msg.payload
<span class="property-type">string | object | null</span>
</dt>
<dd> User's ID that will be set into the room.</dd>
<dd> a list of options to pass to the /createRoom API. <a href="https://matrix.org/docs/spec/client_server/r0.4.0#id266">Click here</a> for information about what can be passed. If this is a string it just sets the room name and ignores other options.</dd>
</dl>

<h3>Outputs</h3>
Expand Down
1 change: 0 additions & 1 deletion src/matrix-create-room.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ module.exports = function(RED) {
};
}

// we need the status code, so set onlydata to false for this request
node.server.matrixClient
.createRoom(msg.payload || {})
.then(function(e){
Expand Down
11 changes: 7 additions & 4 deletions src/matrix-crypt-file.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@

<script type="text/html" data-help-name="matrix-decrypt-file">
<h3>Details</h3>
<p>Files sent in an encrypted room are themselves encrypted. Use this node to encrypt/decrypt files. Note: This node will download the encryted file (required to decrypt)</p>
<p>Files sent in an encrypted room are themselves encrypted. Use this node to encrypt/decrypt files. Note: This node will download the encrypted file so be cautious of large downloads.</p>

<h3>Inputs</h3>
<dl class="message-properties">
<dt>msg.content
<span class="property-type">Object</span>
<span class="property-type">object</span>
</dt>
<dd> content of the decrypted message</dd>

<dt>msg.content.file
<span class="property-type">Object</span>
<span class="property-type">object</span>
</dt>
<dd> the information needed to decode the file</dd>

<dt>msg.url
<span class="property-type">String | Null</span>
<span class="property-type">string | null</span>
</dt>
<dd> the decoded mxc url.</dd>
</dl>
Expand All @@ -57,6 +57,9 @@ <h3>Outputs</h3>

<dt>msg.filename <span class="property-type">string</span></dt>
<dd>filename of the decoded file (if content.filename isn't defined on the message we fallback to content.body).</dd>

<dt>msg.thumbnail_payload <span class="property-type">buffer</span></dt>
<dd>If the file is an image then this property is set to the buffer of the thumbnail. If not an image this is left off.</dd>
</dl>
</li>
<li>Error
Expand Down
4 changes: 2 additions & 2 deletions src/matrix-invite-room.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<script type="text/html" data-help-name="matrix-invite-room">
<h3>Details</h3>
<p>
This API invites a user to participate in a particular room. They do not start participating in the room until they actually join the room.
This node invites a user to participate in a particular room. They do not start participating in the room until they actually join the room. The client must be in the room and have permissions to invite.
</p>
<a href="https://matrix-org.github.io/synapse/develop/admin_api/room_membership.html#edit-room-membership-api" target="_blank">Synapse API Endpoint Information</a>

Expand All @@ -41,7 +41,7 @@ <h3>Inputs</h3>
<dt>msg.topic
<span class="property-type">string</span>
</dt>
<dd> The room identifier to invite to: for example, <code>!h8zld9j31:example.com. If configured on the node it overrides this input and is no longer required.</code>.</dd>
<dd> The room identifier to invite to: for example, <code>!h8zld9j31:example.com</code>. Ignored if configured on the node, otherwise required.</dd>

<dt>msg.userId
<span class="property-type">string</span>
Expand Down
2 changes: 1 addition & 1 deletion src/matrix-invite-room.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = function(RED) {
msg.payload = e;
node.send([msg, null]);
}).catch(function(e){
node.warn("Error creating room " + e);
node.warn("Error inviting to room " + e);
msg.error = e;
node.send([null, msg]);
});
Expand Down
14 changes: 3 additions & 11 deletions src/matrix-join-room.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,22 @@
<label for="node-input-server"><i class="fa fa-user"></i> Matrix Server Config</label>
<input type="text" id="node-input-server">
</div>
<div class="form-tips">
Room ID must either be defined here or passed in via <code>msg.topic</code>. The config takes precedence over the input.
</div>
</script>

<script type="text/html" data-help-name="matrix-join-room">
<h3>Details</h3>
<p>This API starts a user participating in a particular room, if that user is allowed to participate in that room. After this call, the client is allowed to see all current state events in the room, and all subsequent events associated with the room until the user leaves the room.</p>
<p>This node starts the client participating in a particular room, if the client is allowed to participate in that room. After this call, the client is allowed to see all current state events in the room, and all subsequent events associated with the room until the user leaves the room.</p>
<a href="https://matrix.org/docs/spec/client_server/latest#id291" target="_blank">Matrix API Endpoint Information</a>

<h3>Inputs</h3>
<dl class="message-properties">
<dt>msg.topic
<span class="property-type">String</span>
<span class="property-type">string</span>
</dt>
<dd> The room identifier or alias to join.</dd>

<dt class="optional">msg.joinOpts
<span class="property-type">Object</span>
<span class="property-type">object | null</span>
</dt>
<dd> Extra options that can be passed when joining a room.</dd>

Expand All @@ -62,11 +59,6 @@ <h3>Inputs</h3>
<span class="property-type">[string]</span>
</dt>
<dd> The servers to attempt to join the room through. One of the servers must be participating in the room.</dd>

<dt class="optional">msg.reason
<span class="property-type">String</span>
</dt>
<dd> Reason for kicking the user.</dd>
</dl>

<h3>Outputs</h3>
Expand Down
Loading

0 comments on commit d5519a6

Please sign in to comment.