mirror of
https://github.com/Skylar-Tech/node-red-contrib-matrix-chat.git
synced 2025-04-20 13:03:12 -06:00
WIP
This commit is contained in:
parent
2ce80e2906
commit
3e70369cae
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-contrib-matrix-chat",
|
"name": "node-red-contrib-matrix-chat",
|
||||||
"version": "0.5.5",
|
"version": "0.5.6",
|
||||||
"description": "Matrix chat server client for Node-RED",
|
"description": "Matrix chat server client for Node-RED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fs-extra": "^10.0.1",
|
"fs-extra": "^10.0.1",
|
||||||
|
@ -32,6 +32,12 @@
|
|||||||
<label for="node-input-roomId"><i class="fa fa-comments"></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">
|
||||||
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-reason"><i class="fa fa-sticky-note"></i> Reason</label>
|
||||||
|
<input type="text" id="node-input-reason" placeholder="msg.reason">
|
||||||
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$("#node-input-roomId").on("keyup", function() {
|
$("#node-input-roomId").on("keyup", function() {
|
||||||
@ -43,13 +49,6 @@
|
|||||||
}).trigger('keyup');
|
}).trigger('keyup');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-reason"><i class="fa fa-sticky-note"></i> Reason</label>
|
|
||||||
<input type="text" id="node-input-reason" placeholder="msg.reason">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-delete-event">
|
<script type="text/html" data-help-name="matrix-delete-event">
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
<label for="node-input-roomId"><i class="fa fa-comments"></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">
|
||||||
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
||||||
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$("#node-input-roomId").on("keyup", function() {
|
$("#node-input-roomId").on("keyup", function() {
|
||||||
@ -44,8 +45,6 @@
|
|||||||
}).trigger('keyup');
|
}).trigger('keyup');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-invite-room">
|
<script type="text/html" data-help-name="matrix-invite-room">
|
||||||
|
@ -32,6 +32,11 @@
|
|||||||
<label for="node-input-roomId"><i class="fa fa-comments"></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">
|
||||||
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
||||||
|
</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 type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$("#node-input-roomId").on("keyup", function() {
|
$("#node-input-roomId").on("keyup", function() {
|
||||||
@ -43,12 +48,6 @@
|
|||||||
}).trigger('keyup');
|
}).trigger('keyup');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</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">
|
||||||
|
@ -37,17 +37,6 @@
|
|||||||
<label for="node-input-roomId"><i class="fa fa-comments"></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">
|
||||||
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
||||||
<script type="text/javascript">
|
|
||||||
$(function(){
|
|
||||||
$("#node-input-roomId").on("keyup", function() {
|
|
||||||
if($(this).val() && !$(this).val().startsWith("!")) {
|
|
||||||
$("#node-input-roomId-error").html(`Room IDs start with exclamation point "!"<br />Example: !OGEhHVWSdvArJzumhm:matrix.org`).show();
|
|
||||||
} else {
|
|
||||||
$("#node-input-roomId-error").hide();
|
|
||||||
}
|
|
||||||
}).trigger('keyup');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</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>
|
||||||
<div class="form-row" style="margin-left: 100px;margin-top:10px;font-weight:bold;">
|
<div class="form-row" style="margin-left: 100px;margin-top:10px;font-weight:bold;">
|
||||||
@ -113,6 +102,17 @@
|
|||||||
Accept images <code>m.image</code>
|
Accept images <code>m.image</code>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$("#node-input-roomId").on("keyup", function() {
|
||||||
|
if($(this).val() && !$(this).val().startsWith("!")) {
|
||||||
|
$("#node-input-roomId-error").html(`Room IDs start with exclamation point "!"<br />Example: !OGEhHVWSdvArJzumhm:matrix.org`).show();
|
||||||
|
} else {
|
||||||
|
$("#node-input-roomId-error").hide();
|
||||||
|
}
|
||||||
|
}).trigger('keyup');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-receive">
|
<script type="text/html" data-help-name="matrix-receive">
|
||||||
|
@ -32,6 +32,11 @@
|
|||||||
<label for="node-input-roomId"><i class="fa fa-comments"></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">
|
||||||
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
||||||
|
</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 type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$("#node-input-roomId").on("keyup", function() {
|
$("#node-input-roomId").on("keyup", function() {
|
||||||
@ -43,12 +48,6 @@
|
|||||||
}).trigger('keyup');
|
}).trigger('keyup');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</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">
|
||||||
|
@ -32,6 +32,11 @@
|
|||||||
<label for="node-input-roomId"><i class="fa fa-comments"></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">
|
||||||
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
||||||
|
</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 type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$("#node-input-roomId").on("keyup", function() {
|
$("#node-input-roomId").on("keyup", function() {
|
||||||
@ -43,12 +48,6 @@
|
|||||||
}).trigger('keyup');
|
}).trigger('keyup');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</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">
|
||||||
|
@ -28,8 +28,10 @@
|
|||||||
<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-server"><i class="fa fa-user"></i> Room Id</label> <input type="text" id="node-input-roomId" placeholder="msg.topic">
|
<label for="node-input-server"><i class="fa fa-user"></i> Room Id</label>
|
||||||
|
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
||||||
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
||||||
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$("#node-input-roomId").on("keyup", function() {
|
$("#node-input-roomId").on("keyup", function() {
|
||||||
@ -41,8 +43,6 @@
|
|||||||
}).trigger('keyup');
|
}).trigger('keyup');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-room-users">
|
<script type="text/html" data-help-name="matrix-room-users">
|
||||||
|
@ -32,6 +32,14 @@
|
|||||||
<label for="node-input-roomId"><i class="fa fa-comments"></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">
|
||||||
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-contentType"><i class="fa fa-user"></i> Content-Type</label>
|
||||||
|
<input type="text" id="node-input-contentType" placeholder="msg.contentType">
|
||||||
|
</div>
|
||||||
|
<div class="form-tips">
|
||||||
|
Must be a valid <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types" target="_blank">MIME Type</a> (ex: application/pdf) or left empty
|
||||||
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$("#node-input-roomId").on("keyup", function() {
|
$("#node-input-roomId").on("keyup", function() {
|
||||||
@ -43,15 +51,6 @@
|
|||||||
}).trigger('keyup');
|
}).trigger('keyup');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-contentType"><i class="fa fa-user"></i> Content-Type</label>
|
|
||||||
<input type="text" id="node-input-contentType" placeholder="msg.contentType">
|
|
||||||
</div>
|
|
||||||
<div class="form-tips">
|
|
||||||
Must be a valid <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types" target="_blank">MIME Type</a> (ex: application/pdf) or left empty
|
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-send-file">
|
<script type="text/html" data-help-name="matrix-send-file">
|
||||||
|
@ -32,6 +32,14 @@
|
|||||||
<label for="node-input-roomId"><i class="fa fa-comments"></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">
|
||||||
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-contentType"><i class="fa fa-user"></i> Content-Type</label>
|
||||||
|
<input type="text" id="node-input-contentType" placeholder="msg.contentType">
|
||||||
|
</div>
|
||||||
|
<div class="form-tips">
|
||||||
|
Must be a valid <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types" target="_blank">MIME Type</a> (ex: image/png) or left empty
|
||||||
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$("#node-input-roomId").on("keyup", function() {
|
$("#node-input-roomId").on("keyup", function() {
|
||||||
@ -43,15 +51,6 @@
|
|||||||
}).trigger('keyup');
|
}).trigger('keyup');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-contentType"><i class="fa fa-user"></i> Content-Type</label>
|
|
||||||
<input type="text" id="node-input-contentType" placeholder="msg.contentType">
|
|
||||||
</div>
|
|
||||||
<div class="form-tips">
|
|
||||||
Must be a valid <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types" target="_blank">MIME Type</a> (ex: image/png) or left empty
|
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-send-image">
|
<script type="text/html" data-help-name="matrix-send-image">
|
||||||
|
@ -37,18 +37,6 @@
|
|||||||
<label for="node-input-roomId"><i class="fa fa-comments"></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">
|
||||||
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
||||||
<script type="text/javascript">
|
|
||||||
$(function(){
|
|
||||||
$("#node-input-roomId").on("keyup", function() {
|
|
||||||
if($(this).val() && !$(this).val().startsWith("!")) {
|
|
||||||
$("#node-input-roomId-error").html(`Room IDs start with exclamation point "!"<br />Example: !OGEhHVWSdvArJzumhm:matrix.org`).show();
|
|
||||||
} else {
|
|
||||||
$("#node-input-roomId-error").hide();
|
|
||||||
}
|
|
||||||
}).trigger('keyup');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -91,6 +79,17 @@
|
|||||||
<option value="msg.format">msg.format input</option>
|
<option value="msg.format">msg.format input</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$("#node-input-roomId").on("keyup", function() {
|
||||||
|
if($(this).val() && !$(this).val().startsWith("!")) {
|
||||||
|
$("#node-input-roomId-error").html(`Room IDs start with exclamation point "!"<br />Example: !OGEhHVWSdvArJzumhm:matrix.org`).show();
|
||||||
|
} else {
|
||||||
|
$("#node-input-roomId-error").hide();
|
||||||
|
}
|
||||||
|
}).trigger('keyup');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-send-message">
|
<script type="text/html" data-help-name="matrix-send-message">
|
||||||
|
@ -30,7 +30,8 @@
|
|||||||
deviceLabel: { type: "text", required: false },
|
deviceLabel: { type: "text", required: false },
|
||||||
accessToken: { type: "password", required: true },
|
accessToken: { type: "password", required: true },
|
||||||
deviceId: { type: "text", required: false },
|
deviceId: { type: "text", required: false },
|
||||||
url: { type: "text", required: true }
|
secretStoragePassphrase: { type: "password", required: false },
|
||||||
|
url: { type: "text", required: true },
|
||||||
},
|
},
|
||||||
defaults: {
|
defaults: {
|
||||||
name: { value: null },
|
name: { value: null },
|
||||||
@ -86,6 +87,14 @@
|
|||||||
You can either provide/generate an access token yourself or use the login button above to do it automatically. View the <a href="javascript:$('#red-ui-tab-help-link-button').click();">node docs</a> to figure out how to generate an Access Token manually. If you generated a user with shared secret registration you will already have an access token you can place here.
|
You can either provide/generate an access token yourself or use the login button above to do it automatically. View the <a href="javascript:$('#red-ui-tab-help-link-button').click();">node docs</a> to figure out how to generate an Access Token manually. If you generated a user with shared secret registration you will already have an access token you can place here.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-config-input-secretStoragePassphrase"><i class="fa fa-key"></i> Secret Storage Passphrase</label>
|
||||||
|
<input type="text" id="node-config-input-secretStoragePassphrase">
|
||||||
|
</div>
|
||||||
|
<div class="form-tips" style="margin-bottom: 12px;">
|
||||||
|
You can either provide/generate an access token yourself or use the login button above to do it automatically. View the <a href="javascript:$('#red-ui-tab-help-link-button').click();">node docs</a> to figure out how to generate an Access Token manually. If you generated a user with shared secret registration you will already have an access token you can place here.
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-config-input-deviceId"><i class="fa fa-desktop"></i> Device ID</label>
|
<label for="node-config-input-deviceId"><i class="fa fa-desktop"></i> Device ID</label>
|
||||||
<input type="text" id="node-config-input-deviceId">
|
<input type="text" id="node-config-input-deviceId">
|
||||||
|
@ -5,6 +5,8 @@ const { resolve } = require('path');
|
|||||||
const { LocalStorage } = require('node-localstorage');
|
const { LocalStorage } = require('node-localstorage');
|
||||||
const { LocalStorageCryptoStore } = require('matrix-js-sdk/lib/crypto/store/localStorage-crypto-store');
|
const { LocalStorageCryptoStore } = require('matrix-js-sdk/lib/crypto/store/localStorage-crypto-store');
|
||||||
const {RoomEvent, RoomMemberEvent, HttpApiEvent, ClientEvent} = require("matrix-js-sdk");
|
const {RoomEvent, RoomMemberEvent, HttpApiEvent, ClientEvent} = require("matrix-js-sdk");
|
||||||
|
const {deriveKey} = require("matrix-js-sdk/lib/crypto/key_passphrase");
|
||||||
|
const {encryptAES} = require("matrix-js-sdk/lib/crypto/aes");
|
||||||
|
|
||||||
module.exports = function(RED) {
|
module.exports = function(RED) {
|
||||||
function MatrixFolderNameFromUserId(name) {
|
function MatrixFolderNameFromUserId(name) {
|
||||||
@ -28,10 +30,11 @@ module.exports = function(RED) {
|
|||||||
this.userId = this.credentials.userId;
|
this.userId = this.credentials.userId;
|
||||||
this.deviceLabel = this.credentials.deviceLabel || null;
|
this.deviceLabel = this.credentials.deviceLabel || null;
|
||||||
this.deviceId = this.credentials.deviceId || null;
|
this.deviceId = this.credentials.deviceId || null;
|
||||||
|
this.secretStoragePassphrase = this.credentials.secretStoragePassphrase || null;
|
||||||
this.url = this.credentials.url;
|
this.url = this.credentials.url;
|
||||||
this.autoAcceptRoomInvites = n.autoAcceptRoomInvites;
|
this.autoAcceptRoomInvites = n.autoAcceptRoomInvites;
|
||||||
this.enableE2ee = n.enableE2ee || false;
|
this.e2ee = this.enableE2ee = n.enableE2ee || false;
|
||||||
this.e2ee = (this.enableE2ee && this.deviceId);
|
|
||||||
this.globalAccess = n.global;
|
this.globalAccess = n.global;
|
||||||
this.initializedAt = new Date();
|
this.initializedAt = new Date();
|
||||||
|
|
||||||
@ -40,6 +43,53 @@ module.exports = function(RED) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let cryptoCallbacks = undefined;
|
||||||
|
if(node.enableE2ee && node.secretStoragePassphrase && false) {
|
||||||
|
// cryptoCallbacks = {
|
||||||
|
// getSecretStorageKey: async function({ keys }, name) {
|
||||||
|
// const ZERO_STR = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
|
||||||
|
// for (const [keyName, keyInfo] of Object.entries(keys)) {
|
||||||
|
// const key = await deriveKey(node.secretStoragePassphrase, keyInfo.passphrase.salt, keyInfo.passphrase.iterations);
|
||||||
|
// // const key = Uint8Array.of(36, 47, 159, 193, 29, 188, 180, 86, 189, 180, 207, 101, 79, 255, 93, 159, 228, 43, 160, 158, 98, 209, 84, 196, 137, 122, 119, 118, 11, 131, 75, 87);
|
||||||
|
// const { mac } = await encryptAES(ZERO_STR, key, "", keyInfo.iv);
|
||||||
|
// if (keyInfo.mac.replace(/=+$/g, '') === mac.replace(/=+$/g, '')) {
|
||||||
|
// return [keyName, key];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// },
|
||||||
|
// async getDehydrationKey() {
|
||||||
|
// return node.secretStoragePassphrase;
|
||||||
|
// },
|
||||||
|
// async generateDehydrationKey() {
|
||||||
|
// return {key: node.secretStoragePassphrase};
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
cryptoCallbacks = {
|
||||||
|
getSecretStorageKey: async ({ keys }) => {
|
||||||
|
const backupPassphrase = node.secretStoragePassphrase;
|
||||||
|
if (!backupPassphrase) {
|
||||||
|
node.WARN("Missing secret storage key");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
let keyId = await node.matrixClient.getDefaultSecretStorageKeyId();
|
||||||
|
if (keyId && !keys[keyId]) {
|
||||||
|
keyId = undefined;
|
||||||
|
}
|
||||||
|
if (!keyId) {
|
||||||
|
keyId = keys[0][0];
|
||||||
|
}
|
||||||
|
const backupInfo = await node.matrixClient.getKeyBackupVersion();
|
||||||
|
const key = await node.matrixClient.keyBackupKeyFromPassword(
|
||||||
|
backupPassphrase,
|
||||||
|
backupInfo
|
||||||
|
);
|
||||||
|
return [keyId, key];
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let localStorageDir = storageDir + '/' + MatrixFolderNameFromUserId(this.userId),
|
let localStorageDir = storageDir + '/' + MatrixFolderNameFromUserId(this.userId),
|
||||||
localStorage = new LocalStorage(localStorageDir),
|
localStorage = new LocalStorage(localStorageDir),
|
||||||
initialSetup = false;
|
initialSetup = false;
|
||||||
@ -51,7 +101,7 @@ module.exports = function(RED) {
|
|||||||
} else if(!this.url) {
|
} else if(!this.url) {
|
||||||
node.error("Matrix connection failed: missing server URL in configuration.");
|
node.error("Matrix connection failed: missing server URL in configuration.");
|
||||||
} else {
|
} else {
|
||||||
node.setConnected = function(connected, cb) {
|
node.setConnected = async function(connected, cb) {
|
||||||
if (node.connected !== connected) {
|
if (node.connected !== connected) {
|
||||||
node.connected = connected;
|
node.connected = connected;
|
||||||
if(typeof cb === 'function') {
|
if(typeof cb === 'function') {
|
||||||
@ -62,6 +112,16 @@ module.exports = function(RED) {
|
|||||||
node.log("Matrix server connection ready.");
|
node.log("Matrix server connection ready.");
|
||||||
node.emit("connected");
|
node.emit("connected");
|
||||||
if(!initialSetup) {
|
if(!initialSetup) {
|
||||||
|
if(node.enableE2ee && node.secretStoragePassphrase && !await node.matrixClient.isCrossSigningReady() && false) {
|
||||||
|
// bootstrap cross-signing
|
||||||
|
await node.matrixClient.bootstrapCrossSigning({
|
||||||
|
// maybe we can skip this?
|
||||||
|
authUploadDeviceSigningKeys: () => {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// store Device ID internally
|
// store Device ID internally
|
||||||
let stored_device_id = getStoredDeviceId(localStorage),
|
let stored_device_id = getStoredDeviceId(localStorage),
|
||||||
device_id = this.matrixClient.getDeviceId();
|
device_id = this.matrixClient.getDeviceId();
|
||||||
@ -119,7 +179,9 @@ module.exports = function(RED) {
|
|||||||
sessionStore: new sdk.WebStorageSessionStore(localStorage),
|
sessionStore: new sdk.WebStorageSessionStore(localStorage),
|
||||||
cryptoStore: new LocalStorageCryptoStore(localStorage),
|
cryptoStore: new LocalStorageCryptoStore(localStorage),
|
||||||
userId: this.userId,
|
userId: this.userId,
|
||||||
deviceId: (this.deviceId || getStoredDeviceId(localStorage)) || undefined
|
deviceId: (this.deviceId || getStoredDeviceId(localStorage)) || undefined,
|
||||||
|
verificationMethods: ["m.sas.v1"],
|
||||||
|
cryptoCallbacks: cryptoCallbacks
|
||||||
});
|
});
|
||||||
|
|
||||||
// set globally if configured to do so
|
// set globally if configured to do so
|
||||||
|
@ -33,6 +33,11 @@
|
|||||||
<label for="node-input-roomId"><i class="fa fa-comments"></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">
|
||||||
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
<pre class="form-tips" id="node-input-roomId-error" style="color: #721c24;background-color: #f8d7da;border-color: #f5c6cb;margin-bottom: 12px;margin-top: 12px;display:none;"></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-tips" style="margin-bottom: 12px;">
|
||||||
|
User must be an admin to use this endpoint.
|
||||||
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$("#node-input-roomId").on("keyup", function() {
|
$("#node-input-roomId").on("keyup", function() {
|
||||||
@ -44,12 +49,6 @@
|
|||||||
}).trigger('keyup');
|
}).trigger('keyup');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-tips" style="margin-bottom: 12px;">
|
|
||||||
User must be an admin to use this endpoint.
|
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-synapse-join-room">
|
<script type="text/html" data-help-name="matrix-synapse-join-room">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user