Add option for allowing unknown devices

Allows workaround for sending messages until verification is implemented
This commit is contained in:
Chris Koos 2024-11-10 10:57:43 -08:00
parent 6bbd1d5119
commit cf82daf5da
2 changed files with 18 additions and 1 deletions

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({