From 6a310de70810210528427fa20b58fdef632f2af0 Mon Sep 17 00:00:00 2001 From: Skylar Sadlier Date: Fri, 3 Sep 2021 08:24:02 -0600 Subject: [PATCH 1/4] Closes #21 - Can now access the matrix client globally so it can be used in function nodes (this way you are not limited by only the nodes we have published) - Added example for using the Matrix Client in a function to redact messages. This should be a great example to show people what is possible. --- README.md | 5 + examples/README.md | 13 +++ examples/custom-redact-function-node.json | 113 ++++++++++++++++++++++ examples/custom-redact-function-node.png | Bin 0 -> 18565 bytes src/matrix-server-config.html | 19 +++- src/matrix-server-config.js | 10 ++ 6 files changed, 158 insertions(+), 2 deletions(-) create mode 100644 examples/custom-redact-function-node.json create mode 100644 examples/custom-redact-function-node.png diff --git a/README.md b/README.md index f70d2ac..399e022 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,11 @@ You can either install from within Node-RED by searching for `node-red-contrib-m npm install node-red-contrib-matrix-chat ``` +### Extra functionality +You are not limited by just the nodes we have created. If you turn on global access when setting up your Matrix Client you can access the client directly from any function node to write your own logic. + +View an example [here](https://github.com/Skylar-Tech/node-red-contrib-matrix-chat/tree/master/examples#use-function-node-to-run-any-command) + ### End-to-End Encryption Notes Currently this module has no way of getting encryption keys from other devices on the same account. Therefore it is recommended you use the bot exclusively with Node-RED after it's creation. Failure to do so will lead to your bot being unable to receive messages from e2ee rooms it joined from another client. Shared secret registration makes this super easy since it returns a token and device ID. diff --git a/examples/README.md b/examples/README.md index 8c1dae2..b1b51b7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -9,6 +9,7 @@ Build something cool with these nodes? Feel free to submit a pull request to sha - [Create User with Shared Secret Registration](#create-user-with-shared-secret-registration) - [Create/Edit Synapse User](#createedit-synapse-user) +- [Use function node to run any command](#use-function-node-to-run-any-command) - [Respond to "ping" with "pong"](#respond-to-ping-with-pong) - [Respond to "html" with an HTML message](#respond-to-html-with-an-html-message) - [Respond to "image" with an uploaded image](#respond-to-image-with-an-uploaded-image) @@ -39,6 +40,18 @@ Allows an administrator to create or modify a user account with a specified `msg ![img.png](add-user-with-admin-user.png) +### Use function node to run any command + +[View JSON](acustom-redact-function-node.json) + +If we do not have a node for something you want to do (such as redacting events/messages) you can do this manually with a function node. + +**Note:** You should make sure to catch any errors in your function node otherwise you could cause Node-RED to crash. + +To view what sort of functions you have access to check out the `client.ts` file from `matrix-js-sdk` [here](https://github.com/matrix-org/matrix-js-sdk/blob/master/src/client.ts). + +![img.png](custom-redact-function-node.png) + ### Respond to "ping" with "pong" [View JSON](respond-to-html-with-html.json) diff --git a/examples/custom-redact-function-node.json b/examples/custom-redact-function-node.json new file mode 100644 index 0000000..a4af92d --- /dev/null +++ b/examples/custom-redact-function-node.json @@ -0,0 +1,113 @@ +[ + { + "id": "89eed7ddf7a96070", + "type": "function", + "z": "f025a8b9fbd1b054", + "name": "Redact Message", + "func": "let matrixClient = global.get(\"matrixClient['@bot:example.com']\"),\n matrixOnline = global.get(\"matrixClientOnline['@bot:example.com']\");\n\nif(!matrixOnline) {\n msg.error = 'Matrix client not connected.';\n return [null, msg];\n}\n \nmatrixClient.redactEvent(msg.topic, msg.eventId, undefined, {\n reason: 'Redacted, muhahaha!'\n})\n .then(function(e) {\n msg.eventId = e.eventId;\n node.send([msg, null]);\n })\n .catch(function(e){\n node.warn(\"Error sending message \" + e);\n msg.error = e;\n node.send([null, msg]);\n });", + "outputs": 2, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 730, + "y": 1580, + "wires": [ + [ + "5decd492e2da79d9" + ], + [ + "fadcf8c32bdfd8be" + ] + ] + }, + { + "id": "5decd492e2da79d9", + "type": "debug", + "z": "f025a8b9fbd1b054", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "targetType": "full", + "statusVal": "", + "statusType": "auto", + "x": 890, + "y": 1560, + "wires": [] + }, + { + "id": "f3636f4221511a81", + "type": "comment", + "z": "f025a8b9fbd1b054", + "name": "If message is \"redact\" then redact the message.", + "info": "", + "x": 420, + "y": 1540, + "wires": [] + }, + { + "id": "9f777828840bb9a2", + "type": "matrix-receive", + "z": "f025a8b9fbd1b054", + "name": "", + "roomId": "", + "acceptText": true, + "acceptEmotes": false, + "acceptStickers": false, + "acceptReactions": false, + "acceptFiles": false, + "acceptImages": false, + "x": 320, + "y": 1580, + "wires": [ + [ + "21a00b09f8c85399" + ] + ] + }, + { + "id": "21a00b09f8c85399", + "type": "switch", + "z": "f025a8b9fbd1b054", + "name": "filter on msg.payload", + "property": "payload", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "redact", + "vt": "str" + } + ], + "checkall": "true", + "repair": false, + "outputs": 1, + "x": 520, + "y": 1580, + "wires": [ + [ + "89eed7ddf7a96070" + ] + ] + }, + { + "id": "fadcf8c32bdfd8be", + "type": "debug", + "z": "f025a8b9fbd1b054", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "targetType": "full", + "statusVal": "", + "statusType": "auto", + "x": 890, + "y": 1600, + "wires": [] + } +] \ No newline at end of file diff --git a/examples/custom-redact-function-node.png b/examples/custom-redact-function-node.png new file mode 100644 index 0000000000000000000000000000000000000000..a5c1f300c824bd41a9beea3dcc2a92ea923d6adb GIT binary patch literal 18565 zcmeIaXH-+$+BOWLpaKGd(u<%XBE2aPx&e{ii*)JIdmtbny@~W*Lhnj1p-XRp(7Ut{ znn-AYz!&$~`+4>`XaD%d_}=mTdjG&0S!>KW*S+p}x9hrRn2M4t@m-p`I5;@OZ{%du zaByy*vDeYJ@v(m;_{!LEaO4!;$Vh5<8txeoc+yX%-1<6^wI2x`;G@t zp#>hQQ~M9^xc8x_PY1to^dq6VUkK}7&@Om)2~sI=f2Wc|d^bKj&0ya*bKTmm^~*%9 zpJpA1WLa#Eqzkz$4^1>)V-7Mz5QLXIM%UvJ(Gn<6QUHTY3;}FS^4~5U^$zYqS8A#d zhfE;RPzI9R-oSsmT&c;V0*CzbJ<@%UDT+Se-=6>LN$G~2Fqp^f{~YdLw^u7zfyL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AR<_0p3Rd2S3nw69$ z8G_!}$>QO89dn;0pBL8DXxN1`%7)*o^Acfz5+mHZ&dpS~YRar-H;M^HLGDlc@&iWWQigJV_Xg6bGbC(`>@nDOoC+Xv9(2m_7Ys4|H+J$Oa|Y~hz$=s7^00u27&=8KBTiulw5}V$}ldC6c_>NtgPNWH7^BI z5$1E6E5xlEfAx<4&yIkuJOVEB;qjoA#?xTaGOYmSUrSb->uKE$N-c66R2s!FlAC{{ zJ^yw2viKA=p{%aash9S<=^_DUL{|Myp!FwxNO4b<-87TJ9 zhIr>A7dEjc(YbL`^A=8FGMr($RL&K1Edhc(Ky@2XNop(ofy3SJr#p}Tag6tX^YR`GC$jwiJp|?d9`geFKXmHK6=NUnN|zFU#3uH5A)Gg_m1HWUj0653Bm*uK literal 0 HcmV?d00001 diff --git a/src/matrix-server-config.html b/src/matrix-server-config.html index fc77518..1e6fffc 100644 --- a/src/matrix-server-config.html +++ b/src/matrix-server-config.html @@ -11,7 +11,8 @@ defaults: { name: { value: null }, autoAcceptRoomInvites: { value: true }, - enableE2ee: { type: "checkbox", value: true } + enableE2ee: { type: "checkbox", value: true }, + global: { type: "checkbox", value: true } }, icon: "matrix.png", label: function() { @@ -67,10 +68,24 @@ Enable end-to-end encryption (requires DeviceID) -

E2ee requires a Device ID to be set.
+ +
+ + +
+ If enabled this allows you to access the matrix client directly with a Function node. This way you can do whatever you want with the client.
+ Example: let client = global.get("matrixClient['@bot:example.com']") +
+