Closes #56
- can now specify message in node's configuration for matrix-send-message - can now specify reaction in node's configuration for matrix-react - reason can now be configured on both matrix-room-kick and matrix-room-ban - icons updated for various nodes
This commit is contained in:
parent
380e548425
commit
3dc6363a88
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-create-room">
|
<script type="text/html" data-template-name="matrix-create-room">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-decrypt-file">
|
<script type="text/html" data-template-name="matrix-decrypt-file">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<input type="text" id="node-input-server">
|
<input type="text" id="node-input-server">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-roomId"><i class="fa fa-user"></i> Room ID</label>
|
<label for="node-input-roomId"><i class="fa fa-comments"></i> Room ID</label>
|
||||||
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-invite-room">
|
<script type="text/html" data-template-name="matrix-invite-room">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -30,7 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-roomId"><i class="fa fa-user"></i> Room ID</label>
|
<label for="node-input-roomId"><i class="fa fa-comments"></i> Room ID</label>
|
||||||
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-join-room">
|
<script type="text/html" data-template-name="matrix-join-room">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
defaults: {
|
defaults: {
|
||||||
name: { value: null },
|
name: { value: null },
|
||||||
server: { value: "", type: "matrix-server-config" },
|
server: { value: "", type: "matrix-server-config" },
|
||||||
roomId: { value: null }
|
roomId: { value: null },
|
||||||
|
reaction: { value: null }
|
||||||
},
|
},
|
||||||
label: function() {
|
label: function() {
|
||||||
return this.name || "React";
|
return this.name || "React";
|
||||||
@ -20,7 +21,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-react">
|
<script type="text/html" data-template-name="matrix-react">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -28,9 +29,13 @@
|
|||||||
<input type="text" id="node-input-server">
|
<input type="text" id="node-input-server">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-roomId"><i class="fa fa-user"></i> Room ID</label>
|
<label for="node-input-roomId"><i class="fa fa-comments"></i> Room ID</label>
|
||||||
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-reaction"><i class="fa fa-thumbs-up"></i> Reaction</label>
|
||||||
|
<input type="text" id="node-input-reaction" placeholder="msg.payload">
|
||||||
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-react">
|
<script type="text/html" data-help-name="matrix-react">
|
||||||
@ -42,7 +47,7 @@
|
|||||||
<dt>msg.payload
|
<dt>msg.payload
|
||||||
<span class="property-type">string</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Usually an emoji but can also be text. </dd>
|
<dd> Usually an emoji but can also be text. If configured on the node this is ignored otherwise it required. </dd>
|
||||||
|
|
||||||
<dt>msg.topic
|
<dt>msg.topic
|
||||||
<span class="property-type">string | null</span>
|
<span class="property-type">string | null</span>
|
||||||
|
@ -7,6 +7,7 @@ module.exports = function(RED) {
|
|||||||
this.name = n.name;
|
this.name = n.name;
|
||||||
this.server = RED.nodes.getNode(n.server);
|
this.server = RED.nodes.getNode(n.server);
|
||||||
this.roomId = n.roomId;
|
this.roomId = n.roomId;
|
||||||
|
this.reaction = n.reaction;
|
||||||
|
|
||||||
if (!node.server) {
|
if (!node.server) {
|
||||||
node.warn("No configuration node");
|
node.warn("No configuration node");
|
||||||
@ -40,8 +41,9 @@ module.exports = function(RED) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!msg.payload) {
|
let payload = n.reaction || msg.payload;
|
||||||
node.error('msg.payload is required');
|
if(!payload) {
|
||||||
|
node.error('msg.payload must be defined or the reaction configured on the node.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +61,7 @@ module.exports = function(RED) {
|
|||||||
{
|
{
|
||||||
"m.relates_to": {
|
"m.relates_to": {
|
||||||
event_id: eventId,
|
event_id: eventId,
|
||||||
key: msg.payload,
|
key: payload,
|
||||||
rel_type: "m.annotation"
|
rel_type: "m.annotation"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
<input type="text" id="node-input-server">
|
<input type="text" id="node-input-server">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-roomId"><i class="fa fa-user"></i> Room ID</label>
|
<label for="node-input-roomId"><i class="fa fa-comments"></i> Room ID</label>
|
||||||
<input type="text" id="node-input-roomId">
|
<input type="text" id="node-input-roomId">
|
||||||
</div>
|
</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-tips">Enter a single room, comma separated list of rooms, or leave blank to get from all</div>
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
defaults: {
|
defaults: {
|
||||||
name: { value: null },
|
name: { value: null },
|
||||||
server: { value: "", type: "matrix-server-config" },
|
server: { value: "", type: "matrix-server-config" },
|
||||||
roomId: { value: null }
|
roomId: { value: null },
|
||||||
|
reason: { value: null }
|
||||||
},
|
},
|
||||||
label: function() {
|
label: function() {
|
||||||
return this.name || "Room Ban";
|
return this.name || "Room Ban";
|
||||||
@ -20,7 +21,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-room-ban">
|
<script type="text/html" data-template-name="matrix-room-ban">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -28,9 +29,13 @@
|
|||||||
<input type="text" id="node-input-server">
|
<input type="text" id="node-input-server">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-roomId"><i class="fa fa-user"></i> Room ID</label>
|
<label for="node-input-roomId"><i class="fa fa-comments"></i> Room ID</label>
|
||||||
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-reason"><i class="fa fa-comment"></i> Reason</label>
|
||||||
|
<input type="text" id="node-input-reason" placeholder="msg.topic">
|
||||||
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-room-ban">
|
<script type="text/html" data-help-name="matrix-room-ban">
|
||||||
@ -52,7 +57,7 @@
|
|||||||
<dt class="optional">msg.reason
|
<dt class="optional">msg.reason
|
||||||
<span class="property-type">string</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Reason for banning the user.</dd>
|
<dd> Reason for banning the user. If configured on the node it will overwrite this input</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h3>Outputs</h3>
|
<h3>Outputs</h3>
|
||||||
|
@ -7,6 +7,7 @@ module.exports = function(RED) {
|
|||||||
this.name = n.name;
|
this.name = n.name;
|
||||||
this.server = RED.nodes.getNode(n.server);
|
this.server = RED.nodes.getNode(n.server);
|
||||||
this.roomId = n.roomId;
|
this.roomId = n.roomId;
|
||||||
|
this.reason = n.reason;
|
||||||
|
|
||||||
if (!node.server) {
|
if (!node.server) {
|
||||||
node.warn("No configuration node");
|
node.warn("No configuration node");
|
||||||
@ -45,7 +46,7 @@ module.exports = function(RED) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
node.server.matrixClient.ban(msg.topic, msg.userId, msg.reason || undefined)
|
node.server.matrixClient.ban(msg.topic, msg.userId, n.reason || msg.reason || undefined)
|
||||||
.then(function(e) {
|
.then(function(e) {
|
||||||
node.log("Successfully banned " + msg.userId + " from " + msg.topic);
|
node.log("Successfully banned " + msg.userId + " from " + msg.topic);
|
||||||
msg.eventId = e.event_id;
|
msg.eventId = e.event_id;
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
defaults: {
|
defaults: {
|
||||||
name: { value: null },
|
name: { value: null },
|
||||||
server: { value: "", type: "matrix-server-config" },
|
server: { value: "", type: "matrix-server-config" },
|
||||||
roomId: { value: null }
|
roomId: { value: null },
|
||||||
|
reason: { value: null }
|
||||||
},
|
},
|
||||||
label: function() {
|
label: function() {
|
||||||
return this.name || "Room Kick";
|
return this.name || "Room Kick";
|
||||||
@ -20,7 +21,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-room-kick">
|
<script type="text/html" data-template-name="matrix-room-kick">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -28,9 +29,13 @@
|
|||||||
<input type="text" id="node-input-server">
|
<input type="text" id="node-input-server">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-roomId"><i class="fa fa-user"></i> Room ID</label>
|
<label for="node-input-roomId"><i class="fa fa-comments"></i> Room ID</label>
|
||||||
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-reason"><i class="fa fa-comment"></i> Reason</label>
|
||||||
|
<input type="text" id="node-input-reason" placeholder="msg.topic">
|
||||||
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-room-kick">
|
<script type="text/html" data-help-name="matrix-room-kick">
|
||||||
@ -52,7 +57,7 @@
|
|||||||
<dt class="optional">msg.reason
|
<dt class="optional">msg.reason
|
||||||
<span class="property-type">string</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Reason for kicking the user.</dd>
|
<dd> Reason for kicking the user. If configured on the node it will overwrite this input</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h3>Outputs</h3>
|
<h3>Outputs</h3>
|
||||||
|
@ -7,6 +7,7 @@ module.exports = function(RED) {
|
|||||||
this.name = n.name;
|
this.name = n.name;
|
||||||
this.server = RED.nodes.getNode(n.server);
|
this.server = RED.nodes.getNode(n.server);
|
||||||
this.roomId = n.roomId;
|
this.roomId = n.roomId;
|
||||||
|
this.reason = n.reason;
|
||||||
|
|
||||||
if (!node.server) {
|
if (!node.server) {
|
||||||
node.warn("No configuration node");
|
node.warn("No configuration node");
|
||||||
@ -45,7 +46,7 @@ module.exports = function(RED) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
node.server.matrixClient.kick(msg.topic, msg.userId, msg.reason || undefined)
|
node.server.matrixClient.kick(msg.topic, msg.userId, n.reason || msg.reason || undefined)
|
||||||
.then(function(e) {
|
.then(function(e) {
|
||||||
node.log("Successfully kicked " + msg.userId + " from " + msg.topic);
|
node.log("Successfully kicked " + msg.userId + " from " + msg.topic);
|
||||||
msg.eventId = e.event_id;
|
msg.eventId = e.event_id;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-room-users">
|
<script type="text/html" data-template-name="matrix-room-users">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-send-file">
|
<script type="text/html" data-template-name="matrix-send-file">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -29,7 +29,7 @@
|
|||||||
<input type="text" id="node-input-server">
|
<input type="text" id="node-input-server">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-roomId"><i class="fa fa-user"></i> Room ID</label>
|
<label for="node-input-roomId"><i class="fa fa-comments"></i> Room ID</label>
|
||||||
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-send-image">
|
<script type="text/html" data-template-name="matrix-send-image">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -29,7 +29,7 @@
|
|||||||
<input type="text" id="node-input-server">
|
<input type="text" id="node-input-server">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-roomId"><i class="fa fa-user"></i> Room ID</label>
|
<label for="node-input-roomId"><i class="fa fa-comments"></i> Room ID</label>
|
||||||
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
name: { value: null },
|
name: { value: null },
|
||||||
server: { value: "", type: "matrix-server-config" },
|
server: { value: "", type: "matrix-server-config" },
|
||||||
roomId: { value: null },
|
roomId: { value: null },
|
||||||
|
message: { value: null },
|
||||||
messageType: { value: 'm.text' },
|
messageType: { value: 'm.text' },
|
||||||
messageFormat: { value: '' },
|
messageFormat: { value: '' },
|
||||||
replaceMessage : { value: false }
|
replaceMessage : { value: false }
|
||||||
@ -23,7 +24,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-send-message">
|
<script type="text/html" data-template-name="matrix-send-message">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -33,10 +34,26 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-roomId"><i class="fa fa-user"></i> Room ID</label>
|
<label for="node-input-roomId"><i class="fa fa-comments"></i> Room ID</label>
|
||||||
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-message"><i class="fa fa-comment"></i> Message</label>
|
||||||
|
<textarea id="node-input-message" placeholder="msg.payload" style="width: 70%;"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
id="node-input-replaceMessage"
|
||||||
|
style="width: auto; margin-left: 105px; vertical-align: top"
|
||||||
|
/>
|
||||||
|
<label for="node-input-replaceMessage" style="width: auto;max-width:50%;">
|
||||||
|
Update existing message if <code>msg.eventId</code> is set
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-messageType">
|
<label for="node-input-messageType">
|
||||||
Message Type
|
Message Type
|
||||||
@ -61,17 +78,6 @@
|
|||||||
<option value="msg.format">msg.format input</option>
|
<option value="msg.format">msg.format input</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
id="node-input-replaceMessage"
|
|
||||||
style="width: auto; margin-left: 105px; vertical-align: top"
|
|
||||||
/>
|
|
||||||
<label for="node-input-replaceMessage" style="width: auto;max-width:50%;">
|
|
||||||
Update existing message if <code>msg.eventId</code> is set
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-send-message">
|
<script type="text/html" data-help-name="matrix-send-message">
|
||||||
@ -88,7 +94,7 @@
|
|||||||
<dt>msg.payload
|
<dt>msg.payload
|
||||||
<span class="property-type">string</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> the message text. </dd>
|
<dd> the message text. If configured on the node this is ignored otherwise it required. </dd>
|
||||||
|
|
||||||
<dt>msg.replace
|
<dt>msg.replace
|
||||||
<span class="property-type">bool</span>
|
<span class="property-type">bool</span>
|
||||||
|
@ -12,6 +12,7 @@ module.exports = function(RED) {
|
|||||||
this.messageType = n.messageType;
|
this.messageType = n.messageType;
|
||||||
this.messageFormat = n.messageFormat;
|
this.messageFormat = n.messageFormat;
|
||||||
this.replaceMessage = n.replaceMessage;
|
this.replaceMessage = n.replaceMessage;
|
||||||
|
this.message = n.message;
|
||||||
|
|
||||||
// taken from https://github.com/matrix-org/synapse/blob/master/synapse/push/mailer.py
|
// taken from https://github.com/matrix-org/synapse/blob/master/synapse/push/mailer.py
|
||||||
this.allowedTags = [
|
this.allowedTags = [
|
||||||
@ -101,14 +102,15 @@ module.exports = function(RED) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!msg.payload) {
|
let payload = n.message || msg.payload;
|
||||||
node.error('msg.payload is required');
|
if(!payload) {
|
||||||
|
node.error('msg.payload must be defined or the message configured on the node.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let content = {
|
let content = {
|
||||||
msgtype: msgType,
|
msgtype: msgType,
|
||||||
body: msg.payload.toString()
|
body: payload.toString()
|
||||||
};
|
};
|
||||||
|
|
||||||
if(msgFormat === 'html') {
|
if(msgFormat === 'html') {
|
||||||
@ -116,7 +118,7 @@ module.exports = function(RED) {
|
|||||||
content.formatted_body =
|
content.formatted_body =
|
||||||
(typeof msg.formatted_payload !== 'undefined' && msg.formatted_payload)
|
(typeof msg.formatted_payload !== 'undefined' && msg.formatted_payload)
|
||||||
? msg.formatted_payload.toString()
|
? msg.formatted_payload.toString()
|
||||||
: msg.payload.toString();
|
: payload.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if((node.replaceMessage || msg.replace) && msg.eventId) {
|
if((node.replaceMessage || msg.replace) && msg.eventId) {
|
||||||
@ -140,7 +142,7 @@ module.exports = function(RED) {
|
|||||||
|
|
||||||
node.server.matrixClient.sendMessage(msg.topic, content)
|
node.server.matrixClient.sendMessage(msg.topic, content)
|
||||||
.then(function(e) {
|
.then(function(e) {
|
||||||
node.log("Message sent: " + msg.payload);
|
node.log("Message sent: " + payload);
|
||||||
msg.eventId = e.event_id;
|
msg.eventId = e.event_id;
|
||||||
node.send([msg, null]);
|
node.send([msg, null]);
|
||||||
})
|
})
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-synapse-create-edit-user">
|
<script type="text/html" data-template-name="matrix-synapse-create-edit-user">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-synapse-deactivate-user">
|
<script type="text/html" data-template-name="matrix-synapse-deactivate-user">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-synapse-join-room">
|
<script type="text/html" data-template-name="matrix-synapse-join-room">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -30,7 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-roomId"><i class="fa fa-user"></i> Room ID</label>
|
<label for="node-input-roomId"><i class="fa fa-comments"></i> Room ID</label>
|
||||||
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-synapse-register">
|
<script type="text/html" data-template-name="matrix-synapse-register">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-synapse-users">
|
<script type="text/html" data-template-name="matrix-synapse-users">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<script type="text/html" data-template-name="matrix-whois-user">
|
<script type="text/html" data-template-name="matrix-whois-user">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user