- matrix-receive node updated so that msg.sender is msg.userId instead (for better node chaining).

- change all references from msg.roomId to msg.topic to conform to Node-RED standards.
- Added node for listing Synapse users server-wide (as long as the caller is an admin)
- Events for Room.timeline are now handled by the server-config node and node's that listen for it bind a listener to that instead of the matrix client.
- Added kick and ban nodes for kicking/banning from a room
- Added node for fetching synapse user list using synapse admin API
- Added node for fetching whois data from a user using Matrix admin API
- Added node for deactivating users using the Synapse admin API
- Can register users using the Synapse admin endpoint v1 (yay legacy)
- Can add users using the Synapse admin endpoint v2
- Add more info to the readme.
This commit is contained in:
2021-08-18 11:18:29 -06:00
parent cd99955115
commit b33595d5eb
31 changed files with 1874 additions and 109 deletions
+14 -7
View File
@@ -14,6 +14,8 @@ module.exports = function(RED) {
this.credentials = {};
}
node.setMaxListeners(1000);
this.connected = false;
this.name = n.name;
this.userId = this.credentials.userId;
@@ -27,8 +29,6 @@ module.exports = function(RED) {
} else if(!this.userId) {
node.log("Matrix connection failed: missing user ID.");
} else {
node.log("Initializing Matrix Server Config node");
node.matrixClient = sdk.createClient({
baseUrl: this.url,
accessToken: this.credentials.accessToken,
@@ -49,6 +49,7 @@ module.exports = function(RED) {
if (node.connected !== connected) {
node.connected = connected;
if (connected) {
node.log("Matrix server connection ready.");
node.emit("connected");
} else {
node.emit("disconnected");
@@ -60,6 +61,10 @@ module.exports = function(RED) {
return node.connected;
};
node.matrixClient.on("Room.timeline", function(event, room, toStartOfTimeline, data) {
node.emit("Room.timeline", event, room, toStartOfTimeline, data);
});
// handle auto-joining rooms
node.matrixClient.on("RoomMember.membership", function(event, member) {
if (member.membership === "invite" && member.userId === node.userId) {
@@ -82,6 +87,8 @@ module.exports = function(RED) {
node.setConnected(false);
break;
case "PREPARED":
case "RECONNECTING":
case "STOPPED":
node.setConnected(false);
break;
@@ -90,11 +97,11 @@ module.exports = function(RED) {
node.setConnected(true);
break;
case "PREPARED":
// the client instance is ready to be queried.
node.log("Matrix server connection ready.");
node.setConnected(true);
break;
// case "PREPARED":
// // the client instance is ready to be queried.
// node.log("Matrix server connection ready.");
// node.setConnected(true);
// break;
}
});