- Remove mention of Device ID being required for encryption (since it can now auto generate if not provided this could make people think they have to set it when that isn't the case) - matrix-js-sdk updated from ^v15.3.0 to ^v15.5.0 - got updated from ^11.8.2 to ^12.0.1 (this also required us to change how we import this library in code) - Node-RED version requirement added for >=v1.3.0 - NodeJS version requirement added for >=v14.0.0 - removed `process` dependency - send-image node fixed so error doesn't get thrown (`matrix-js-sdk` updated causing some errors) - updated send-image node docs to explain that msg.contentType is necessary for some clients to render the image (otherwise it could display as a blank message in the room). - If a matrix server configuration node was missing it's User ID it would throw a TypeError instead of telling the user the actual issue. - Updated user list example: it now paginates all users on the server (if you had a lot of users the message would fail to send because it was too large) - Added example for creating a room and inviting a user - Added example for joining a mentioned room - Added example for listing out a user's or server's rooms - Added example for getting session data from a user via whois info - Added example for getting a room's user list - Added example for downloading & storing received files/images - Added example for kicking/banning user from a room. - Added example for deactivating a user - Removed message in the room-users config stating it only works if you are an admin - Receive node now outputs `msg.filename` for files and images
250 lines
9.2 KiB
HTML
250 lines
9.2 KiB
HTML
<script type="text/javascript">
|
|
RED.nodes.registerType('matrix-receive',{
|
|
category: 'matrix',
|
|
color: '#00b7ca',
|
|
icon: "matrix.png",
|
|
outputLabels: ["message"],
|
|
inputs:0,
|
|
outputs:1,
|
|
defaults: {
|
|
name: { value: null },
|
|
server: { value: "", type: "matrix-server-config" },
|
|
roomId: {"value": null},
|
|
acceptText: {"value": true},
|
|
acceptEmotes: {"value": true},
|
|
acceptStickers: {"value": true},
|
|
acceptReactions: {"value": true},
|
|
acceptFiles: {"value": true},
|
|
acceptImages: {"value": true},
|
|
},
|
|
label: function() {
|
|
return this.name || "Matrix Receive";
|
|
},
|
|
paletteLabel: 'Receive'
|
|
});
|
|
</script>
|
|
|
|
<script type="text/html" data-template-name="matrix-receive">
|
|
<div class="form-row">
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-server"><i class="fa fa-server"></i> Matrix Server</label>
|
|
<input type="text" id="node-input-server">
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-roomId"><i class="fa fa-user"></i> Room ID</label>
|
|
<input type="text" id="node-input-roomId">
|
|
</div>
|
|
<div class="form-tips">Enter a single room, comma separated list of rooms, or leave blank to get from all</div>
|
|
<div class="form-row" style="margin-left: 100px;margin-top:10px;font-weight:bold;">
|
|
Timeline event filters
|
|
</div>
|
|
<div class="form-row">
|
|
<input
|
|
type="checkbox"
|
|
id="node-input-acceptText"
|
|
style="width: auto; margin-left: 125px; vertical-align: top"
|
|
/>
|
|
<label for="node-input-acceptText" style="width: auto">
|
|
Accept text <code>m.text</code>
|
|
</label>
|
|
</div>
|
|
<div class="form-row">
|
|
<input
|
|
type="checkbox"
|
|
id="node-input-acceptEmotes"
|
|
style="width: auto; margin-left: 125px; vertical-align: top"
|
|
/>
|
|
<label for="node-input-acceptEmotes" style="width: auto">
|
|
Accept emotes <code>m.emote</code>
|
|
</label>
|
|
</div>
|
|
<div class="form-row">
|
|
<input
|
|
type="checkbox"
|
|
id="node-input-acceptStickers"
|
|
style="width: auto; margin-left: 125px; vertical-align: top"
|
|
/>
|
|
<label for="node-input-acceptStickers" style="width: auto">
|
|
Accept stickers <code>m.sticker</code>
|
|
</label>
|
|
</div>
|
|
<div class="form-row">
|
|
<input
|
|
type="checkbox"
|
|
id="node-input-acceptReactions"
|
|
style="width: auto; margin-left: 125px; vertical-align: top"
|
|
/>
|
|
<label for="node-input-acceptReactions" style="width: auto">
|
|
Accept reactions <code>m.reaction</code>
|
|
</label>
|
|
</div>
|
|
<div class="form-row">
|
|
<input
|
|
type="checkbox"
|
|
id="node-input-acceptFiles"
|
|
style="width: auto; margin-left: 125px; vertical-align: top"
|
|
/>
|
|
<label for="node-input-acceptFiles" style="width: auto">
|
|
Accept files <code>m.file</code>
|
|
</label>
|
|
</div>
|
|
<div class="form-row">
|
|
<input
|
|
type="checkbox"
|
|
id="node-input-acceptImages"
|
|
style="width: auto; margin-left: 125px; vertical-align: top"
|
|
/>
|
|
<label for="node-input-acceptImages" style="width: auto">
|
|
Accept images <code>m.image</code>
|
|
</label>
|
|
</div>
|
|
</script>
|
|
|
|
<script type="text/html" data-help-name="matrix-receive">
|
|
<p>Receive events from Matrix.</p>
|
|
|
|
<h3>Outputs</h3>
|
|
<ul class="node-ports">
|
|
<li>Always Returned
|
|
<dl class="message-properties">
|
|
<dt>msg.type <span class="property-type">string</span></dt>
|
|
<dd>
|
|
the message type. For example this will be either m.text, m.reaction, m.file, m.image, etc
|
|
</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.encrypted <span class="property-type">bool</span></dt>
|
|
<dd> returns true if message was encrypted (e2ee).</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.redacted <span class="property-type">bool</span></dt>
|
|
<dd> returns true if the message was redacted (such as deleted by the user).</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.payload <span class="property-type">string</span></dt>
|
|
<dd>the body from the message's content.</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.userId <span class="property-type">string</span></dt>
|
|
<dd>the User ID of the message sender. Example: @john:matrix.org</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.topic <span class="property-type">string</span></dt>
|
|
<dd>the ID of the room. Example: !OGEhHVWSdvArJzumhm:matrix.org</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.event <span class="property-type">object</span></dt>
|
|
<dd>the event object returned by the Matrix server</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.eventId <span class="property-type">object</span></dt>
|
|
<dd>The event ID, e.g. $143350589368169JsLZx:localhost</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.content <span class="property-type">object</span></dt>
|
|
<dd>the message's content object</dd>
|
|
</dl>
|
|
</li>
|
|
|
|
<li><code>msg.type</code> == '<strong>m.text</strong>'
|
|
<div class="form-tips" style="margin-bottom: 12px;">
|
|
Doesn't return anything extra
|
|
</div>
|
|
</li>
|
|
|
|
<li><code>msg.type</code> == '<strong>m.reaction</strong>'
|
|
<dl class="message-properties">
|
|
<dt>msg.referenceEventId <span class="property-type">string</span></dt>
|
|
<dd>the message that the reaction relates to</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.payload <span class="property-type">string</span></dt>
|
|
<dd>the key of the reaction's content</dd>
|
|
</dl>
|
|
</li>
|
|
|
|
<li><code>msg.type</code> == '<strong>m.emote</strong>'
|
|
<div class="form-tips" style="margin-bottom: 12px;">
|
|
Doesn't return anything extra
|
|
</div>
|
|
</li>
|
|
|
|
<li><code>msg.type</code> == '<strong>m.sticker</strong>'
|
|
<dl class="message-properties">
|
|
<dt>msg.url <span class="property-type">string</span></dt>
|
|
<dd>URL to the sticker image</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.mxc_url <span class="property-type">string</span></dt>
|
|
<dd>Matrix URL to the sticker image</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.thumbnail_url <span class="property-type">string</span></dt>
|
|
<dd>URL to the thumbnail of the sticker</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.thumbnail_mxc_url <span class="property-type">string</span></dt>
|
|
<dd>Matrix URL to the thumbnail of the sticker</dd>
|
|
</dl>
|
|
</li>
|
|
|
|
<li><code>msg.type</code> == '<strong>m.file</strong>'
|
|
<dl class="message-properties">
|
|
<dt>msg.filename <span class="property-type">string</span></dt>
|
|
<dd>the file's parsed filename</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.url <span class="property-type">string</span></dt>
|
|
<dd>the file's URL</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.mxc_url <span class="property-type">string</span></dt>
|
|
<dd>the file's Matrix URL</dd>
|
|
</dl>
|
|
</li>
|
|
|
|
<li><code>msg.type</code> == '<strong>m.image</strong>'
|
|
<dl class="message-properties">
|
|
<dt>msg.filename <span class="property-type">string</span></dt>
|
|
<dd>the image's parsed filename</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.url <span class="property-type">string</span></dt>
|
|
<dd>the image's URL</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.mxc_url <span class="property-type">string</span></dt>
|
|
<dd>the image's Matrix URL</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.thumbnail_url <span class="property-type">string</span></dt>
|
|
<dd>the image's thumbnail URL</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.thumbnail_mxc_url <span class="property-type">string</span></dt>
|
|
<dd>the image's thumbnail Matrix URL</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</script> |