mirror of
https://github.com/Skylar-Tech/node-red-contrib-matrix-chat.git
synced 2025-04-19 20:43:04 -06:00
- made input and output nodes more compatible with each other (for relay purposes). - File/Image input nodes can be combined with a File In node now - Remove console.log debug lines - set version to 0.0.3 - send message node updated to handle message formats and types. - Fixed ignore properties on matrix receive node not saving - created basic readme - WIP on node docs
175 lines
6.2 KiB
HTML
175 lines
6.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},
|
|
ignoreText: {"value": false},
|
|
ignoreReactions: {"value": false},
|
|
ignoreFiles: {"value": false},
|
|
ignoreImages: {"value": false},
|
|
},
|
|
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-ignoreText"
|
|
style="width: auto; margin-left: 125px; vertical-align: top"
|
|
/>
|
|
<label for="node-input-ignoreText" style="width: auto">
|
|
Ignore text
|
|
</label>
|
|
</div>
|
|
<div class="form-row">
|
|
<input
|
|
type="checkbox"
|
|
id="node-input-ignoreReactions"
|
|
style="width: auto; margin-left: 125px; vertical-align: top"
|
|
/>
|
|
<label for="node-input-ignoreReactions" style="width: auto">
|
|
Ignore reactions
|
|
</label>
|
|
</div>
|
|
<div class="form-row">
|
|
<input
|
|
type="checkbox"
|
|
id="node-input-ignoreFiles"
|
|
style="width: auto; margin-left: 125px; vertical-align: top"
|
|
/>
|
|
<label for="node-input-ignoreFiles" style="width: auto">
|
|
Ignore files
|
|
</label>
|
|
</div>
|
|
<div class="form-row">
|
|
<input
|
|
type="checkbox"
|
|
id="node-input-ignoreImages"
|
|
style="width: auto; margin-left: 125px; vertical-align: top"
|
|
/>
|
|
<label for="node-input-ignoreImages" style="width: auto">
|
|
Ignore images
|
|
</label>
|
|
</div>
|
|
</script>
|
|
|
|
<script type="text/html" data-help-name="matrix-receive">
|
|
<p>Receive events from matrix.</p>
|
|
|
|
<h3>Outputs</h3>
|
|
<ol class="node-ports">
|
|
<li>Always Returned
|
|
<dl class="message-properties">
|
|
<dt>msg.type <span class="property-type">string</span></dt>
|
|
<dd>
|
|
the message type. This is one of m.text, m.reaction, m.file, or m.image
|
|
</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.sender <span class="property-type">string</span></dt>
|
|
<dd>the sender of the message. Example: @john:matrix.org</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.roomId <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.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.info <span class="property-type">object</span></dt>
|
|
<dd>the content's info.</dd>
|
|
</dl>
|
|
|
|
<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.file</strong>'
|
|
<dl class="message-properties">
|
|
<dt>msg.file.info <span class="property-type">string</span></dt>
|
|
<dd>the content's info.</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.file.url <span class="property-type">string</span></dt>
|
|
<dd>the file's URL</dd>
|
|
</dl>
|
|
</li>
|
|
|
|
<li><code>msg.type</code> == '<strong>m.image</strong>'
|
|
<dl class="message-properties">
|
|
<dt>msg.image.info <span class="property-type">string</span></dt>
|
|
<dd>the image info.</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.file.url <span class="property-type">string</span></dt>
|
|
<dd>the image's URL</dd>
|
|
</dl>
|
|
|
|
<dl class="message-properties">
|
|
<dt>msg.file.thumbnail_url <span class="property-type">string</span></dt>
|
|
<dd>the image's thumbnail URL</dd>
|
|
</dl>
|
|
</li>
|
|
</ol>
|
|
</script> |