mirror of
https://github.com/Skylar-Tech/node-red-contrib-matrix-chat.git
synced 2026-05-19 05:33:18 -06:00
- #109 get own events
- #28 paginate room history - #111 manual read markers - fix clearing global storage - update node docs for upload file
This commit is contained in:
@@ -0,0 +1,284 @@
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('matrix-paginate-room',{
|
||||
category: 'matrix',
|
||||
color: '#00b7ca',
|
||||
icon: "matrix.png",
|
||||
outputLabels: ["message"],
|
||||
inputs: 1,
|
||||
outputs: 2,
|
||||
defaults: {
|
||||
name: { value: null },
|
||||
server: { type: "matrix-server-config" },
|
||||
roomType: { value: "msg" },
|
||||
roomValue: { value: "topic" },
|
||||
paginateKeyType: { value: "msg" },
|
||||
paginateKeyValue: { value: "paginationKey" },
|
||||
paginateBackwardsType: { value: "bool" },
|
||||
paginateBackwardsValue: { value: "true" },
|
||||
pageSizeType: { value: "num" },
|
||||
pageSizeValue: { value: "25" }
|
||||
},
|
||||
label: function() {
|
||||
return this.name || "Paginate Room";
|
||||
},
|
||||
paletteLabel: 'Paginate Room',
|
||||
oneditprepare: function() {
|
||||
$("#node-input-room").typedInput({
|
||||
type: this.roomType,
|
||||
types:['msg','flow','global','str'],
|
||||
})
|
||||
.typedInput('value', this.roomValue)
|
||||
.typedInput('type', this.roomType);
|
||||
|
||||
$("#node-input-paginateBackwards").typedInput({
|
||||
types:['msg','flow','global','bool'],
|
||||
})
|
||||
.typedInput('value', this.paginateBackwardsValue)
|
||||
.typedInput('type', this.paginateBackwardsType);
|
||||
|
||||
$("#node-input-paginateKey").typedInput({
|
||||
types:['msg','flow','global'],
|
||||
})
|
||||
.typedInput('value', this.paginateKeyValue)
|
||||
.typedInput('type', this.paginateKeyType);
|
||||
|
||||
$("#node-input-pageSize").typedInput({
|
||||
types:['msg','flow','global','num'],
|
||||
})
|
||||
.typedInput('value', this.pageSizeValue)
|
||||
.typedInput('type', this.pageSizeType);
|
||||
},
|
||||
oneditsave: function() {
|
||||
this.roomType = $("#node-input-room").typedInput('type');
|
||||
this.roomValue = $("#node-input-room").typedInput('value');
|
||||
this.paginateBackwardsType = $("#node-input-paginateBackwards").typedInput('type');
|
||||
this.paginateBackwardsValue = $("#node-input-paginateBackwards").typedInput('value');
|
||||
this.paginateKeyType = $("#node-input-paginateKey").typedInput('type');
|
||||
this.paginateKeyValue = $("#node-input-paginateKey").typedInput('value');
|
||||
this.pageSizeType = $("#node-input-pageSize").typedInput('type');
|
||||
this.pageSizeValue = $("#node-input-pageSize").typedInput('value');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-template-name="matrix-paginate-room">
|
||||
<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-room"><i class="fa fa-comments"></i> Room</label>
|
||||
<input type="text" id="node-input-room">
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label for="node-input-paginateKey"><i class="fa fa-comments"></i> Pagination Key</label>
|
||||
<input type="text" id="node-input-paginateKey">
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label for="node-input-paginateBackwards"><i class="fa fa-commenting-o"></i> Paginate Backwards</label>
|
||||
<input type="text" id="node-input-paginateBackwards">
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label for="node-input-pageSize"><i class="fa fa-commenting-o"></i> Page Size</label>
|
||||
<input type="text" id="node-input-pageSize">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="matrix-paginate-room">
|
||||
<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.isDM <span class="property-type">bool</span></dt>
|
||||
<dd> returns true if message is from a direct message room.</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.audio</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.mimetype <span class="property-type">string</span></dt>
|
||||
<dd>audio file mimetype (ex: audio/ogg)</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>
|
||||
|
||||
<dl class="message-properties">
|
||||
<dt>msg.duration <span class="property-type">integer</span></dt>
|
||||
<dd>duration of audio file in milliseconds</dd>
|
||||
</dl>
|
||||
|
||||
<dl class="message-properties">
|
||||
<dt>msg.waveform <span class="property-type">array[int]</span></dt>
|
||||
<dd>waveform of the audio clip</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>
|
||||
|
||||
<li><code>msg.type</code> == '<strong>m.location</strong>'
|
||||
<dl class="message-properties">
|
||||
<dt>msg.geo_uri <span class="property-type">string</span></dt>
|
||||
<dd>URI format of the geolocation</dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
</script>
|
||||
Reference in New Issue
Block a user