commit
d5519a6828
@ -43,7 +43,7 @@ npm install node-red-contrib-matrix-chat
|
|||||||
### End-to-End Encryption Notes
|
### 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.
|
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.
|
||||||
|
|
||||||
This module stores a folder in your Node-RED directory called `matrix-local-storage` and is it vital that you periodically back this up if you are using e2ee. This is where the client stores all the keys necessary to decrypt messages and if lost you will lose access to e2e rooms. If you move your client to another NR install make sure to migrate this folder as well (and do not let both the old and new client run at same time).
|
This module stores a folder in your Node-RED directory called `matrix-client-storage` and is it vital that you periodically back this up if you are using e2ee. This is where the client stores all the keys necessary to decrypt messages and if lost you will lose access to e2e rooms. If you move your client to another NR install make sure to migrate this folder as well (and do not let both the old and new client run at same time).
|
||||||
|
|
||||||
Want to contribute? Any help on getting the last pieces of e2ee figured out would be greatly appreciated :)
|
Want to contribute? Any help on getting the last pieces of e2ee figured out would be greatly appreciated :)
|
||||||
|
|
||||||
|
39
package-lock.json
generated
39
package-lock.json
generated
@ -1,21 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-contrib-matrix-chat",
|
"name": "node-red-contrib-matrix-chat",
|
||||||
"version": "0.0.5",
|
"version": "0.1.8",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"version": "0.0.5",
|
"version": "0.1.8",
|
||||||
"license": "SEE LICENSE FILE",
|
"license": "SEE LICENSE FILE",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"fs-extra": "^9.1.0",
|
||||||
"got": "^11.8.2",
|
"got": "^11.8.2",
|
||||||
"isomorphic-webcrypto": "^2.3.8",
|
"isomorphic-webcrypto": "^2.3.8",
|
||||||
"matrix-js-sdk": "^12.2.0",
|
"matrix-js-sdk": "^12.2.0",
|
||||||
|
"node-localstorage": "^2.2.1",
|
||||||
"olm": "https://packages.matrix.org/npm/olm/olm-3.1.4.tgz",
|
"olm": "https://packages.matrix.org/npm/olm/olm-3.1.4.tgz",
|
||||||
"utf8": "^3.0.0"
|
"utf8": "^3.0.0"
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"node-localstorage": "^2.2.1"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/code-frame": {
|
"node_modules/@babel/code-frame": {
|
||||||
@ -2337,7 +2336,6 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
|
||||||
"integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==",
|
"integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==",
|
||||||
"optional": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 4.0.0"
|
"node": ">= 4.0.0"
|
||||||
}
|
}
|
||||||
@ -4126,7 +4124,6 @@
|
|||||||
"version": "9.1.0",
|
"version": "9.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",
|
||||||
"integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",
|
"integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",
|
||||||
"optional": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"at-least-node": "^1.0.0",
|
"at-least-node": "^1.0.0",
|
||||||
"graceful-fs": "^4.2.0",
|
"graceful-fs": "^4.2.0",
|
||||||
@ -4298,8 +4295,7 @@
|
|||||||
"node_modules/graceful-fs": {
|
"node_modules/graceful-fs": {
|
||||||
"version": "4.2.8",
|
"version": "4.2.8",
|
||||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
|
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
|
||||||
"integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==",
|
"integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg=="
|
||||||
"devOptional": true
|
|
||||||
},
|
},
|
||||||
"node_modules/har-schema": {
|
"node_modules/har-schema": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
@ -4537,7 +4533,6 @@
|
|||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
||||||
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
|
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.8.19"
|
"node": ">=0.8.19"
|
||||||
}
|
}
|
||||||
@ -5129,7 +5124,6 @@
|
|||||||
"version": "6.1.0",
|
"version": "6.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
||||||
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
||||||
"optional": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"universalify": "^2.0.0"
|
"universalify": "^2.0.0"
|
||||||
},
|
},
|
||||||
@ -6082,7 +6076,6 @@
|
|||||||
"version": "2.2.1",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/node-localstorage/-/node-localstorage-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/node-localstorage/-/node-localstorage-2.2.1.tgz",
|
||||||
"integrity": "sha512-vv8fJuOUCCvSPjDjBLlMqYMHob4aGjkmrkaE42/mZr0VT+ZAU10jRF8oTnX9+pgU9/vYJ8P7YT3Vd6ajkmzSCw==",
|
"integrity": "sha512-vv8fJuOUCCvSPjDjBLlMqYMHob4aGjkmrkaE42/mZr0VT+ZAU10jRF8oTnX9+pgU9/vYJ8P7YT3Vd6ajkmzSCw==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"write-file-atomic": "^1.1.4"
|
"write-file-atomic": "^1.1.4"
|
||||||
},
|
},
|
||||||
@ -7979,7 +7972,6 @@
|
|||||||
"version": "1.1.6",
|
"version": "1.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz",
|
||||||
"integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=",
|
"integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=",
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "*"
|
"node": "*"
|
||||||
}
|
}
|
||||||
@ -8822,7 +8814,6 @@
|
|||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
||||||
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
|
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
|
||||||
"optional": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10.0.0"
|
"node": ">= 10.0.0"
|
||||||
}
|
}
|
||||||
@ -9090,7 +9081,6 @@
|
|||||||
"version": "1.3.4",
|
"version": "1.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.4.tgz",
|
||||||
"integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=",
|
"integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"graceful-fs": "^4.1.11",
|
"graceful-fs": "^4.1.11",
|
||||||
"imurmurhash": "^0.1.4",
|
"imurmurhash": "^0.1.4",
|
||||||
@ -11090,8 +11080,7 @@
|
|||||||
"at-least-node": {
|
"at-least-node": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
|
||||||
"integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==",
|
"integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg=="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"atob": {
|
"atob": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
@ -12552,7 +12541,6 @@
|
|||||||
"version": "9.1.0",
|
"version": "9.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",
|
||||||
"integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",
|
"integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"at-least-node": "^1.0.0",
|
"at-least-node": "^1.0.0",
|
||||||
"graceful-fs": "^4.2.0",
|
"graceful-fs": "^4.2.0",
|
||||||
@ -12678,8 +12666,7 @@
|
|||||||
"graceful-fs": {
|
"graceful-fs": {
|
||||||
"version": "4.2.8",
|
"version": "4.2.8",
|
||||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
|
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
|
||||||
"integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==",
|
"integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg=="
|
||||||
"devOptional": true
|
|
||||||
},
|
},
|
||||||
"har-schema": {
|
"har-schema": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
@ -12863,8 +12850,7 @@
|
|||||||
"imurmurhash": {
|
"imurmurhash": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
||||||
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
|
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"inflight": {
|
"inflight": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
@ -13357,7 +13343,6 @@
|
|||||||
"version": "6.1.0",
|
"version": "6.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
||||||
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"graceful-fs": "^4.1.6",
|
"graceful-fs": "^4.1.6",
|
||||||
"universalify": "^2.0.0"
|
"universalify": "^2.0.0"
|
||||||
@ -14184,7 +14169,6 @@
|
|||||||
"version": "2.2.1",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/node-localstorage/-/node-localstorage-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/node-localstorage/-/node-localstorage-2.2.1.tgz",
|
||||||
"integrity": "sha512-vv8fJuOUCCvSPjDjBLlMqYMHob4aGjkmrkaE42/mZr0VT+ZAU10jRF8oTnX9+pgU9/vYJ8P7YT3Vd6ajkmzSCw==",
|
"integrity": "sha512-vv8fJuOUCCvSPjDjBLlMqYMHob4aGjkmrkaE42/mZr0VT+ZAU10jRF8oTnX9+pgU9/vYJ8P7YT3Vd6ajkmzSCw==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"write-file-atomic": "^1.1.4"
|
"write-file-atomic": "^1.1.4"
|
||||||
}
|
}
|
||||||
@ -15684,8 +15668,7 @@
|
|||||||
"slide": {
|
"slide": {
|
||||||
"version": "1.1.6",
|
"version": "1.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz",
|
||||||
"integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=",
|
"integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"snapdragon": {
|
"snapdragon": {
|
||||||
"version": "0.8.2",
|
"version": "0.8.2",
|
||||||
@ -16387,8 +16370,7 @@
|
|||||||
"universalify": {
|
"universalify": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
||||||
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
|
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"unpipe": {
|
"unpipe": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@ -16615,7 +16597,6 @@
|
|||||||
"version": "1.3.4",
|
"version": "1.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.4.tgz",
|
||||||
"integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=",
|
"integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"graceful-fs": "^4.1.11",
|
"graceful-fs": "^4.1.11",
|
||||||
"imurmurhash": "^0.1.4",
|
"imurmurhash": "^0.1.4",
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-contrib-matrix-chat",
|
"name": "node-red-contrib-matrix-chat",
|
||||||
"version": "0.1.8",
|
"version": "0.2.0",
|
||||||
"description": "Matrix chat server client for Node-RED",
|
"description": "Matrix chat server client for Node-RED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"fs-extra": "^9.1.0",
|
||||||
"got": "^11.8.2",
|
"got": "^11.8.2",
|
||||||
"isomorphic-webcrypto": "^2.3.8",
|
"isomorphic-webcrypto": "^2.3.8",
|
||||||
"matrix-js-sdk": "^12.2.0",
|
"matrix-js-sdk": "^12.2.0",
|
||||||
|
"node-localstorage": "^2.2.1",
|
||||||
"olm": "https://packages.matrix.org/npm/olm/olm-3.1.4.tgz",
|
"olm": "https://packages.matrix.org/npm/olm/olm-3.1.4.tgz",
|
||||||
"utf8": "^3.0.0",
|
"utf8": "^3.0.0"
|
||||||
"node-localstorage": "^2.2.1"
|
|
||||||
},
|
},
|
||||||
"node-red": {
|
"node-red": {
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
@ -27,30 +27,19 @@
|
|||||||
<label for="node-input-server"><i class="fa fa-user"></i> Matrix Server Config</label>
|
<label for="node-input-server"><i class="fa fa-user"></i> Matrix Server Config</label>
|
||||||
<input type="text" id="node-input-server">
|
<input type="text" id="node-input-server">
|
||||||
</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-create-room">
|
<script type="text/html" data-help-name="matrix-create-room">
|
||||||
<h3>Details</h3>
|
<h3>Details</h3>
|
||||||
<p>
|
<p>Create a Matrix room</p>
|
||||||
Create a room with the defined options in <code>msg.payload</code>
|
<a href="https://matrix.org/docs/spec/client_server/r0.4.0#id266" target="_blank">Matrix API Endpoint Information</a>
|
||||||
</p>
|
|
||||||
<a href="https://matrix-org.github.io/synapse/develop/admin_api/room_membership.html#edit-room-membership-api" target="_blank">Synapse API Endpoint Information</a>
|
|
||||||
|
|
||||||
<h3>Inputs</h3>
|
<h3>Inputs</h3>
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.payload
|
<dt class="optional">msg.payload
|
||||||
<span class="property-type">string</span>
|
<span class="property-type">string | object | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> a list of options to pass to the /createRoom API. <a href="https://matrix.org/docs/spec/client_server/r0.4.0#id266">Click here</a> for information about what can be passed.</dd>
|
<dd> a list of options to pass to the /createRoom API. <a href="https://matrix.org/docs/spec/client_server/r0.4.0#id266">Click here</a> for information about what can be passed. If this is a string it just sets the room name and ignores other options.</dd>
|
||||||
|
|
||||||
<dt>msg.userId
|
|
||||||
<span class="property-type">string</span>
|
|
||||||
</dt>
|
|
||||||
<dd> User's ID that will be set into the room.</dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h3>Outputs</h3>
|
<h3>Outputs</h3>
|
||||||
|
@ -53,7 +53,6 @@ module.exports = function(RED) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need the status code, so set onlydata to false for this request
|
|
||||||
node.server.matrixClient
|
node.server.matrixClient
|
||||||
.createRoom(msg.payload || {})
|
.createRoom(msg.payload || {})
|
||||||
.then(function(e){
|
.then(function(e){
|
||||||
|
@ -25,22 +25,22 @@
|
|||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-decrypt-file">
|
<script type="text/html" data-help-name="matrix-decrypt-file">
|
||||||
<h3>Details</h3>
|
<h3>Details</h3>
|
||||||
<p>Files sent in an encrypted room are themselves encrypted. Use this node to encrypt/decrypt files. Note: This node will download the encryted file (required to decrypt)</p>
|
<p>Files sent in an encrypted room are themselves encrypted. Use this node to encrypt/decrypt files. Note: This node will download the encrypted file so be cautious of large downloads.</p>
|
||||||
|
|
||||||
<h3>Inputs</h3>
|
<h3>Inputs</h3>
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.content
|
<dt>msg.content
|
||||||
<span class="property-type">Object</span>
|
<span class="property-type">object</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> content of the decrypted message</dd>
|
<dd> content of the decrypted message</dd>
|
||||||
|
|
||||||
<dt>msg.content.file
|
<dt>msg.content.file
|
||||||
<span class="property-type">Object</span>
|
<span class="property-type">object</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> the information needed to decode the file</dd>
|
<dd> the information needed to decode the file</dd>
|
||||||
|
|
||||||
<dt>msg.url
|
<dt>msg.url
|
||||||
<span class="property-type">String | Null</span>
|
<span class="property-type">string | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> the decoded mxc url.</dd>
|
<dd> the decoded mxc url.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -57,6 +57,9 @@
|
|||||||
|
|
||||||
<dt>msg.filename <span class="property-type">string</span></dt>
|
<dt>msg.filename <span class="property-type">string</span></dt>
|
||||||
<dd>filename of the decoded file (if content.filename isn't defined on the message we fallback to content.body).</dd>
|
<dd>filename of the decoded file (if content.filename isn't defined on the message we fallback to content.body).</dd>
|
||||||
|
|
||||||
|
<dt>msg.thumbnail_payload <span class="property-type">buffer</span></dt>
|
||||||
|
<dd>If the file is an image then this property is set to the buffer of the thumbnail. If not an image this is left off.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
<li>Error
|
<li>Error
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
<script type="text/html" data-help-name="matrix-invite-room">
|
<script type="text/html" data-help-name="matrix-invite-room">
|
||||||
<h3>Details</h3>
|
<h3>Details</h3>
|
||||||
<p>
|
<p>
|
||||||
This API invites a user to participate in a particular room. They do not start participating in the room until they actually join the room.
|
This node invites a user to participate in a particular room. They do not start participating in the room until they actually join the room. The client must be in the room and have permissions to invite.
|
||||||
</p>
|
</p>
|
||||||
<a href="https://matrix-org.github.io/synapse/develop/admin_api/room_membership.html#edit-room-membership-api" target="_blank">Synapse API Endpoint Information</a>
|
<a href="https://matrix-org.github.io/synapse/develop/admin_api/room_membership.html#edit-room-membership-api" target="_blank">Synapse API Endpoint Information</a>
|
||||||
|
|
||||||
@ -41,7 +41,7 @@
|
|||||||
<dt>msg.topic
|
<dt>msg.topic
|
||||||
<span class="property-type">string</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> The room identifier to invite to: for example, <code>!h8zld9j31:example.com. If configured on the node it overrides this input and is no longer required.</code>.</dd>
|
<dd> The room identifier to invite to: for example, <code>!h8zld9j31:example.com</code>. Ignored if configured on the node, otherwise required.</dd>
|
||||||
|
|
||||||
<dt>msg.userId
|
<dt>msg.userId
|
||||||
<span class="property-type">string</span>
|
<span class="property-type">string</span>
|
||||||
|
@ -58,7 +58,7 @@ module.exports = function(RED) {
|
|||||||
msg.payload = e;
|
msg.payload = e;
|
||||||
node.send([msg, null]);
|
node.send([msg, null]);
|
||||||
}).catch(function(e){
|
}).catch(function(e){
|
||||||
node.warn("Error creating room " + e);
|
node.warn("Error inviting to room " + e);
|
||||||
msg.error = e;
|
msg.error = e;
|
||||||
node.send([null, msg]);
|
node.send([null, msg]);
|
||||||
});
|
});
|
||||||
|
@ -26,25 +26,22 @@
|
|||||||
<label for="node-input-server"><i class="fa fa-user"></i> Matrix Server Config</label>
|
<label for="node-input-server"><i class="fa fa-user"></i> Matrix Server Config</label>
|
||||||
<input type="text" id="node-input-server">
|
<input type="text" id="node-input-server">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-tips">
|
|
||||||
Room ID must either be defined here or passed in via <code>msg.topic</code>. The config takes precedence over the input.
|
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-join-room">
|
<script type="text/html" data-help-name="matrix-join-room">
|
||||||
<h3>Details</h3>
|
<h3>Details</h3>
|
||||||
<p>This API starts a user participating in a particular room, if that user is allowed to participate in that room. After this call, the client is allowed to see all current state events in the room, and all subsequent events associated with the room until the user leaves the room.</p>
|
<p>This node starts the client participating in a particular room, if the client is allowed to participate in that room. After this call, the client is allowed to see all current state events in the room, and all subsequent events associated with the room until the user leaves the room.</p>
|
||||||
<a href="https://matrix.org/docs/spec/client_server/latest#id291" target="_blank">Matrix API Endpoint Information</a>
|
<a href="https://matrix.org/docs/spec/client_server/latest#id291" target="_blank">Matrix API Endpoint Information</a>
|
||||||
|
|
||||||
<h3>Inputs</h3>
|
<h3>Inputs</h3>
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.topic
|
<dt>msg.topic
|
||||||
<span class="property-type">String</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> The room identifier or alias to join.</dd>
|
<dd> The room identifier or alias to join.</dd>
|
||||||
|
|
||||||
<dt class="optional">msg.joinOpts
|
<dt class="optional">msg.joinOpts
|
||||||
<span class="property-type">Object</span>
|
<span class="property-type">object | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Extra options that can be passed when joining a room.</dd>
|
<dd> Extra options that can be passed when joining a room.</dd>
|
||||||
|
|
||||||
@ -62,11 +59,6 @@
|
|||||||
<span class="property-type">[string]</span>
|
<span class="property-type">[string]</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> The servers to attempt to join the room through. One of the servers must be participating in the room.</dd>
|
<dd> The servers to attempt to join the room through. One of the servers must be participating in the room.</dd>
|
||||||
|
|
||||||
<dt class="optional">msg.reason
|
|
||||||
<span class="property-type">String</span>
|
|
||||||
</dt>
|
|
||||||
<dd> Reason for kicking the user.</dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h3>Outputs</h3>
|
<h3>Outputs</h3>
|
||||||
|
@ -29,33 +29,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-user"></i> Room ID</label>
|
||||||
<input type="text" id="node-input-roomId">
|
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-messageType">
|
|
||||||
Message Type
|
|
||||||
</label>
|
|
||||||
<select id="node-input-messageType">
|
|
||||||
<option value="m.text">m.text</option>
|
|
||||||
<option value="m.notice">m.notice</option>
|
|
||||||
<option value="msg.type">msg.type input</option>
|
|
||||||
</select>
|
|
||||||
<div class="form-tips">
|
|
||||||
It's recommended to use m.notice for bots because the message will render in a lighter text (at least in Element client) for users to distinguish bot and real user messages.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-messageFormat">
|
|
||||||
Message Format
|
|
||||||
</label>
|
|
||||||
<select id="node-input-messageFormat">
|
|
||||||
<option value="">Default (plaintext)</option>
|
|
||||||
<option value="html">HTML</option>
|
|
||||||
<option value="msg.format">msg.format input</option>
|
|
||||||
</select>
|
|
||||||
</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>
|
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -66,18 +40,18 @@
|
|||||||
<h3>Inputs</h3>
|
<h3>Inputs</h3>
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<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. </dd>
|
||||||
|
|
||||||
<dt>msg.topic
|
<dt>msg.topic
|
||||||
<span class="property-type">String | Null</span>
|
<span class="property-type">string | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Room ID to send image to. Optional if configured on the node. If configured on the node this will be ignored.</dd>
|
<dd> Room ID to send image to. Optional if configured on the node. If configured on the node this will be ignored.</dd>
|
||||||
|
|
||||||
<dt>msg.referenceEventId<br />
|
<dt>msg.referenceEventId<br />
|
||||||
msg.eventId
|
msg.eventId
|
||||||
<span class="property-type">String</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> One of these is required. This is the eventId of the message to react to. Uses <code>msg.referenceEventId</code> first and falls back to <code>msg.eventId</code>.</dd>
|
<dd> One of these is required. This is the eventId of the message to react to. Uses <code>msg.referenceEventId</code> first and falls back to <code>msg.eventId</code>.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -86,8 +60,6 @@
|
|||||||
<ol class="node-ports">
|
<ol class="node-ports">
|
||||||
<li>Success
|
<li>Success
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dd>original msg object preserved.</dd>
|
|
||||||
|
|
||||||
<dt>msg.eventId <span class="property-type">string</span></dt>
|
<dt>msg.eventId <span class="property-type">string</span></dt>
|
||||||
<dd>the eventId from the posted reaction.</dd>
|
<dd>the eventId from the posted reaction.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
@ -107,7 +107,7 @@
|
|||||||
<p>Receive events from Matrix.</p>
|
<p>Receive events from Matrix.</p>
|
||||||
|
|
||||||
<h3>Outputs</h3>
|
<h3>Outputs</h3>
|
||||||
<ol class="node-ports">
|
<ul class="node-ports">
|
||||||
<li>Always Returned
|
<li>Always Returned
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.type <span class="property-type">string</span></dt>
|
<dt>msg.type <span class="property-type">string</span></dt>
|
||||||
@ -146,6 +146,11 @@
|
|||||||
<dd>the event object returned by the Matrix server</dd>
|
<dd>the event object returned by the Matrix server</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
<dl class="message-properties">
|
||||||
|
<dt>msg.eventId <span class="property-type">object</span></dt>
|
||||||
|
<dd>The event ID, e.g. $143350589368169JsLZx:localhost</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.content <span class="property-type">object</span></dt>
|
<dt>msg.content <span class="property-type">object</span></dt>
|
||||||
<dd>the message's content object</dd>
|
<dd>the message's content object</dd>
|
||||||
@ -159,11 +164,6 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li><code>msg.type</code> == '<strong>m.reaction</strong>'
|
<li><code>msg.type</code> == '<strong>m.reaction</strong>'
|
||||||
<dl class="message-properties">
|
|
||||||
<dt>msg.info <span class="property-type">object</span></dt>
|
|
||||||
<dd>the content's info.</dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.referenceEventId <span class="property-type">string</span></dt>
|
<dt>msg.referenceEventId <span class="property-type">string</span></dt>
|
||||||
<dd>the message that the reaction relates to</dd>
|
<dd>the message that the reaction relates to</dd>
|
||||||
@ -187,39 +187,54 @@
|
|||||||
<dd>URL to the sticker image</dd>
|
<dd>URL to the sticker image</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
<dl class="message-properties">
|
||||||
|
<dt>msg.mxc_url <span class="property-type">string</span></dt>
|
||||||
|
<dd>Matrix URL to the sticker image</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.thumbnail_url <span class="property-type">string</span></dt>
|
<dt>msg.thumbnail_url <span class="property-type">string</span></dt>
|
||||||
<dd>URL to the thumbnail of the sticker</dd>
|
<dd>URL to the thumbnail of the sticker</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
<dl class="message-properties">
|
||||||
|
<dt>msg.thumbnail_mxc_url <span class="property-type">string</span></dt>
|
||||||
|
<dd>Matrix URL to the thumbnail of the sticker</dd>
|
||||||
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li><code>msg.type</code> == '<strong>m.file</strong>'
|
<li><code>msg.type</code> == '<strong>m.file</strong>'
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.file.info <span class="property-type">string</span></dt>
|
<dt>msg.url <span class="property-type">string</span></dt>
|
||||||
<dd>the content's info.</dd>
|
<dd>the file's URL</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.file.url <span class="property-type">string</span></dt>
|
<dt>msg.mxc_url <span class="property-type">string</span></dt>
|
||||||
<dd>the file's URL</dd>
|
<dd>the file's Matrix URL</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li><code>msg.type</code> == '<strong>m.image</strong>'
|
<li><code>msg.type</code> == '<strong>m.image</strong>'
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.image.info <span class="property-type">string</span></dt>
|
<dt>msg.url <span class="property-type">string</span></dt>
|
||||||
<dd>the image info.</dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<dl class="message-properties">
|
|
||||||
<dt>msg.file.url <span class="property-type">string</span></dt>
|
|
||||||
<dd>the image's URL</dd>
|
<dd>the image's URL</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.file.thumbnail_url <span class="property-type">string</span></dt>
|
<dt>msg.mxc_url <span class="property-type">string</span></dt>
|
||||||
|
<dd>the image's Matrix URL</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<dl class="message-properties">
|
||||||
|
<dt>msg.thumbnail_url <span class="property-type">string</span></dt>
|
||||||
<dd>the image's thumbnail URL</dd>
|
<dd>the image's thumbnail URL</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
<dl class="message-properties">
|
||||||
|
<dt>msg.thumbnail_mxc_url <span class="property-type">string</span></dt>
|
||||||
|
<dd>the image's thumbnail Matrix URL</dd>
|
||||||
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ul>
|
||||||
</script>
|
</script>
|
@ -81,10 +81,12 @@ module.exports = function(RED) {
|
|||||||
if(msg.content.info) {
|
if(msg.content.info) {
|
||||||
if(msg.content.info.thumbnail_url) {
|
if(msg.content.info.thumbnail_url) {
|
||||||
msg.thumbnail_url = node.server.matrixClient.mxcUrlToHttp(msg.content.info.thumbnail_url);
|
msg.thumbnail_url = node.server.matrixClient.mxcUrlToHttp(msg.content.info.thumbnail_url);
|
||||||
|
msg.thumbnail_mxc_url = msg.content.info.thumbnail_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg.content.url) {
|
if(msg.content.url) {
|
||||||
msg.url = node.server.matrixClient.mxcUrlToHttp(msg.content.url);
|
msg.url = node.server.matrixClient.mxcUrlToHttp(msg.content.url);
|
||||||
|
msg.mxc_url = msg.content.url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -31,9 +31,6 @@
|
|||||||
<label for="node-input-roomId"><i class="fa fa-user"></i> Room ID</label>
|
<label for="node-input-roomId"><i class="fa fa-user"></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-tips">
|
|
||||||
Room ID must either be defined here or passed in via <code>msg.topic</code>. The config takes precedence over the input.
|
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-room-ban">
|
<script type="text/html" data-help-name="matrix-room-ban">
|
||||||
@ -42,18 +39,18 @@
|
|||||||
|
|
||||||
<h3>Inputs</h3>
|
<h3>Inputs</h3>
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt class="optional">msg.userId
|
<dt>msg.userId
|
||||||
<span class="property-type">String</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> The ID of the user to ban.</dd>
|
<dd> The ID of the user to ban.</dd>
|
||||||
|
|
||||||
<dt class="optional">msg.topic
|
<dt class="optional">msg.topic
|
||||||
<span class="property-type">String | Null</span>
|
<span class="property-type">string | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> The room to ban the user from. Required if not defined on the config. Config takes precedence.</dd>
|
<dd> The room to ban the user from. Ignored if configured on the node, otherwise required.</dd>
|
||||||
|
|
||||||
<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.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -62,7 +59,8 @@
|
|||||||
<ol class="node-ports">
|
<ol class="node-ports">
|
||||||
<li>Success
|
<li>Success
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dd>original msg object preserved. Node doesn't set anything.</dd>
|
<dt>msg.eventId <span class="property-type">string</span></dt>
|
||||||
|
<dd>the eventId from the ban event.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
<li>Error
|
<li>Error
|
||||||
|
@ -31,9 +31,6 @@
|
|||||||
<label for="node-input-roomId"><i class="fa fa-user"></i> Room ID</label>
|
<label for="node-input-roomId"><i class="fa fa-user"></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-tips">
|
|
||||||
Room ID must either be defined here or passed in via <code>msg.topic</code>. The config takes precedence over the input.
|
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-room-kick">
|
<script type="text/html" data-help-name="matrix-room-kick">
|
||||||
@ -43,17 +40,17 @@
|
|||||||
<h3>Inputs</h3>
|
<h3>Inputs</h3>
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.userId
|
<dt>msg.userId
|
||||||
<span class="property-type">String</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> The ID of the user to kick.</dd>
|
<dd> The ID of the user to kick.</dd>
|
||||||
|
|
||||||
<dt class="optional">msg.topic
|
<dt class="optional">msg.topic
|
||||||
<span class="property-type">String | Null</span>
|
<span class="property-type">string | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> The room to kick the user from. Required if not defined on the config. Config takes precedence.</dd>
|
<dd> The room to kick the user from. Ignored if configured on the node, otherwise required.</dd>
|
||||||
|
|
||||||
<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.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -62,7 +59,8 @@
|
|||||||
<ol class="node-ports">
|
<ol class="node-ports">
|
||||||
<li>Success
|
<li>Success
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dd>original msg object preserved. Node doesn't set anything.</dd>
|
<dt>msg.eventId <span class="property-type">string</span></dt>
|
||||||
|
<dd>the eventId from the kick event.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
<li>Error
|
<li>Error
|
||||||
|
@ -38,15 +38,15 @@
|
|||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-room-users">
|
<script type="text/html" data-help-name="matrix-room-users">
|
||||||
<h3>Details</h3>
|
<h3>Details</h3>
|
||||||
<p>A list of members of the room. If you are joined to the room then this will be the current members of the room. If you have left the room then this will be the members of the room when you left.</p>
|
<p>This node returns a map of MXIDs to member info objects for members of the room. The current user must be in the room for it to work, unless it is an Application Service in which case any of the AS's users must be in the room. This API is primarily for Application Services and should be faster to respond than /members as it can be implemented more efficiently on the server.</p>
|
||||||
<a href="https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-rooms-roomid-joined-members" target="_blank">Matrix API Endpoint Information</a>
|
<a href="https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-rooms-roomid-joined-members" target="_blank">Matrix API Endpoint Information</a>
|
||||||
|
|
||||||
<h3>Inputs</h3>
|
<h3>Inputs</h3>
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt class="optional">msg.topic
|
<dt class="optional">msg.topic
|
||||||
<span class="property-type">Integer</span>
|
<span class="property-type">integer</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Room ID to get member list from. Required if not configured on the node.</dd>
|
<dd> Room ID to get member list from. Ignored if configured on the node, otherwise it's required.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h3>Outputs</h3>
|
<h3>Outputs</h3>
|
||||||
|
@ -30,14 +30,14 @@
|
|||||||
</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-user"></i> Room ID</label>
|
||||||
<input type="text" id="node-input-roomId">
|
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-contentType"><i class="fa fa-user"></i> Content-Type</label>
|
<label for="node-input-contentType"><i class="fa fa-user"></i> Content-Type</label>
|
||||||
<input type="text" id="node-input-contentType" placeholder="application/pdf">
|
<input type="text" id="node-input-contentType" placeholder="msg.contentType">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-tips">
|
<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>
|
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>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -48,36 +48,42 @@
|
|||||||
<h3>Inputs</h3>
|
<h3>Inputs</h3>
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.payload
|
<dt>msg.payload
|
||||||
<span class="property-type">File | String | Buffer | ReadStream | Blob</span>
|
<span class="property-type">File | string | Buffer | ReadStream | Blob</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> the contents of the file to upload. </dd>
|
<dd> the contents of the file to upload. </dd>
|
||||||
|
|
||||||
<dt>msg.topic
|
<dt>msg.topic
|
||||||
<span class="property-type">String | Null</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Room ID to send file to. Optional if configured on the node. Overrides node configuration if set.</dd>
|
<dd> Room ID to send file to. Ignored if configured on the node, otherwise required.</dd>
|
||||||
|
|
||||||
<dt class="optional">msg.filename
|
<dt class="optional">msg.filename
|
||||||
<span class="property-type">String | Null</span>
|
<span class="property-type">string | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> name of the file to upload (optional). Overrides node configuration.</dd>
|
<dd> name of the file to upload (optional). Note: If this is not defined the file will receive a randomly generated name (without an extension).</dd>
|
||||||
|
|
||||||
<dt class="optional">msg.contentType
|
|
||||||
<span class="property-type">String | Null</span>
|
|
||||||
</dt>
|
|
||||||
<dd> Content <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types" target="_blank">MIME Type</a>. Optional if configured on the node. Overrides node configuration if set.</dd>
|
|
||||||
|
|
||||||
<dt class="optional">msg.body
|
<dt class="optional">msg.body
|
||||||
<span class="property-type">String | Null</span>
|
<span class="property-type">string | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> this will be the display name the client will see when rendered in their chat client. If this is left empty the it uses <code>msg.filename</code>. If <code>msg.filename</code> is also undefined it sets it to empty string</dd>
|
<dd> this will be the display name the client will see when rendered in their chat client. If this is left empty it will just display as "Attachment".</dd>
|
||||||
|
|
||||||
|
<dt class="optional">msg.contentType
|
||||||
|
<span class="property-type">string | null</span>
|
||||||
|
</dt>
|
||||||
|
<dd> Content <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types" target="_blank">MIME Type</a>. Optional but highly recommended (so the client receiving knows what type of file it is).</dd>
|
||||||
|
|
||||||
|
<dt class="optional">msg.content
|
||||||
|
<span class="property-type">object | null</span>
|
||||||
|
</dt>
|
||||||
|
<dd> craft your own msg.content to send to the server. If defined then <code>msg.filename</code>, <code>msg.contentType</code>, <code>msg.body</code>, and <code>msg.payload</code> aren't required since the file already exists.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h3>Outputs</h3>
|
<h3>Outputs</h3>
|
||||||
<ol class="node-ports">
|
<ol class="node-ports">
|
||||||
<li>Success
|
<li>Success
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dd>original msg object preserved.</dd>
|
<dt>msg.eventId <span class="property-type">string</span></dt>
|
||||||
|
<dd>the eventId from the posted message.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
<li>Error
|
<li>Error
|
||||||
|
@ -61,17 +61,12 @@ module.exports = function(RED) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.contentType = msg.contentType || node.contentType;
|
msg.contentType = node.contentType || msg.contentType || null;
|
||||||
if(!msg.contentType) {
|
|
||||||
node.error('msg.contentType is required');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
node.log("Uploading file " + msg.filename);
|
node.log("Uploading file " + msg.filename);
|
||||||
node.server.matrixClient.uploadContent(
|
node.server.matrixClient.uploadContent(
|
||||||
msg.payload, {
|
msg.payload, {
|
||||||
name: msg.filename || null, // Name to give the file on the server.
|
name: msg.filename || null, // Name to give the file on the server.
|
||||||
rawResponse: (msg.rawResponse || false), // Return the raw body, rather than parsing the JSON.
|
rawResponse: false, // Return the raw body, rather than parsing the JSON.
|
||||||
type: msg.contentType, // Content-type for the upload. Defaults to file.type, or applicaton/octet-stream.
|
type: msg.contentType, // Content-type for the upload. Defaults to file.type, or applicaton/octet-stream.
|
||||||
onlyContentUri: false // Just return the content URI, rather than the whole body. Defaults to false. Ignored if opts.rawResponse is true.
|
onlyContentUri: false // Just return the content URI, rather than the whole body. Defaults to false. Ignored if opts.rawResponse is true.
|
||||||
})
|
})
|
||||||
@ -79,18 +74,18 @@ module.exports = function(RED) {
|
|||||||
const content = {
|
const content = {
|
||||||
msgtype: 'm.file',
|
msgtype: 'm.file',
|
||||||
url: file.content_uri,
|
url: file.content_uri,
|
||||||
body: (msg.body || msg.filename) || "",
|
body: msg.body || "",
|
||||||
};
|
};
|
||||||
node.server.matrixClient
|
node.server.matrixClient
|
||||||
.sendMessage(msg.topic, content)
|
.sendMessage(msg.topic, content)
|
||||||
.then(function(imgResp) {
|
.then(function(e) {
|
||||||
node.log("File message sent: " + imgResp);
|
node.log("File message sent: " + e);
|
||||||
msg.eventId = e.eventId;
|
msg.eventId = e.eventId;
|
||||||
node.send([msg, null]);
|
node.send([msg, null]);
|
||||||
})
|
})
|
||||||
.catch(function(e){
|
.catch(function(e){
|
||||||
node.warn("Error sending file message " + e);
|
node.warn("Error sending file message " + e);
|
||||||
msg.matrixError = e;
|
msg.error = e;
|
||||||
node.send([null, msg]);
|
node.send([null, msg]);
|
||||||
});
|
});
|
||||||
}).catch(function(e){
|
}).catch(function(e){
|
||||||
|
@ -30,50 +30,50 @@
|
|||||||
</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-user"></i> Room ID</label>
|
||||||
<input type="text" id="node-input-roomId">
|
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-contentType"><i class="fa fa-user"></i> Content-Type</label>
|
<label for="node-input-contentType"><i class="fa fa-user"></i> Content-Type</label>
|
||||||
<input type="text" id="node-input-contentType" placeholder="application/png">
|
<input type="text" id="node-input-contentType" placeholder="application/png">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-tips">
|
<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>
|
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>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-send-image">
|
<script type="text/html" data-help-name="matrix-send-image">
|
||||||
<h3>Details</h3>
|
<h3>Details</h3>
|
||||||
<p>This node will send an image to a Matrix chat room. You can link this directly to a File In node.</p>
|
<p>This node will send an image to a Matrix chat room. Supports direct linking to a File In node.</p>
|
||||||
|
|
||||||
<h3>Inputs</h3>
|
<h3>Inputs</h3>
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.payload
|
<dt>msg.payload
|
||||||
<span class="property-type">File | String | Buffer | ReadStream | Blob</span>
|
<span class="property-type">File | string | Buffer | ReadStream | Blob</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> the contents of the image to upload. </dd>
|
<dd> the contents of the image to upload. </dd>
|
||||||
|
|
||||||
<dt>msg.topic
|
<dt>msg.topic
|
||||||
<span class="property-type">String | Null</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Room ID to send image to. Optional if configured on the node. Overrides node configuration if set.</dd>
|
<dd> Room ID to send image to. Ignored if configured on the node, otherwise required.</dd>
|
||||||
|
|
||||||
<dt class="optional">msg.filename
|
<dt class="optional">msg.filename
|
||||||
<span class="property-type">String | Null</span>
|
<span class="property-type">string | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> name of the image file to upload (optional). Overrides node configuration.</dd>
|
<dd> name of the image to upload (optional). Note: If this is not defined the file will receive a randomly generated name (without an extension).</dd>
|
||||||
|
|
||||||
<dt class="optional">msg.contentType
|
|
||||||
<span class="property-type">String | Null</span>
|
|
||||||
</dt>
|
|
||||||
<dd> Content <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types" target="_blank">MIME Type</a>. Optional if configured on the node. Overrides node configuration if set.</dd>
|
|
||||||
|
|
||||||
<dt class="optional">msg.body
|
<dt class="optional">msg.body
|
||||||
<span class="property-type">String | Null</span>
|
<span class="property-type">string | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> this will be the display name the client will see when rendered in their chat client. If this is left empty the it uses <code>msg.filename</code>. If <code>msg.filename</code> is also undefined it sets it to empty string</dd>
|
<dd> this will be the display name the client will see when rendered in their chat client. If this is left empty it will just display as "Attachment".</dd>
|
||||||
|
|
||||||
|
<dt class="optional">msg.contentType
|
||||||
|
<span class="property-type">string | null</span>
|
||||||
|
</dt>
|
||||||
|
<dd> Content <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types" target="_blank">MIME Type</a>. Overridden if configured on the node. Optional but highly recommended (so the client receiving knows what type of file it is).</dd>
|
||||||
|
|
||||||
<dt class="optional">msg.content
|
<dt class="optional">msg.content
|
||||||
<span class="property-type">Object | Null</span>
|
<span class="property-type">object | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> craft your own msg.content to send to the server. If defined then <code>msg.filename</code>, <code>msg.contentType</code>, <code>msg.body</code>, and <code>msg.payload</code> aren't required since the file already exists.</dd>
|
<dd> craft your own msg.content to send to the server. If defined then <code>msg.filename</code>, <code>msg.contentType</code>, <code>msg.body</code>, and <code>msg.payload</code> aren't required since the file already exists.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -82,8 +82,6 @@
|
|||||||
<ol class="node-ports">
|
<ol class="node-ports">
|
||||||
<li>Success
|
<li>Success
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dd>original msg object preserved.</dd>
|
|
||||||
|
|
||||||
<dt>msg.eventId <span class="property-type">string</span></dt>
|
<dt>msg.eventId <span class="property-type">string</span></dt>
|
||||||
<dd>the eventId from the posted message.</dd>
|
<dd>the eventId from the posted message.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
@ -61,17 +61,12 @@ module.exports = function(RED) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.contentType = msg.contentType || node.contentType;
|
msg.contentType = node.contentType || msg.contentType || null;
|
||||||
if(!msg.contentType) {
|
|
||||||
node.error('msg.contentType is required');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
node.log("Uploading image " + msg.filename);
|
node.log("Uploading image " + msg.filename);
|
||||||
node.server.matrixClient.uploadContent(
|
node.server.matrixClient.uploadContent(
|
||||||
msg.payload, {
|
msg.payload, {
|
||||||
name: msg.filename || null, // Name to give the file on the server.
|
name: msg.filename || null, // Name to give the file on the server.
|
||||||
rawResponse: (msg.rawResponse || false), // Return the raw body, rather than parsing the JSON.
|
rawResponse: false, // Return the raw body, rather than parsing the JSON.
|
||||||
type: msg.contentType, // Content-type for the upload. Defaults to file.type, or applicaton/octet-stream.
|
type: msg.contentType, // Content-type for the upload. Defaults to file.type, or applicaton/octet-stream.
|
||||||
onlyContentUri: false // Just return the content URI, rather than the whole body. Defaults to false. Ignored if opts.rawResponse is true.
|
onlyContentUri: false // Just return the content URI, rather than the whole body. Defaults to false. Ignored if opts.rawResponse is true.
|
||||||
})
|
})
|
||||||
@ -91,7 +86,7 @@ module.exports = function(RED) {
|
|||||||
})
|
})
|
||||||
.catch(function(e){
|
.catch(function(e){
|
||||||
node.warn("Error uploading image message " + e);
|
node.warn("Error uploading image message " + e);
|
||||||
msg.matrixError = e;
|
msg.error = e;
|
||||||
node.send([null, msg]);
|
node.send([null, msg]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -25,14 +25,17 @@
|
|||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="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">
|
||||||
<label for="node-input-server"><i class="fa fa-user"></i> Matrix Server Config</label>
|
<label for="node-input-server"><i class="fa fa-user"></i> Matrix Server Config</label>
|
||||||
<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-user"></i> Room ID</label>
|
||||||
<input type="text" id="node-input-roomId">
|
<input type="text" id="node-input-roomId" placeholder="msg.topic">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-messageType">
|
<label for="node-input-messageType">
|
||||||
Message Type
|
Message Type
|
||||||
@ -42,10 +45,11 @@
|
|||||||
<option value="m.notice">m.notice</option>
|
<option value="m.notice">m.notice</option>
|
||||||
<option value="msg.type">msg.type input</option>
|
<option value="msg.type">msg.type input</option>
|
||||||
</select>
|
</select>
|
||||||
<div class="form-tips">
|
</div>
|
||||||
|
<div class="form-row form-tips">
|
||||||
It's recommended to use m.notice for bots because the message will render in a lighter text (at least in Element client) for users to distinguish bot and real user messages.
|
It's recommended to use m.notice for bots because the message will render in a lighter text (at least in Element client) for users to distinguish bot and real user messages.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-messageFormat">
|
<label for="node-input-messageFormat">
|
||||||
Message Format
|
Message Format
|
||||||
@ -56,49 +60,44 @@
|
|||||||
<option value="msg.format">msg.format input</option>
|
<option value="msg.format">msg.format input</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</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>
|
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="matrix-send-message">
|
<script type="text/html" data-help-name="matrix-send-message">
|
||||||
<h3>Details</h3>
|
<h3>Details</h3>
|
||||||
<p>Sends a message to a Matrix room.</p>
|
<p>Sends a message to a Matrix room. Messages are auto encrypted if necessary.</p>
|
||||||
|
|
||||||
<h3>Inputs</h3>
|
<h3>Inputs</h3>
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
|
<dt>msg.topic
|
||||||
|
<span class="property-type">string</span>
|
||||||
|
</dt>
|
||||||
|
<dd> Room ID to send image to. Optional if configured on the node. If configured on the node this input will be overridden.</dd>
|
||||||
|
|
||||||
<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. </dd>
|
||||||
|
|
||||||
<dt class="optional">msg.formatted_payload
|
<dt class="optional">msg.formatted_payload
|
||||||
<span class="property-type">String</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> the formatted HTML message (uses msg.payload if not defined). This only affects HTML messages.</dd>
|
<dd> the formatted HTML message (uses msg.payload if not defined). This only affects HTML messages.</dd>
|
||||||
|
|
||||||
<dt>msg.topic
|
|
||||||
<span class="property-type">String | Null</span>
|
|
||||||
</dt>
|
|
||||||
<dd> Room ID to send image to. Optional if configured on the node. Overrides node configuration if set.</dd>
|
|
||||||
|
|
||||||
<dt class="optional">msg.type
|
<dt class="optional">msg.type
|
||||||
<span class="property-type">String | Null</span>
|
<span class="property-type">string | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> This is only used and required when configured so on the node. Must be set to either 'm.text' or 'm.notice'</dd>
|
<dd> This is only used and required when configured so on the node. Must be set to either <code>'m.text'</code> or <code>'m.notice'</code></dd>
|
||||||
|
|
||||||
<dt class="optional">msg.format
|
<dt class="optional">msg.format
|
||||||
<span class="property-type">String | Null</span>
|
<span class="property-type">string | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> This is only used and required when configured so on the node. Set to null for plain text and 'html' for HTML.</dd>
|
<dd> This is only used and required when configured so on the node. Set to <code>null</code> for plain text and <code>'html'</code> for HTML.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h3>Outputs</h3>
|
<h3>Outputs</h3>
|
||||||
<ol class="node-ports">
|
<ol class="node-ports">
|
||||||
<li>Success
|
<li>Success
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dd>original msg object preserved.</dd>
|
|
||||||
|
|
||||||
<dt>msg.eventId <span class="property-type">string</span></dt>
|
<dt>msg.eventId <span class="property-type">string</span></dt>
|
||||||
<dd>the eventId from the posted message.</dd>
|
<dd>the eventId from the posted message.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
global.Olm = require('olm');
|
global.Olm = require('olm');
|
||||||
|
const fs = require("fs-extra");
|
||||||
module.exports = function(RED) {
|
|
||||||
const sdk = require("matrix-js-sdk");
|
const sdk = require("matrix-js-sdk");
|
||||||
const { LocalStorage } = require('node-localstorage');
|
const { LocalStorage } = require('node-localstorage');
|
||||||
const localStorage = new LocalStorage('./matrix-local-storage');
|
|
||||||
const { LocalStorageCryptoStore } = require('matrix-js-sdk/lib/crypto/store/localStorage-crypto-store');
|
const { LocalStorageCryptoStore } = require('matrix-js-sdk/lib/crypto/store/localStorage-crypto-store');
|
||||||
|
|
||||||
|
module.exports = function(RED) {
|
||||||
|
function MatrixFolderNameFromUserId(name) {
|
||||||
|
return name.replace(/[^a-z0-9]/gi, '_').toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
function MatrixServerNode(n) {
|
function MatrixServerNode(n) {
|
||||||
|
let storageDir = './matrix-client-storage';
|
||||||
|
|
||||||
// we should add support for getting access token automatically from username/password
|
// we should add support for getting access token automatically from username/password
|
||||||
// ref: https://matrix.org/docs/guides/usage-of-the-matrix-js-sdk#login-with-an-access-token
|
// ref: https://matrix.org/docs/guides/usage-of-the-matrix-js-sdk#login-with-an-access-token
|
||||||
|
|
||||||
@ -37,6 +42,11 @@ module.exports = function(RED) {
|
|||||||
} else if(!this.userId) {
|
} else if(!this.userId) {
|
||||||
node.log("Matrix connection failed: missing user ID.");
|
node.log("Matrix connection failed: missing user ID.");
|
||||||
} else {
|
} else {
|
||||||
|
let localStorageDir = storageDir + '/' + MatrixFolderNameFromUserId(this.userId);
|
||||||
|
|
||||||
|
fs.ensureDirSync(storageDir); // create storage directory if it doesn't exist
|
||||||
|
upgradeDirectoryIfNecessary(node, storageDir);
|
||||||
|
const localStorage = new LocalStorage(localStorageDir);
|
||||||
node.matrixClient = sdk.createClient({
|
node.matrixClient = sdk.createClient({
|
||||||
baseUrl: this.url,
|
baseUrl: this.url,
|
||||||
accessToken: this.credentials.accessToken,
|
accessToken: this.credentials.accessToken,
|
||||||
@ -150,25 +160,19 @@ module.exports = function(RED) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
if(node.e2ee){
|
|
||||||
const initCrypto = ms => new Promise(res => node.matrixClient.initCrypto());
|
|
||||||
try {
|
try {
|
||||||
await initCrypto();
|
if(node.e2ee){
|
||||||
} catch(error){
|
node.log("Initializing crypto...");
|
||||||
node.error(error);
|
await node.matrixClient.initCrypto();
|
||||||
}
|
|
||||||
node.matrixClient.setGlobalErrorOnUnknownDevices(false);
|
node.matrixClient.setGlobalErrorOnUnknownDevices(false);
|
||||||
}
|
}
|
||||||
|
node.log("Connecting to Matrix server...");
|
||||||
const startClient = ms => new Promise(res => node.matrixClient.startClient({ initialSyncLimit: 8 }));
|
await node.matrixClient.startClient({ initialSyncLimit: 8 });
|
||||||
try {
|
|
||||||
await startClient();
|
|
||||||
} catch(error){
|
} catch(error){
|
||||||
node.error(error);
|
node.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node.log("Connecting to Matrix server...");
|
|
||||||
run().catch((error) => node.error(error));
|
run().catch((error) => node.error(error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,4 +185,30 @@ module.exports = function(RED) {
|
|||||||
url: { type: "text", required: true },
|
url: { type: "text", required: true },
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function upgradeDirectoryIfNecessary(node, storageDir) {
|
||||||
|
let oldStorageDir = './matrix-local-storage';
|
||||||
|
|
||||||
|
// if the old storage location exists lets move it to it's new location
|
||||||
|
if(fs.pathExistsSync(oldStorageDir)){
|
||||||
|
RED.nodes.eachNode(function(n){
|
||||||
|
try {
|
||||||
|
if(n.type !== 'matrix-server-config') return;
|
||||||
|
let { userId } = RED.nodes.getCredentials(n.id);
|
||||||
|
let dir = storageDir + '/' + MatrixFolderNameFromUserId(userId);
|
||||||
|
if(!fs.pathExistsSync(dir)) {
|
||||||
|
fs.ensureDirSync(dir);
|
||||||
|
node.log("found old '" + oldStorageDir + "' path, copying to new location '" + dir);
|
||||||
|
fs.copySync(oldStorageDir, dir);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// rename folder to keep as a backup (and so we don't run again)
|
||||||
|
node.log("archiving old config folder '" + oldStorageDir + "' to '" + oldStorageDir + "-backup");
|
||||||
|
fs.renameSync(oldStorageDir, oldStorageDir + "-backup");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -46,7 +46,7 @@
|
|||||||
<dd> ID of user to create/edit (ex: @bob:example.com)</dd>
|
<dd> ID of user to create/edit (ex: @bob:example.com)</dd>
|
||||||
|
|
||||||
<dt>msg.payload
|
<dt>msg.payload
|
||||||
<span class="property-type">Object</span>
|
<span class="property-type">object</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Details of the new user to create. <a href="https://matrix-org.github.io/synapse/develop/admin_api/user_admin_api.html#create-or-modify-account" target="_blank">Click here</a> to see what valid data you can pass via this input. If the user already exists then optional parameters default to the current value.</dd>
|
<dd> Details of the new user to create. <a href="https://matrix-org.github.io/synapse/develop/admin_api/user_admin_api.html#create-or-modify-account" target="_blank">Click here</a> to see what valid data you can pass via this input. If the user already exists then optional parameters default to the current value.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -55,8 +55,6 @@
|
|||||||
<ol class="node-ports">
|
<ol class="node-ports">
|
||||||
<li>Success
|
<li>Success
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dd>original msg object preserved.</dd>
|
|
||||||
|
|
||||||
<dt>msg.payload <span class="property-type">string</span></dt>
|
<dt>msg.payload <span class="property-type">string</span></dt>
|
||||||
<dd>the eventId from the posted message.</dd>
|
<dd>the eventId from the posted message.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-tips" style="margin-bottom: 12px;">
|
<div class="form-tips" style="margin-bottom: 12px;">
|
||||||
User must be an admin to use this endpoint. Only works with Synapse servers. This is permanent so make sure you actually want to do it.
|
User must be an admin to use this endpoint. Only works with Synapse servers. This is permanent so be cautious.
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -79,7 +79,8 @@
|
|||||||
<ol class="node-ports">
|
<ol class="node-ports">
|
||||||
<li>Success
|
<li>Success
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dd>original msg object preserved.</dd>
|
<dt>msg.error <span class="property-type">object</span></dt>
|
||||||
|
<dd>empty object response</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
<li>Error
|
<li>Error
|
||||||
|
@ -55,7 +55,13 @@ module.exports = function(RED) {
|
|||||||
{ $userId: msg.userId },
|
{ $userId: msg.userId },
|
||||||
);
|
);
|
||||||
node.server.matrixClient.http
|
node.server.matrixClient.http
|
||||||
.authedRequest(undefined, 'POST', path, undefined, { "erase": (msg.erase || false) }, { prefix: '' })
|
.authedRequest(
|
||||||
|
undefined,
|
||||||
|
'POST',
|
||||||
|
path,
|
||||||
|
undefined,
|
||||||
|
{"erase": (msg.erase || false)},
|
||||||
|
{"prefix": '' })
|
||||||
.then(function(e){
|
.then(function(e){
|
||||||
msg.payload = e;
|
msg.payload = e;
|
||||||
node.send([msg, null]);
|
node.send([msg, null]);
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
<dt>msg.topic
|
<dt>msg.topic
|
||||||
<span class="property-type">string</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> The room identifier or alias to join: for example, <code>!h8zld9j31:example.com.</code>. Not required if set in the config and will be ignored even if set.</dd>
|
<dd> The room identifier or alias to join: for example, <code>!h8zld9j31:example.com.</code>. Ignored if configured on the node, otherwise required.</dd>
|
||||||
|
|
||||||
<dt>msg.userId
|
<dt>msg.userId
|
||||||
<span class="property-type">string</span>
|
<span class="property-type">string</span>
|
||||||
@ -63,8 +63,8 @@
|
|||||||
<ol class="node-ports">
|
<ol class="node-ports">
|
||||||
<li>Success
|
<li>Success
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.payload <span class="property-type">string</span></dt>
|
<dt>msg.topic <span class="property-type">string</span></dt>
|
||||||
<dd>This returns data directly from the API endpoint. <a href="https://matrix-org.github.io/synapse/develop/admin_api/user_admin_api.html#query-current-sessions-for-a-user" target="_blank">Click here</a> to see what this returns.</dd>
|
<dd> the ID of the room we just added the user to.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
<li>Error
|
<li>Error
|
||||||
|
@ -46,8 +46,8 @@ module.exports = function(RED) {
|
|||||||
node.send([null, msg]);
|
node.send([null, msg]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let roomId = node.roomId || msg.topic;
|
msg.topic = node.roomId || msg.topic;
|
||||||
if(!roomId) {
|
if(!msg.topic) {
|
||||||
node.error("room must be defined in either msg.topic or in node config");
|
node.error("room must be defined in either msg.topic or in node config");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ module.exports = function(RED) {
|
|||||||
{ "user_id": msg.userId },
|
{ "user_id": msg.userId },
|
||||||
{ prefix: '' }
|
{ prefix: '' }
|
||||||
).then(function(e){
|
).then(function(e){
|
||||||
msg.payload = e;
|
msg.topic = e.room_id;
|
||||||
node.send([msg, null]);
|
node.send([msg, null]);
|
||||||
}).catch(function(e){
|
}).catch(function(e){
|
||||||
node.warn("Error joining user to room " + e);
|
node.warn("Error joining user to room " + e);
|
||||||
|
@ -51,32 +51,32 @@
|
|||||||
<h3>Inputs</h3>
|
<h3>Inputs</h3>
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.payload
|
<dt>msg.payload
|
||||||
<span class="property-type">Object</span>
|
<span class="property-type">object</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Details of the new user to create. </dd>
|
<dd> Details of the new user to create. </dd>
|
||||||
|
|
||||||
<dt class="optional">msg.payload.displayname
|
<dt class="optional">msg.payload.displayname
|
||||||
<span class="property-type">String | null</span>
|
<span class="property-type">string | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Set the displayname for the user (default to username if not set). </dd>
|
<dd> Set the displayname for the user (default to username if not set). </dd>
|
||||||
|
|
||||||
<dt>msg.payload.username
|
<dt>msg.payload.username
|
||||||
<span class="property-type">Object</span>
|
<span class="property-type">object</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Username for the new user. </dd>
|
<dd> Username for the new user. </dd>
|
||||||
|
|
||||||
<dt>msg.payload.password
|
<dt>msg.payload.password
|
||||||
<span class="property-type">String</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Password for the new user. </dd>
|
<dd> Password for the new user. </dd>
|
||||||
|
|
||||||
<dt>msg.payload.admin
|
<dt>msg.payload.admin
|
||||||
<span class="property-type">Bool</span>
|
<span class="property-type">bool</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> If true, the new user will be an admin. Default to false. </dd>
|
<dd> If true, the new user will be an admin. Default to false. </dd>
|
||||||
|
|
||||||
<dt class="optional">msg.payload.user_type
|
<dt class="optional">msg.payload.user_type
|
||||||
<span class="property-type">String | null</span>
|
<span class="property-type">string | null</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Set the user type. Leave this to null if you don't know what it is for. Check <a href="https://github.com/matrix-org/synapse/blob/master/synapse/api/constants.py">here</a> and look for <code>class UserTypes</code> to figure out what is valid.</dd>
|
<dd> Set the user type. Leave this to null if you don't know what it is for. Check <a href="https://github.com/matrix-org/synapse/blob/master/synapse/api/constants.py">here</a> and look for <code>class UserTypes</code> to figure out what is valid.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -84,9 +84,7 @@
|
|||||||
<h3>Outputs</h3>
|
<h3>Outputs</h3>
|
||||||
<ol class="node-ports">
|
<ol class="node-ports">
|
||||||
<li>Success
|
<li>Success
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">`
|
||||||
<dd>original msg object preserved.</dd>
|
|
||||||
|
|
||||||
<dt>msg.eventId <span class="property-type">string</span></dt>
|
<dt>msg.eventId <span class="property-type">string</span></dt>
|
||||||
<dd>the eventId from the posted message.</dd>
|
<dd>the eventId from the posted message.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
@ -39,22 +39,22 @@
|
|||||||
<h3>Inputs</h3>
|
<h3>Inputs</h3>
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt class="optional">msg.from
|
<dt class="optional">msg.from
|
||||||
<span class="property-type">Integer</span>
|
<span class="property-type">integer</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Is optional but used for pagination, denoting the offset in the returned results. This should be treated as an opaque value and not explicitly set to anything other than the return value of next_token from a previous call. Defaults to 0.</dd>
|
<dd> Is optional but used for pagination, denoting the offset in the returned results. This should be treated as an opaque value and not explicitly set to anything other than the return value of <code>msg.next_token</code> from a previous call. Defaults to 0.</dd>
|
||||||
|
|
||||||
<dt class="optional">msg.limit
|
<dt class="optional">msg.limit
|
||||||
<span class="property-type">Integer</span>
|
<span class="property-type">integer</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> limit - representing a positive integer - Is optional but is used for pagination, denoting the maximum number of items to return in this call. Defaults to 100.</dd>
|
<dd> limit - representing a positive integer - Is optional but is used for pagination, denoting the maximum number of items to return in this call. Defaults to 100.</dd>
|
||||||
|
|
||||||
<dt class="optional">msg.guests
|
<dt class="optional">msg.guests
|
||||||
<span class="property-type">Bool</span>
|
<span class="property-type">bool</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd> Is optional and if false will exclude guest users. Defaults to true to include guest users.</dd>
|
<dd> Is optional and if false will exclude guest users. Defaults to true to include guest users.</dd>
|
||||||
|
|
||||||
<dt class="optional">msg.order_by
|
<dt class="optional">msg.order_by
|
||||||
<span class="property-type">String</span>
|
<span class="property-type">string</span>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
The method by which to sort the returned list of users.
|
The method by which to sort the returned list of users.
|
||||||
@ -85,14 +85,41 @@
|
|||||||
<dt>msg.payload <span class="property-type">object</span></dt>
|
<dt>msg.payload <span class="property-type">object</span></dt>
|
||||||
<dd>the response object from the server.</dd>
|
<dd>the response object from the server.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.next_token <span class="property-type">string</span></dt>
|
||||||
|
<dd>string representing a positive integer - Indication for pagination. If this is unset then there are no more users to paginate through.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.total <span class="property-type">integer</span></dt>
|
||||||
|
<dd>Total number of users.</dd>
|
||||||
|
|
||||||
<dt>msg.payload.users <span class="property-type">array</span></dt>
|
<dt>msg.payload.users <span class="property-type">array</span></dt>
|
||||||
<dd>list of users from the Matrix server. <a href="https://matrix-org.github.io/synapse/develop/admin_api/user_admin_api.html#list-accounts" target="_blank">Click here</a> for details on what this contains (or do a test and dump the output). We would put the details here in the doc but Synapse is constantly changing so it's best to reference the official Synapse docs.</dd>
|
<dd>list of users from the Matrix server. <a href="https://matrix-org.github.io/synapse/develop/admin_api/user_admin_api.html#list-accounts" target="_blank">Click here</a> for details on what this contains (or do a debug on the output).</dd>
|
||||||
|
|
||||||
<dt>msg.next_token <span class="property-type">string</span></dt>
|
<dt>msg.payload.users[].name <span class="property-type">string</span></dt>
|
||||||
<dd>string representing a positive integer - Indication for pagination. See above (input msg.from)</dd>
|
<dd>Fully-qualified user ID (ex. <code>@user:server.com</code>).</dd>
|
||||||
|
|
||||||
<dt>msg.total <span class="property-type">integer</span></dt>
|
<dt>msg.payload.users[].is_guest <span class="property-type">bool</span></dt>
|
||||||
<dd>Total number of media.</dd>
|
<dd>Status if that user is a guest account.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.users[].admin <span class="property-type">string</span></dt>
|
||||||
|
<dd>Status if that user is a server administrator.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.users[].user_type <span class="property-type">string</span></dt>
|
||||||
|
<dd>Type of the user. Normal users are type <code>None</code>. This allows user type specific behaviour. There are also types <code>support</code> and <code>bot</code>.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.users[].deactivated <span class="property-type">bool</span></dt>
|
||||||
|
<dd>Status if that user has been marked as deactivated.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.users[].shadow_banned <span class="property-type">bool</span></dt>
|
||||||
|
<dd>Status if that user has been marked as shadow banned.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.users[].displayname <span class="property-type">string</span></dt>
|
||||||
|
<dd>The user's display name if they have set one.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.users[].avatar_url <span class="property-type">string</span></dt>
|
||||||
|
<dd>The user's avatar URL if they have set one.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.users[].creation_ts <span class="property-type">integer</span></dt>
|
||||||
|
<dd>The user's creation timestamp in ms.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
<li>Error
|
<li>Error
|
||||||
|
@ -58,7 +58,7 @@ module.exports = function(RED) {
|
|||||||
msg.payload = e;
|
msg.payload = e;
|
||||||
node.send([msg, null]);
|
node.send([msg, null]);
|
||||||
}).catch(function(e){
|
}).catch(function(e){
|
||||||
node.warn("Error fetching user list " + e);
|
node.warn("Error fetching server user list " + e);
|
||||||
msg.error = e;
|
msg.error = e;
|
||||||
node.send([null, msg]);
|
node.send([null, msg]);
|
||||||
});
|
});
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
<script type="text/html" data-help-name="matrix-whois-user">
|
<script type="text/html" data-help-name="matrix-whois-user">
|
||||||
<h3>Details</h3>
|
<h3>Details</h3>
|
||||||
<p>This node returns information about the active sessions for a specific user.</p>
|
<p>This node returns information about the active sessions for a specific user.</p>
|
||||||
|
<a href="https://matrix-org.github.io/synapse/develop/admin_api/user_admin_api.html#query-current-sessions-for-a-user" target="_blank">Matrix API Endpoint Information</a>
|
||||||
|
|
||||||
<h3>Inputs</h3>
|
<h3>Inputs</h3>
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
@ -49,8 +50,29 @@
|
|||||||
<ol class="node-ports">
|
<ol class="node-ports">
|
||||||
<li>Success
|
<li>Success
|
||||||
<dl class="message-properties">
|
<dl class="message-properties">
|
||||||
<dt>msg.payload <span class="property-type">string</span></dt>
|
<dt>msg.payload <span class="property-type">object</span></dt>
|
||||||
<dd>This returns data directly from the API endpoint. <a href="https://matrix-org.github.io/synapse/develop/admin_api/user_admin_api.html#query-current-sessions-for-a-user" target="_blank">Click here</a> to see what this returns.</dd>
|
<dd>This returns data directly from the API endpoint. <a href="https://matrix-org.github.io/synapse/develop/admin_api/user_admin_api.html#query-current-sessions-for-a-user" target="_blank">Click here</a> to see more info.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.user_id <span class="property-type">string</span></dt>
|
||||||
|
<dd>The Matrix user ID of the user.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.devices <span class="property-type">object</span></dt>
|
||||||
|
<dd>Each key in this object is an identifier for one of the user's devices.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.devices.X.sessions <span class="property-type">array</span></dt>
|
||||||
|
<dd>A user's sessions (i.e. what they did with an access token from one login).</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.devices.X.sessions[].connections <span class="property-type">array</span></dt>
|
||||||
|
<dd>Information about particular connections in the session.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.devices.X.sessions[].connections[].ip <span class="property-type">string</span></dt>
|
||||||
|
<dd>Most recently seen IP address of the session.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.devices.X.sessions[].connections[].last_seen <span class="property-type">integer</span></dt>
|
||||||
|
<dd>Unix timestamp that the session was last active.</dd>
|
||||||
|
|
||||||
|
<dt>msg.payload.devices.X.sessions[].connections[].user_agent <span class="property-type">string</span></dt>
|
||||||
|
<dd>User agent string last seen in the session.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
<li>Error
|
<li>Error
|
||||||
|
@ -66,7 +66,7 @@ module.exports = function(RED) {
|
|||||||
msg.payload = e;
|
msg.payload = e;
|
||||||
node.send([msg, null]);
|
node.send([msg, null]);
|
||||||
}).catch(function(e){
|
}).catch(function(e){
|
||||||
node.warn("Error creating/editing user " + e);
|
node.warn("Error fetching user whois information " + e);
|
||||||
msg.error = e;
|
msg.error = e;
|
||||||
node.send([null, msg]);
|
node.send([null, msg]);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user