Compare commits

...

8 Commits

Author SHA1 Message Date
Chris Koos
afda5d1cd6
Merge cf82daf5da712dc083ca1632527c08d88ca73bc7 into e0947dd3bcb57475c8e11ca1181dac4624f569f6 2025-02-03 20:55:46 -07:00
e0947dd3bc
Merge pull request #128 from wuast94/master
Add m.notice to the receive node
2025-02-03 20:54:40 -07:00
8287f3c08a
Merge pull request #130 from LokiMidgard/patch-1
Support default plaintext in msg.format
2025-02-03 20:51:43 -07:00
Patrick Kranz
2a78524a90
use hasOwn instead of keys 2025-01-09 15:28:28 +01:00
Patrick Kranz
d01838ac84
Fix error 2025-01-09 15:14:50 +01:00
Patrick Kranz
2059f8455d
Update matrix-send-message.js 2025-01-09 15:12:09 +01:00
Marc
77f2c4be46 Add m.notice to the receive node 2025-01-01 05:17:12 +00:00
Chris Koos
cf82daf5da Add option for allowing unknown devices
Allows workaround for sending messages until verification is implemented
2024-11-10 10:57:43 -08:00
5 changed files with 36 additions and 3 deletions

View File

@ -13,6 +13,7 @@
acceptOwnEvents: {"value": false}, acceptOwnEvents: {"value": false},
acceptText: {"value": true}, acceptText: {"value": true},
acceptEmotes: {"value": true}, acceptEmotes: {"value": true},
acceptNotices: {"value": true},
acceptStickers: {"value": true}, acceptStickers: {"value": true},
acceptReactions: {"value": true}, acceptReactions: {"value": true},
acceptFiles: {"value": true}, acceptFiles: {"value": true},
@ -66,6 +67,16 @@
Accept text <code style="text-transform: none;">m.text</code> Accept text <code style="text-transform: none;">m.text</code>
</label> </label>
</div> </div>
<div class="form-row" style="margin-bottom:0;">
<input
type="checkbox"
id="node-input-acceptNotices"
style="width: auto; margin-left: 125px; vertical-align: top"
/>
<label for="node-input-acceptNotices" style="width: auto">
Accept notices <code style="text-transform: none;">m.notice</code>
</label>
</div>
<div class="form-row" style="margin-bottom:0;"> <div class="form-row" style="margin-bottom:0;">
<input <input
type="checkbox" type="checkbox"

View File

@ -10,6 +10,7 @@ module.exports = function(RED) {
this.acceptOwnEvents = n.acceptOwnEvents; this.acceptOwnEvents = n.acceptOwnEvents;
this.acceptText = n.acceptText; this.acceptText = n.acceptText;
this.acceptEmotes = n.acceptEmotes; this.acceptEmotes = n.acceptEmotes;
this.acceptNotices = n.acceptNotices;
this.acceptStickers = n.acceptStickers; this.acceptStickers = n.acceptStickers;
this.acceptReactions = n.acceptReactions; this.acceptReactions = n.acceptReactions;
this.acceptFiles = n.acceptFiles; this.acceptFiles = n.acceptFiles;
@ -69,6 +70,10 @@ module.exports = function(RED) {
if (!node.acceptEmotes) return; if (!node.acceptEmotes) return;
break; break;
case 'm.notice':
if (!node.acceptNotices) return;
break;
case 'm.text': case 'm.text':
if (!node.acceptText) return; if (!node.acceptText) return;
break; break;

View File

@ -127,7 +127,7 @@ module.exports = function(RED) {
} }
if(msgFormat === 'msg.format') { if(msgFormat === 'msg.format') {
if(!msg.format) { if(!Object.hasOwn(msg, 'format')) {
node.error("Message format is set to be passed in via msg.format but was not defined", msg); node.error("Message format is set to be passed in via msg.format but was not defined", msg);
return; return;
} }

View File

@ -36,7 +36,8 @@
name: { value: null }, name: { value: null },
autoAcceptRoomInvites: { value: true }, autoAcceptRoomInvites: { value: true },
enableE2ee: { type: "checkbox", value: true }, enableE2ee: { type: "checkbox", value: true },
global: { type: "checkbox", value: true } global: { type: "checkbox", value: true },
allowUnknownDevices: { type: "checkbox", value: false }
}, },
icon: "matrix.png", icon: "matrix.png",
label: function() { label: function() {
@ -130,6 +131,20 @@
<code style="white-space: normal;">let client = global.get("matrixClient['@bot:example.com']");</code> <code style="white-space: normal;">let client = global.get("matrixClient['@bot:example.com']");</code>
</div> </div>
</div> </div>
<div class="form-row">
<input
type="checkbox"
id="node-config-input-allowUnknownDevices"
style="width: auto; margin-left: 125px; vertical-align: top"
/>
<label for="node-config-input-allowUnknownDevices" style="width: auto">
Allow unverified devices in rooms
</label>
<div class="form-tips" style="margin-bottom: 12px;">
Allow sending messages to a room with unknown devices which have not been verified.
</div>
</div>
<script type="text/javascript"> <script type="text/javascript">
$("#matrix-login-btn").on("click", function() { $("#matrix-login-btn").on("click", function() {
function prettyPrintJson(json) { function prettyPrintJson(json) {

View File

@ -56,6 +56,7 @@ module.exports = function(RED) {
this.autoAcceptRoomInvites = n.autoAcceptRoomInvites; this.autoAcceptRoomInvites = n.autoAcceptRoomInvites;
this.e2ee = n.enableE2ee || false; this.e2ee = n.enableE2ee || false;
this.globalAccess = n.global; this.globalAccess = n.global;
this.allowUnknownDevices = n.allowUnknownDevices || false;
this.initializedAt = new Date(); this.initializedAt = new Date();
node.initialSyncLimit = 25; node.initialSyncLimit = 25;
@ -401,6 +402,7 @@ module.exports = function(RED) {
node.log("Initializing crypto..."); node.log("Initializing crypto...");
await node.matrixClient.initCrypto(); await node.matrixClient.initCrypto();
node.matrixClient.getCrypto().globalBlacklistUnverifiedDevices = false; // prevent errors from unverified devices node.matrixClient.getCrypto().globalBlacklistUnverifiedDevices = false; // prevent errors from unverified devices
node.matrixClient.getCrypto().globalErrorOnUnknownDevices = !node.allowUnknownDevices;
} }
node.log("Connecting to Matrix server..."); node.log("Connecting to Matrix server...");
await node.matrixClient.startClient({ await node.matrixClient.startClient({