From 5dbd9636f39a320bc2e4c52dea9799fe5cb4a764 Mon Sep 17 00:00:00 2001 From: Alan Sikora Date: Thu, 18 Nov 2021 16:38:47 -0300 Subject: [PATCH] code organization --- .../IMatrixEventContentAddMemberToRoom.ts | 10 + .../IMatrixEventContentCreateRoom.ts | 4 + .../IMatrixEventContentSendMessage.ts | 8 + .../IMatrixEventContentSetRoomJoinRules.ts | 7 + .../IMatrixEventContentSetRoomName.ts | 3 + .../IMatrixEventContentSetRoomTopic.ts | 3 + .../server/IMatrixEventContent/index.ts | 16 + .../server/bridge/addMemberToRoom.ts | 85 ++ app/federation-bridge/server/bridge/bridge.ts | 94 ++ .../server/bridge/createRoom.ts | 25 + app/federation-bridge/server/bridge/index.ts | 1 + .../server/bridge/sendMessage.ts | 29 + .../server/bridge/setRoomJoinRules.ts | 37 + .../server/bridge/setRoomName.ts | 27 + .../server/bridge/setRoomTopic.ts | 19 + .../server/callbacks/afterAddedToRoom.ts | 14 + .../server/callbacks/afterCreateRoom.ts | 38 + .../server/callbacks/afterSaveMessage.ts | 21 + .../server/callbacks/index.ts | 28 + .../server/definitions/IMatrixEvent.ts | 16 + .../server/definitions/MatrixEventType.ts | 12 + app/federation-bridge/server/index.ts | 64 + app/federation-bridge/server/methods/index.ts | 36 + app/federation-bridge/server/servers.ts | 29 + app/models/server/index.js | 3 + app/models/server/models/MatrixBridgedRoom.ts | 28 + app/models/server/models/MatrixBridgedUser.ts | 28 + app/slashcommands-invite/server/server.js | 12 +- package-lock.json | 1083 ++++++++++++++++- package.json | 2 + private/matrix/rocketchat-registration-a.yaml | 12 + private/matrix/rocketchat-registration-b.yaml | 12 + server/importPackages.ts | 1 + 33 files changed, 1776 insertions(+), 31 deletions(-) create mode 100644 app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentAddMemberToRoom.ts create mode 100644 app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentCreateRoom.ts create mode 100644 app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSendMessage.ts create mode 100644 app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSetRoomJoinRules.ts create mode 100644 app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSetRoomName.ts create mode 100644 app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSetRoomTopic.ts create mode 100644 app/federation-bridge/server/IMatrixEventContent/index.ts create mode 100644 app/federation-bridge/server/bridge/addMemberToRoom.ts create mode 100644 app/federation-bridge/server/bridge/bridge.ts create mode 100644 app/federation-bridge/server/bridge/createRoom.ts create mode 100644 app/federation-bridge/server/bridge/index.ts create mode 100644 app/federation-bridge/server/bridge/sendMessage.ts create mode 100644 app/federation-bridge/server/bridge/setRoomJoinRules.ts create mode 100644 app/federation-bridge/server/bridge/setRoomName.ts create mode 100644 app/federation-bridge/server/bridge/setRoomTopic.ts create mode 100644 app/federation-bridge/server/callbacks/afterAddedToRoom.ts create mode 100644 app/federation-bridge/server/callbacks/afterCreateRoom.ts create mode 100644 app/federation-bridge/server/callbacks/afterSaveMessage.ts create mode 100644 app/federation-bridge/server/callbacks/index.ts create mode 100644 app/federation-bridge/server/definitions/IMatrixEvent.ts create mode 100644 app/federation-bridge/server/definitions/MatrixEventType.ts create mode 100644 app/federation-bridge/server/index.ts create mode 100644 app/federation-bridge/server/methods/index.ts create mode 100644 app/federation-bridge/server/servers.ts create mode 100644 app/models/server/models/MatrixBridgedRoom.ts create mode 100644 app/models/server/models/MatrixBridgedUser.ts create mode 100644 private/matrix/rocketchat-registration-a.yaml create mode 100644 private/matrix/rocketchat-registration-b.yaml diff --git a/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentAddMemberToRoom.ts b/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentAddMemberToRoom.ts new file mode 100644 index 000000000000..2accfbffbc8b --- /dev/null +++ b/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentAddMemberToRoom.ts @@ -0,0 +1,10 @@ +export enum AddMemberToRoomMembership { + JOIN = 'join', + INVITE = 'invite', + LEAVE = 'leave', +} + +export interface IMatrixEventContentAddMemberToRoom { + displayname: string; + membership: AddMemberToRoomMembership; +} diff --git a/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentCreateRoom.ts b/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentCreateRoom.ts new file mode 100644 index 000000000000..b374135c9309 --- /dev/null +++ b/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentCreateRoom.ts @@ -0,0 +1,4 @@ +export interface IMatrixEventContentCreateRoom { + creator: string; + room_version: string; +} diff --git a/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSendMessage.ts b/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSendMessage.ts new file mode 100644 index 000000000000..10287cae295b --- /dev/null +++ b/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSendMessage.ts @@ -0,0 +1,8 @@ +export enum MatrixSendMessageType { + 'm.text' +} + +export interface IMatrixEventContentSendMessage { + body: string; + msgtype: MatrixSendMessageType; +} diff --git a/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSetRoomJoinRules.ts b/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSetRoomJoinRules.ts new file mode 100644 index 000000000000..921ef3b1df49 --- /dev/null +++ b/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSetRoomJoinRules.ts @@ -0,0 +1,7 @@ +export enum SetRoomJoinRules { + JOIN = 'public', + INVITE = 'invite' +} +export interface IMatrixEventContentSetRoomJoinRules { + join_rule: SetRoomJoinRules; +} diff --git a/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSetRoomName.ts b/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSetRoomName.ts new file mode 100644 index 000000000000..5ac3f72e15c6 --- /dev/null +++ b/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSetRoomName.ts @@ -0,0 +1,3 @@ +export interface IMatrixEventContentSetRoomName { + name: string; +} diff --git a/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSetRoomTopic.ts b/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSetRoomTopic.ts new file mode 100644 index 000000000000..54e91e0881c0 --- /dev/null +++ b/app/federation-bridge/server/IMatrixEventContent/IMatrixEventContentSetRoomTopic.ts @@ -0,0 +1,3 @@ +export interface IMatrixEventContentSetRoomTopic { + topic: string; +} diff --git a/app/federation-bridge/server/IMatrixEventContent/index.ts b/app/federation-bridge/server/IMatrixEventContent/index.ts new file mode 100644 index 000000000000..b308d76fd0ae --- /dev/null +++ b/app/federation-bridge/server/IMatrixEventContent/index.ts @@ -0,0 +1,16 @@ +import { MatrixEventType } from '../definitions/MatrixEventType'; +import { IMatrixEventContentCreateRoom } from './IMatrixEventContentCreateRoom'; +import { IMatrixEventContentAddMemberToRoom } from './IMatrixEventContentAddMemberToRoom'; +import { IMatrixEventContentSendMessage } from './IMatrixEventContentSendMessage'; +import { IMatrixEventContentSetRoomJoinRules } from './IMatrixEventContentSetRoomJoinRules'; +import { IMatrixEventContentSetRoomName } from './IMatrixEventContentSetRoomName'; +import { IMatrixEventContentSetRoomTopic } from './IMatrixEventContentSetRoomTopic'; + +export type EventContent = { + [MatrixEventType.CREATE_ROOM]: IMatrixEventContentCreateRoom; + [MatrixEventType.ADD_MEMBER_TO_ROOM]: IMatrixEventContentAddMemberToRoom; + [MatrixEventType.SET_ROOM_JOIN_RULES]: IMatrixEventContentSetRoomJoinRules; + [MatrixEventType.SET_ROOM_NAME]: IMatrixEventContentSetRoomName; + [MatrixEventType.SET_ROOM_TOPIC]: IMatrixEventContentSetRoomTopic; + [MatrixEventType.SEND_MESSAGE]: IMatrixEventContentSendMessage; +}; diff --git a/app/federation-bridge/server/bridge/addMemberToRoom.ts b/app/federation-bridge/server/bridge/addMemberToRoom.ts new file mode 100644 index 000000000000..72a7f97bba6d --- /dev/null +++ b/app/federation-bridge/server/bridge/addMemberToRoom.ts @@ -0,0 +1,85 @@ +// @ts-ignore +import { MatrixBridgedUser, MatrixBridgedRoom, Users } from '../../../models'; +// @ts-ignore +import { addUserToRoom, createRoom, removeUserFromRoom } from '../../../lib'; +import { IMatrixEvent } from '../definitions/IMatrixEvent'; +import { MatrixEventType } from '../definitions/MatrixEventType'; +import { AddMemberToRoomMembership } from '../IMatrixEventContent/IMatrixEventContentAddMemberToRoom'; +import { SetRoomJoinRules } from '../IMatrixEventContent/IMatrixEventContentSetRoomJoinRules'; +import { currentServer, SERVER, servers } from '../servers'; +import { createUser } from '../methods'; +import { matrixEventQueue } from './bridge'; + +export const handleAddMemberToRoom = async ( + event: IMatrixEvent, +): Promise => { + const { + room_id: matrixRoomId, + sender: senderMatrixUserId, + state_key: affectedMatrixUserId, + content: { displayname: displayName, membership }, + invite_room_state: inviteRoomState, + } = event; + + console.log(JSON.stringify(event, null, 2)); + + // // We ignore the bot + // if (affectedMatrixUserId.startsWith(`@rc_bot:`)) { + // return; + // } + + // Find the bridged room id + const roomId = await MatrixBridgedRoom.getId(matrixRoomId); + + // Find the bridged user id + const senderUserId = await MatrixBridgedUser.getId(senderMatrixUserId); + const affectedUserId = await MatrixBridgedUser.getId(affectedMatrixUserId); + + // Find the user + const senderUser = await Users.findOneById(senderUserId); + const affectedUser = await Users.findOneById(affectedUserId); + + switch (membership) { + case AddMemberToRoomMembership.JOIN: + addUserToRoom(roomId, affectedUser); + break; + case AddMemberToRoomMembership.INVITE: + // // If the sender user does not exist, it means we need to create it + // let creatorUser = senderUser; + // if (!creatorUser) { + // creatorUser = createUser(senderMatrixUserId, senderMatrixUserId); + // } + // + // // If the invited user does not exist, it means we need to create it + // let invitedUser = affectedUser; + // if (!invitedUser) { + // invitedUser = createUser(affectedMatrixUserId, displayName); + // } + + // // Create the room if necessary + // const destinationRoomId = roomId; + + if (!roomId && inviteRoomState) { + // // Ensure we run all the room events first + // for (const event of inviteRoomState) { + // // TODO: Handle error + // matrixEventQueue.push(event).catch((err) => console.error(err)); + // } + // + // // Re-add the current event to the queue + // // TODO: Handle error + // matrixEventQueue.push(event).catch((err) => console.error(err)); + + // Stop + return; + } + + addUserToRoom(roomId, affectedUser, senderUser); + break; + case AddMemberToRoomMembership.LEAVE: + removeUserFromRoom(roomId, affectedUser, { + byUser: senderUser, + }); + break; + } +}; diff --git a/app/federation-bridge/server/bridge/bridge.ts b/app/federation-bridge/server/bridge/bridge.ts new file mode 100644 index 000000000000..f543004a48d5 --- /dev/null +++ b/app/federation-bridge/server/bridge/bridge.ts @@ -0,0 +1,94 @@ +import yaml from 'js-yaml'; +import * as fastq from 'fastq'; +import type { queueAsPromised } from 'fastq'; +import { AppServiceRegistration, Bridge } from 'matrix-appservice-bridge'; + +import { currentServer } from '../servers'; +import { IMatrixEvent } from '../definitions/IMatrixEvent'; +import { MatrixEventType } from '../definitions/MatrixEventType'; +import { handleSendMessage } from './sendMessage'; +import { handleCreateRoom } from './createRoom'; +import { handleAddMemberToRoom } from './addMemberToRoom'; +import { setRoomJoinRules } from './setRoomJoinRules'; +import { setRoomName } from './setRoomName'; +import { setRoomTopic } from './setRoomTopic'; + +const registration: AppServiceRegistration = yaml.load( + currentServer.registrationFile, +); + +// Define the event handler +const eventHandler = async (event: IMatrixEvent): Promise => { + switch (event.type) { + case MatrixEventType.CREATE_ROOM: { + await handleCreateRoom(event as IMatrixEvent); + + break; + } + case MatrixEventType.ADD_MEMBER_TO_ROOM: { + await handleAddMemberToRoom(event as IMatrixEvent); + + break; + } + case MatrixEventType.SET_ROOM_JOIN_RULES: { + await setRoomJoinRules(event as IMatrixEvent); + + break; + } + case MatrixEventType.SET_ROOM_NAME: { + await setRoomName(event as IMatrixEvent); + + break; + } + case MatrixEventType.SET_ROOM_TOPIC: { + await setRoomTopic(event as IMatrixEvent); + + break; + } + case MatrixEventType.SEND_MESSAGE: { + await handleSendMessage(event as IMatrixEvent); + + break; + } + case MatrixEventType.SET_ROOM_POWER_LEVELS: + case MatrixEventType.SET_ROOM_CANONICAL_ALIAS: + case MatrixEventType.SET_ROOM_HISTORY_VISIBILITY: + case MatrixEventType.SET_ROOM_GUEST_ACCESS: { + console.log(`Ignoring ${ event.type }`); + + break; + } + default: + console.log(`Could not find handler for ${ event.type }`, event); + } +}; + +// Create the queue +export const matrixEventQueue: queueAsPromised> = fastq.promise(eventHandler, 1); + +export const bridge = new Bridge({ + homeserverUrl: currentServer.homeserverUrl, + domain: 'localhost', + registration, + suppressEcho: true, + disableStores: true, + + controller: { + onUserQuery(queriedUser): Record { + console.log('=================================================================='); + console.log('onUserQuery', queriedUser); + console.log('=================================================================='); + return {}; // auto-provision users with no additional data + }, + + async onEvent(request/* , context*/): Promise { + // Get the event + const event = request.getData() as unknown as IMatrixEvent; + + console.log(`Queueing ${ event.type }...`, event); + + // TODO: Handle error + matrixEventQueue.push(event).catch((err) => console.error(err)); + }, + }, +}); diff --git a/app/federation-bridge/server/bridge/createRoom.ts b/app/federation-bridge/server/bridge/createRoom.ts new file mode 100644 index 000000000000..0a9db517fad6 --- /dev/null +++ b/app/federation-bridge/server/bridge/createRoom.ts @@ -0,0 +1,25 @@ +// @ts-ignore +import { MatrixBridgedRoom, MatrixBridgedUser, Users } from '../../../models'; +// @ts-ignore +import { createRoom } from '../../../lib'; +import { IMatrixEvent } from '../definitions/IMatrixEvent'; +import { MatrixEventType } from '../definitions/MatrixEventType'; + +export const handleCreateRoom = async ( + event: IMatrixEvent, +): Promise => { + const { room_id: matrixRoomId, sender } = event; + + // Find the bridged user id + const userId = await MatrixBridgedUser.getId(sender); + + // Find the user + const user = await Users.findOneById(userId); + + // Create temp room name + const roomName = `Federation-${ matrixRoomId.split(':')[0].replace('!', '') }`; + + const { rid: roomId } = createRoom('c', roomName, user.username); + + MatrixBridgedRoom.insert({ rid: roomId, mri: matrixRoomId }); +}; diff --git a/app/federation-bridge/server/bridge/index.ts b/app/federation-bridge/server/bridge/index.ts new file mode 100644 index 000000000000..29256393228a --- /dev/null +++ b/app/federation-bridge/server/bridge/index.ts @@ -0,0 +1 @@ +export * from './bridge'; diff --git a/app/federation-bridge/server/bridge/sendMessage.ts b/app/federation-bridge/server/bridge/sendMessage.ts new file mode 100644 index 000000000000..c5b50b995cd3 --- /dev/null +++ b/app/federation-bridge/server/bridge/sendMessage.ts @@ -0,0 +1,29 @@ +// @ts-ignore +import { MatrixBridgedRoom, MatrixBridgedUser, Messages, Users } from '../../../models'; +import { IMatrixEvent } from '../definitions/IMatrixEvent'; +import { MatrixEventType } from '../definitions/MatrixEventType'; + +export const handleSendMessage = async ( + event: IMatrixEvent, +): Promise => { + const { room_id: matrixRoomId, sender } = event; + + // Find the bridged user id + const userId = await MatrixBridgedUser.getId(sender); + + // Find the user + const user = await Users.findOneById(userId); + + // Find the bridged room id + const roomId = await MatrixBridgedRoom.getId(matrixRoomId); + + Messages.createWithTypeRoomIdMessageAndUser( + 'm', + roomId, + event.content.body, + { + _id: user._id, + username: user.username, + }, + ); +}; diff --git a/app/federation-bridge/server/bridge/setRoomJoinRules.ts b/app/federation-bridge/server/bridge/setRoomJoinRules.ts new file mode 100644 index 000000000000..2335c9a22193 --- /dev/null +++ b/app/federation-bridge/server/bridge/setRoomJoinRules.ts @@ -0,0 +1,37 @@ +// @ts-ignore +import { MatrixBridgedRoom, Rooms, Subscriptions } from '../../../models'; +import { IMatrixEvent } from '../definitions/IMatrixEvent'; +import { MatrixEventType } from '../definitions/MatrixEventType'; +import { SetRoomJoinRules } from '../IMatrixEventContent/IMatrixEventContentSetRoomJoinRules'; + +export const setRoomJoinRules = async ( + event: IMatrixEvent, +): Promise => { + const { room_id: matrixRoomId, content: { join_rule: joinRule } } = event; + + // Find the bridged room id + const roomId = await MatrixBridgedRoom.getId(matrixRoomId); + + let type; + + switch (joinRule) { + case SetRoomJoinRules.INVITE: + type = 'p'; + break; + case SetRoomJoinRules.JOIN: + default: + type = 'c'; + } + + Rooms.update({ _id: roomId }, { + $set: { + t: type, + }, + }); + + Subscriptions.update({ rid: roomId }, { + $set: { + t: type, + }, + }); +}; diff --git a/app/federation-bridge/server/bridge/setRoomName.ts b/app/federation-bridge/server/bridge/setRoomName.ts new file mode 100644 index 000000000000..96152eb934d3 --- /dev/null +++ b/app/federation-bridge/server/bridge/setRoomName.ts @@ -0,0 +1,27 @@ +// @ts-ignore +import { MatrixBridgedRoom, Rooms, Subscriptions } from '../../../models'; +import { IMatrixEvent } from '../definitions/IMatrixEvent'; +import { MatrixEventType } from '../definitions/MatrixEventType'; + +export const setRoomName = async ( + event: IMatrixEvent, +): Promise => { + const { room_id: matrixRoomId, content: { name } } = event; + + // Find the bridged room id + const roomId = await MatrixBridgedRoom.getId(matrixRoomId); + + Rooms.update({ _id: roomId }, { + $set: { + name, + fname: name, + }, + }); + + Subscriptions.update({ rid: roomId }, { + $set: { + name, + fname: name, + }, + }); +}; diff --git a/app/federation-bridge/server/bridge/setRoomTopic.ts b/app/federation-bridge/server/bridge/setRoomTopic.ts new file mode 100644 index 000000000000..1b33e6623c4e --- /dev/null +++ b/app/federation-bridge/server/bridge/setRoomTopic.ts @@ -0,0 +1,19 @@ +// @ts-ignore +import { MatrixBridgedRoom, Rooms } from '../../../models'; +import { IMatrixEvent } from '../definitions/IMatrixEvent'; +import { MatrixEventType } from '../definitions/MatrixEventType'; + +export const setRoomTopic = async ( + event: IMatrixEvent, +): Promise => { + const { room_id: matrixRoomId, content: { topic } } = event; + + // Find the bridged room id + const roomId = await MatrixBridgedRoom.getId(matrixRoomId); + + Rooms.update({ _id: roomId }, { + $set: { + description: topic, + }, + }); +}; diff --git a/app/federation-bridge/server/callbacks/afterAddedToRoom.ts b/app/federation-bridge/server/callbacks/afterAddedToRoom.ts new file mode 100644 index 000000000000..58b2715c8d11 --- /dev/null +++ b/app/federation-bridge/server/callbacks/afterAddedToRoom.ts @@ -0,0 +1,14 @@ +// @ts-ignore +import { MatrixBridgedRoom } from '../../../models'; +import { IRoom } from '../../../../definition/IRoom'; +import { bridge } from '../bridge'; + +export async function afterAddedToRoom(_: any, room: IRoom): Promise { + // const intent = bridge.getIntent(); + // + // // Retrieve the matrix room + // const roomMatrixId = MatrixBridgedRoom.getMatrixId(room._id); + // + // // Add the user + // await intent.invite(roomMatrixId, '@rocketchat_userb:b.rc.allskar.com'); +} diff --git a/app/federation-bridge/server/callbacks/afterCreateRoom.ts b/app/federation-bridge/server/callbacks/afterCreateRoom.ts new file mode 100644 index 000000000000..616804fcbf51 --- /dev/null +++ b/app/federation-bridge/server/callbacks/afterCreateRoom.ts @@ -0,0 +1,38 @@ +// @ts-ignore +import { MatrixBridgedRoom, MatrixBridgedUser } from '../../../models'; +import { IUser } from '../../../../definition/IUser'; +import { IRoom } from '../../../../definition/IRoom'; +import { bridge } from '../bridge'; + +export async function afterCreateRoom(user: IUser, room: IRoom): Promise { + // Check if this room already exists (created by another method) + // and if so, ignore the callback + const roomMatrixId = MatrixBridgedRoom.getMatrixId(room._id); + if (roomMatrixId) { + return; + } + + const intent = bridge.getIntent(); + + const roomName = `@rc_${ room.name }`; + + // Create the matrix room + const matrixRoom = await intent.createRoom({ + createAsClient: true, + options: { + name: roomName, + topic: room.topic, + visibility: room.t === 'p' ? 'invite' : 'public', + preset: room.t === 'p' ? 'private_chat' : 'public_chat', + }, + }); + + // Retrieve the matrix user + const userMatrixId = MatrixBridgedUser.getMatrixId(user._id); + + // Add to the map + MatrixBridgedRoom.insert({ rid: room._id, mri: matrixRoom.room_id }); + + // Add our user + await intent.invite(matrixRoom.room_id, userMatrixId); +} diff --git a/app/federation-bridge/server/callbacks/afterSaveMessage.ts b/app/federation-bridge/server/callbacks/afterSaveMessage.ts new file mode 100644 index 000000000000..ab8d01bfdf62 --- /dev/null +++ b/app/federation-bridge/server/callbacks/afterSaveMessage.ts @@ -0,0 +1,21 @@ +// @ts-ignore +import { MatrixBridgedRoom, MatrixBridgedUser } from '../../../models'; +import { bridge } from '../bridge'; +import { IMessage } from '../../../../definition/IMessage'; +import { IRoom } from '../../../../definition/IRoom'; + +export async function afterSaveMessage(message: IMessage, room: IRoom): Promise { + // Retrieve the matrix user + const userMatrixId = MatrixBridgedUser.getMatrixId(message.u._id); + + // Retrieve the matrix room + const roomMatrixId = MatrixBridgedRoom.getMatrixId(room._id); + + console.log(message, userMatrixId); + console.log(roomMatrixId); + + const intent = bridge.getIntent(userMatrixId); + await intent.sendText(roomMatrixId, message.msg || '...not-supported...'); + + return message; +} diff --git a/app/federation-bridge/server/callbacks/index.ts b/app/federation-bridge/server/callbacks/index.ts new file mode 100644 index 000000000000..91af0a6c99ed --- /dev/null +++ b/app/federation-bridge/server/callbacks/index.ts @@ -0,0 +1,28 @@ +import { callbacks } from '../../../callbacks/server'; +import { IUser } from '../../../../definition/IUser'; +import { IRoom } from '../../../../definition/IRoom'; +import { IMessage } from '../../../../definition/IMessage'; +import { afterSaveMessage } from './afterSaveMessage'; +import { afterCreateRoom } from './afterCreateRoom'; +import { afterAddedToRoom } from './afterAddedToRoom'; + +callbacks.add( + 'afterSaveMessage', + (message: IMessage, room: IRoom) => Promise.await(afterSaveMessage(message, room)), + callbacks.priority.LOW, + 'federation-after-save-message', +); + +callbacks.add( + 'afterCreateRoom', + (user: IUser, room: IRoom) => Promise.await(afterCreateRoom(user, room)), + callbacks.priority.LOW, + 'federation-after-create-room', +); + +callbacks.add( + 'afterAddedToRoom', + (involvedUsers: any, room: IRoom) => Promise.await(afterAddedToRoom(involvedUsers, room)), + callbacks.priority.LOW, + 'federation-after-added-to-room', +); diff --git a/app/federation-bridge/server/definitions/IMatrixEvent.ts b/app/federation-bridge/server/definitions/IMatrixEvent.ts new file mode 100644 index 000000000000..3eb842eea252 --- /dev/null +++ b/app/federation-bridge/server/definitions/IMatrixEvent.ts @@ -0,0 +1,16 @@ +import { MatrixEventType } from './MatrixEventType'; +import { EventContent } from '../IMatrixEventContent'; + +export interface IMatrixEvent { + age: number; + content: EventContent[T]; + invite_room_state?: IMatrixEvent[]; + event_id: string; + origin_server_ts: number; + room_id: string; + sender: string; + state_key: string; + type: T; + unsigned: { age: number }; + user_id: string; +} diff --git a/app/federation-bridge/server/definitions/MatrixEventType.ts b/app/federation-bridge/server/definitions/MatrixEventType.ts new file mode 100644 index 000000000000..b77d382eb295 --- /dev/null +++ b/app/federation-bridge/server/definitions/MatrixEventType.ts @@ -0,0 +1,12 @@ +export enum MatrixEventType { + CREATE_ROOM = 'm.room.create', + ADD_MEMBER_TO_ROOM = 'm.room.member', + SET_ROOM_POWER_LEVELS = 'm.room.power_levels', + SET_ROOM_CANONICAL_ALIAS = 'm.room.canonical_alias', + SET_ROOM_JOIN_RULES = 'm.room.join_rules', + SET_ROOM_HISTORY_VISIBILITY = 'm.room.history_visibility', + SET_ROOM_GUEST_ACCESS = 'm.room.guest_access', + SET_ROOM_NAME = 'm.room.name', + SET_ROOM_TOPIC = 'm.room.topic', + SEND_MESSAGE = 'm.room.message', +} diff --git a/app/federation-bridge/server/index.ts b/app/federation-bridge/server/index.ts new file mode 100644 index 000000000000..b205245a3bd5 --- /dev/null +++ b/app/federation-bridge/server/index.ts @@ -0,0 +1,64 @@ +import { MatrixProfileInfo } from 'matrix-bot-sdk'; + +// @ts-ignore +import { MatrixBridgedUser, Users } from '../../models'; +import { IUser } from '../../../definition/IUser'; +import { IMatrixBridgedUser } from '../../models/server/models/MatrixBridgedUser'; +import { bridge } from './bridge'; +import { currentServer } from './servers'; + +// Register callbacks +import './callbacks'; + +async function upsertBridgedUser(u: IUser): Promise { + const matrixUserId = `@rc_${ u.username?.toLowerCase() }:${ + currentServer.domain + }`; + + console.log(`Syncing ${ matrixUserId }...`); + + const intent = bridge.getIntent(matrixUserId); + + let currentProfile: MatrixProfileInfo = {}; + + try { + currentProfile = await intent.getProfileInfo(matrixUserId); + } catch (err) { + // no-op + } + + const desiredDisplayName = `${ u.username } (${ u.name })`; + + if (desiredDisplayName !== currentProfile.displayname) { + await intent.setDisplayName(desiredDisplayName); + } + + MatrixBridgedUser.upsert({ uid: u._id }, { uid: u._id, mui: matrixUserId }); +} + +(async (): Promise => { + await bridge.run(currentServer.port); + + await bridge.initalise(); + + // Check the users on the database and make sure they are in sync with the homeserver + + // Get the bridged users + const bridgedUserIds = MatrixBridgedUser.find({}, { uid: true }).map( + (v: IMatrixBridgedUser) => v.uid, + ); + + // Get users which are not within the bridged user ids, and create them + const potentialUnsyncedUsers: IUser[] = Users.find( + {}, + { _id: true, name: true, username: true }, + ).fetch(); + + // Filter users + const unsyncedUsers = potentialUnsyncedUsers.filter( + (u: IUser) => !bridgedUserIds.includes(u._id), + ); + + // Create the mappings + Promise.all(unsyncedUsers.map(upsertBridgedUser)); +})(); diff --git a/app/federation-bridge/server/methods/index.ts b/app/federation-bridge/server/methods/index.ts new file mode 100644 index 000000000000..c68b2515ecf5 --- /dev/null +++ b/app/federation-bridge/server/methods/index.ts @@ -0,0 +1,36 @@ +import { IUser } from '../../../../definition/IUser'; +// @ts-ignore +import { MatrixBridgedRoom, MatrixBridgedUser, Users } from '../../../models'; +import { bridge } from '../bridge'; + +export const createUser = async (matrixUserId: string, displayName: string): Promise => { + const userId = Users.create({ + username: matrixUserId, + type: 'user', + status: 'online', + active: true, + roles: ['user'], + name: displayName, + requirePasswordChange: false, + }); + + // Add the user to the bridge + MatrixBridgedUser.insert({ uid: userId, mui: matrixUserId }); + + return Users.findOneById(userId); +}; + +export const inviteFederatedUser = async (roomId: string, matrixUserId: string): Promise => { + // Check if the user already exists locally + const existingUserId = await MatrixBridgedUser.getId(matrixUserId); + + if (!existingUserId) { + await createUser(matrixUserId, matrixUserId); + } + + // Find the bridged room id + const matrixRoomId = await MatrixBridgedRoom.getMatrixId(roomId); + + // Add our user + await bridge.getIntent().invite(matrixRoomId, matrixUserId); +}; diff --git a/app/federation-bridge/server/servers.ts b/app/federation-bridge/server/servers.ts new file mode 100644 index 000000000000..6363442f079a --- /dev/null +++ b/app/federation-bridge/server/servers.ts @@ -0,0 +1,29 @@ +export enum SERVER { + A = 'A', + B = 'B', +} + +export const servers = { + [SERVER.A]: { + prefix: 'rc_a', + homeserverUrl: 'https://a.rc.allskar.com', + domain: 'a.rc.allskar.com', + registrationFile: Assets.absoluteFilePath( + 'matrix/rocketchat-registration-a.yaml', + ), + port: 9000, + }, + [SERVER.B]: { + prefix: 'rc_b', + homeserverUrl: 'https://b.rc.allskar.com', + domain: 'b.rc.allskar.com', + registrationFile: Assets.absoluteFilePath( + 'matrix/rocketchat-registration-b.yaml', + ), + port: 9001, + }, +}; + +const SELECTED_SERVER: SERVER = (process.env.APP_SERVER as unknown as SERVER) || SERVER.A; + +export const currentServer = servers[SELECTED_SERVER]; diff --git a/app/models/server/index.js b/app/models/server/index.js index 5507cf53f0aa..a1c092bf75a5 100644 --- a/app/models/server/index.js +++ b/app/models/server/index.js @@ -24,6 +24,9 @@ export { AppsPersistenceModel } from './models/apps-persistence-model'; export { AppsModel } from './models/apps-model'; export { FederationRoomEvents } from './models/FederationRoomEvents'; +export { MatrixBridgedRoom } from './models/MatrixBridgedRoom'; +export { MatrixBridgedUser } from './models/MatrixBridgedUser'; + export { Base, BaseDb, diff --git a/app/models/server/models/MatrixBridgedRoom.ts b/app/models/server/models/MatrixBridgedRoom.ts new file mode 100644 index 000000000000..bfdfc3d1301f --- /dev/null +++ b/app/models/server/models/MatrixBridgedRoom.ts @@ -0,0 +1,28 @@ +import { Base } from './_Base'; + +interface IMatrixBridgedRoom { + rid: string; + mri: string; +} + +class MatrixBridgedRoomModel extends Base { + constructor() { + super('matrix_bridged_rooms'); + this.tryEnsureIndex({ rid: 1 }, { unique: true, sparse: true }); + this.tryEnsureIndex({ mri: 1 }, { unique: true, sparse: true }); + } + + getMatrixId(rid: string): string | null { + const bridgedRoom: IMatrixBridgedRoom = this.findOne({ rid }); + + return bridgedRoom ? bridgedRoom.mri : null; + } + + getId(mri: string): string | null { + const bridgedRoom: IMatrixBridgedRoom = this.findOne({ mri }); + + return bridgedRoom ? bridgedRoom.rid : null; + } +} + +export const MatrixBridgedRoom = new MatrixBridgedRoomModel(); diff --git a/app/models/server/models/MatrixBridgedUser.ts b/app/models/server/models/MatrixBridgedUser.ts new file mode 100644 index 000000000000..2e8a1466be31 --- /dev/null +++ b/app/models/server/models/MatrixBridgedUser.ts @@ -0,0 +1,28 @@ +import { Base } from './_Base'; + +export interface IMatrixBridgedUser { + uid: string; + mui: string; +} + +class MatrixBridgedUserModel extends Base { + constructor() { + super('matrix_bridged_users'); + this.tryEnsureIndex({ uid: 1 }, { unique: true, sparse: true }); + this.tryEnsureIndex({ mui: 1 }, { unique: true, sparse: true }); + } + + getMatrixId(uid: string): string | null { + const bridgedRoom: IMatrixBridgedUser = this.findOne({ uid }); + + return bridgedRoom ? bridgedRoom.mui : null; + } + + getId(mui: string): string | null { + const bridgedRoom: IMatrixBridgedUser = this.findOne({ mui }); + + return bridgedRoom ? bridgedRoom.uid : null; + } +} + +export const MatrixBridgedUser = new MatrixBridgedUserModel(); diff --git a/app/slashcommands-invite/server/server.js b/app/slashcommands-invite/server/server.js index 7c3a953abb5a..88e6aeb6e987 100644 --- a/app/slashcommands-invite/server/server.js +++ b/app/slashcommands-invite/server/server.js @@ -5,13 +5,13 @@ import { TAPi18n } from 'meteor/rocketchat:tap-i18n'; import { slashCommands } from '../../utils'; import { Subscriptions } from '../../models'; import { api } from '../../../server/sdk/api'; +import { inviteFederatedUser } from '../../federation-bridge/server/methods'; /* * Invite is a named function that will replace /invite commands * @param {Object} message - The message object */ - function Invite(command, params, item) { if (command !== 'invite' || !Match.test(params, String)) { return; @@ -21,6 +21,16 @@ function Invite(command, params, item) { if (usernames.length === 0) { return; } + + // Check if it is a federation invite + // /invite fed:@rc_b_alan:b.rc.allskar.com + if (usernames[0].startsWith('fed:')) { + // Fix the username + usernames[0] = usernames[0].replace('fed:', ''); + + Promise.await(inviteFederatedUser(item.rid, usernames[0])); + } + let users = Meteor.users.find({ username: { $in: usernames, diff --git a/package-lock.json b/package-lock.json index d76d900ad176..d641f73249f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3636,6 +3636,16 @@ } } }, + "@dabh/diagnostics": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz", + "integrity": "sha512-+A1YivoVDNNVCdfozHSR8v/jyuuLTMXwjWuxPFlFlUapXoGc+Gj9mDlTDDfrwl7rXCl2tNZ0kE8sIBO6YOn96Q==", + "requires": { + "colorspace": "1.1.x", + "enabled": "2.0.x", + "kuler": "^2.0.0" + } + }, "@discoveryjs/json-ext": { "version": "0.5.5", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.5.tgz", @@ -4393,6 +4403,10 @@ } } }, + "@matrix-org/olm": { + "version": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.4.tgz", + "integrity": "sha512-ddaXWILlm1U0Z9qpcZffJjBFZRpz/GxQ1n/Qth3xKvYRUbniuPOgftNTDaxkEC4h04uJG5Ls/OdI1YJUyfuRzQ==" + }, "@mdx-js/loader": { "version": "1.6.22", "resolved": "https://registry.npmjs.org/@mdx-js/loader/-/loader-1.6.22.tgz", @@ -9585,7 +9599,6 @@ "version": "1.19.0", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.0.tgz", "integrity": "sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ==", - "dev": true, "requires": { "@types/connect": "*", "@types/node": "*" @@ -9668,7 +9681,6 @@ "version": "3.4.33", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.33.tgz", "integrity": "sha512-2+FrkXY4zllzTNfJth7jOqEHC+enpLeGslEhpnTAkg21GkRrWV4SsAtqchtT4YS9/nODBU2/ZfsBY2X4J/dX7A==", - "dev": true, "requires": { "@types/node": "*" } @@ -9722,7 +9734,6 @@ "version": "4.17.12", "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.12.tgz", "integrity": "sha512-pTYas6FrP15B1Oa0bkN5tQMNqOcVXa9j4FTFtO8DWI9kppKib+6NJtfTOOLcwxuuYvcX2+dVG6et1SxW/Kc17Q==", - "dev": true, "requires": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.18", @@ -9734,7 +9745,6 @@ "version": "4.17.22", "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.22.tgz", "integrity": "sha512-WdqmrUsRS4ootGha6tVwk/IVHM1iorU8tGehftQD2NWiPniw/sm7xdJOIlXLwqdInL9wBw/p7oO8vaYEF3NDmA==", - "dev": true, "requires": { "@types/node": "*", "@types/qs": "*", @@ -9990,8 +10000,7 @@ "@types/mime": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", - "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==", - "dev": true + "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==" }, "@types/minimatch": { "version": "3.0.5", @@ -10188,14 +10197,12 @@ "@types/qs": { "version": "6.9.6", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.6.tgz", - "integrity": "sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA==", - "dev": true + "integrity": "sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA==" }, "@types/range-parser": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.3.tgz", - "integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==", - "dev": true + "integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==" }, "@types/reach__router": { "version": "1.3.9", @@ -10293,7 +10300,6 @@ "version": "1.13.9", "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.9.tgz", "integrity": "sha512-ZFqF6qa48XsPdjXV5Gsz0Zqmux2PerNd3a/ktL45mHpa19cuMi/cL8tcxdAx497yRh+QtYPuofjT9oWw9P7nkA==", - "dev": true, "requires": { "@types/mime": "^1", "@types/node": "*" @@ -11358,6 +11364,11 @@ "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", "optional": true }, + "another-json": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/another-json/-/another-json-0.2.0.tgz", + "integrity": "sha1-tfQBnJc7bdXGUGotk0acttMq7tw=" + }, "ansi-align": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", @@ -11971,7 +11982,6 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, "requires": { "sprintf-js": "~1.0.2" }, @@ -11979,8 +11989,7 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" } } }, @@ -13617,6 +13626,14 @@ "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==" }, + "basic-auth": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", + "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", + "requires": { + "safe-buffer": "5.1.2" + } + }, "batch-processor": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/batch-processor/-/batch-processor-1.0.0.tgz", @@ -13654,6 +13671,125 @@ "open": "^7.0.3" } }, + "better-sqlite3": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-7.4.4.tgz", + "integrity": "sha512-CnK1JjchxbEumd2J6lqfzSG5nT4B/v+J9P0AKSm3NHSfcPsEGE4rHUp9lDlslJ1TL701RM7GWlTp3Pbacpn1/Q==", + "optional": true, + "requires": { + "bindings": "^1.5.0", + "prebuild-install": "^6.1.4", + "tar": "^6.1.11" + }, + "dependencies": { + "chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "optional": true + }, + "fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "optional": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "optional": true + }, + "minipass": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.5.tgz", + "integrity": "sha512-+8NzxD82XQoNKNrl1d/FSi+X8wAEWR+sbYAfIvub4Nz0d22plFG72CEVVaufV8PNf4qSslFTD8VMOxNVhHCjTw==", + "optional": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "optional": true, + "requires": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + } + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "optional": true + }, + "node-abi": { + "version": "2.30.1", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.30.1.tgz", + "integrity": "sha512-/2D0wOQPgaUWzVSVgRMx+trKJRC2UG4SUc4oCJoXx9Uxjtp0Vy3/kt7zcbxHF8+Z/pK3UloLWzBISg72brfy1w==", + "optional": true, + "requires": { + "semver": "^5.4.1" + } + }, + "prebuild-install": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-6.1.4.tgz", + "integrity": "sha512-Z4vpywnK1lBg+zdPCVCsKq0xO66eEV9rWo2zrROGGiRS4JtueBOdlB1FnY8lcy7JsUud/Q3ijUxyWN26Ika0vQ==", + "optional": true, + "requires": { + "detect-libc": "^1.0.3", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^1.0.1", + "node-abi": "^2.21.0", + "npmlog": "^4.0.1", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^3.0.3", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "optional": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "tar": { + "version": "6.1.11", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", + "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", + "optional": true, + "requires": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^3.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "optional": true + } + } + }, "big-integer": { "version": "1.6.48", "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.48.tgz", @@ -13672,6 +13808,21 @@ "dev": true, "optional": true }, + "binary-search-tree": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/binary-search-tree/-/binary-search-tree-0.2.5.tgz", + "integrity": "sha1-fbs7IQ/coIJFDa0jNMMErzm9x4Q=", + "requires": { + "underscore": "~1.4.4" + }, + "dependencies": { + "underscore": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz", + "integrity": "sha1-YaajIBBiKvoHljvzJSA88SI51gQ=" + } + } + }, "bindings": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", @@ -14011,6 +14162,11 @@ "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==" }, + "browser-request": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/browser-request/-/browser-request-0.3.3.tgz", + "integrity": "sha1-ns5bWsqJopkyJC4Yv5M975h2zBc=" + }, "browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", @@ -15364,9 +15520,36 @@ "colors": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", - "dev": true, - "optional": true + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" + }, + "colorspace": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz", + "integrity": "sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==", + "requires": { + "color": "^3.1.3", + "text-hex": "1.0.x" + }, + "dependencies": { + "color": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", + "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", + "requires": { + "color-convert": "^1.9.3", + "color-string": "^1.6.0" + } + }, + "color-string": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.6.0.tgz", + "integrity": "sha512-c/hGS+kRWJutUBEngKKmk4iH3sD59MBkoxVapS/0wgpCz2u7XsNloxknyvBhzwEs1IbV36D9PwqLPJ2DTu3vMA==", + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + } + } }, "combined-stream": { "version": "1.0.7", @@ -17205,6 +17388,11 @@ "hoist-non-react-statics": "^3.3.0" } }, + "enabled": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz", + "integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==" + }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", @@ -19122,9 +19310,9 @@ "integrity": "sha512-s1EQguBw/9qtc1p/WTY4eq9WMRIACkj+HTcOIK1in4MV5aFaQC9ZCIt0dJ7pr5bIf4lPpHvAtP2ywpTNgs7hqw==" }, "fastq": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", - "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", "requires": { "reusify": "^1.0.4" } @@ -19176,6 +19364,11 @@ "pend": "~1.2.0" } }, + "fecha": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.1.tgz", + "integrity": "sha512-MMMQ0ludy/nBs1/o0zVOiKTpG7qMbonKUzjJgQFEuvq6INZ1OraKPRAWkBq5vlKLOUMpmNYG1JoN3oDPUQ9m3Q==" + }, "fflate": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.7.1.tgz", @@ -19260,6 +19453,14 @@ } } }, + "file-stream-rotator": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/file-stream-rotator/-/file-stream-rotator-0.5.7.tgz", + "integrity": "sha512-VYb3HZ/GiAGUCrfeakO8Mp54YGswNUHvL7P09WQcXAJNSj3iQ5QraYSp3cIn1MUyw6uzfgN/EFOarCNa4JvUHQ==", + "requires": { + "moment": "^2.11.2" + } + }, "file-system-cache": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/file-system-cache/-/file-system-cache-1.0.5.tgz", @@ -19483,6 +19684,11 @@ "resolved": "https://registry.npmjs.org/fn-args/-/fn-args-5.0.0.tgz", "integrity": "sha512-CtbfI3oFFc3nbdIoHycrfbrxiGgxXBXXuyOl49h47JawM1mYrqpiRqnH5CB2mBatdXvHHOUO6a+RiAuuvKt0lw==" }, + "fn.name": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", + "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" + }, "focus-visible": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/focus-visible/-/focus-visible-5.2.0.tgz", @@ -21047,6 +21253,22 @@ } } }, + "generate-function": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", + "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", + "requires": { + "is-property": "^1.0.2" + } + }, + "generate-object-property": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", + "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", + "requires": { + "is-property": "^1.0.0" + } + }, "gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -22157,6 +22379,11 @@ } } }, + "htmlencode": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/htmlencode/-/htmlencode-0.0.4.tgz", + "integrity": "sha1-9+LWr74YqHp45jujMI51N2Z0Dj8=" + }, "htmlparser2": { "version": "3.10.0", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.0.tgz", @@ -23019,6 +23246,23 @@ "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", "dev": true }, + "is-my-ip-valid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz", + "integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==" + }, + "is-my-json-valid": { + "version": "2.20.6", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.20.6.tgz", + "integrity": "sha512-1JQwulVNjx8UqkPE/bqDaxtH4PXCe/2VRh/y3p99heOV87HG4Id5/VfDswd+YiAfHcRTfDlWgISycnHuhZq1aw==", + "requires": { + "generate-function": "^2.0.0", + "generate-object-property": "^1.1.0", + "is-my-ip-valid": "^1.0.0", + "jsonpointer": "^5.0.0", + "xtend": "^4.0.0" + } + }, "is-negative-zero": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", @@ -23100,8 +23344,12 @@ "is-promise": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=" + }, + "is-property": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=" }, "is-regex": { "version": "1.0.4", @@ -23654,7 +23902,6 @@ "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -23859,6 +24106,11 @@ "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" }, + "jsonpointer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.0.tgz", + "integrity": "sha512-PNYZIdMjVIvVgDSYKTT63Y+KZ6IZvGRNNWcxwD+GNnUz1MKPfv30J8ueCjdwcN0nDx2SlshgyB7Oy0epAzVRRg==" + }, "jsontokens": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/jsontokens/-/jsontokens-2.0.2.tgz", @@ -24174,6 +24426,11 @@ "integrity": "sha512-sZLUnTqimCkvkgRS+kbPlYW5o8q5w1cu+uIisKpEWkj31I8mx8kNG162DwRav8Zirkva6N5uoFsm9kzK4mUXjw==", "dev": true }, + "kuler": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz", + "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==" + }, "lamejs": { "version": "git+https://github.com/zhuker/lamejs.git#564612b5b57336238a5920ba4c301b49f7cb2bab", "from": "git+https://github.com/zhuker/lamejs.git", @@ -24984,6 +25241,30 @@ } } }, + "logform": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/logform/-/logform-2.3.0.tgz", + "integrity": "sha512-graeoWUH2knKbGthMtuG1EfaSPMZFZBIrhuJHhkS5ZseFBrc7DupCzihOQAzsK/qIKPQaPJ/lFQFctILUY5ARQ==", + "requires": { + "colors": "^1.2.1", + "fecha": "^4.2.0", + "ms": "^2.1.1", + "safe-stable-stringify": "^1.1.0", + "triple-beam": "^1.3.0" + }, + "dependencies": { + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + } + } + }, + "loglevel": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.0.tgz", + "integrity": "sha512-G6A/nJLRgWOuuwdNuA6koovfEV1YpqqAG4pRUlFaz3jj2QNZ8M4vBqnVA+HBTmU/AMNUtlOsMmSpF6NyOjztbA==" + }, "long": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", @@ -25003,6 +25284,18 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, + "lowdb": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lowdb/-/lowdb-1.0.0.tgz", + "integrity": "sha512-2+x8esE/Wb9SQ1F9IHaYWfsC9FIecLOPrK4g17FGEayjUWH172H6nwicRovGvSE2CPZouc2MCIqCI7h9d+GftQ==", + "requires": { + "graceful-fs": "^4.1.3", + "is-promise": "^2.1.0", + "lodash": "4", + "pify": "^3.0.0", + "steno": "^0.4.1" + } + }, "lower-case": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", @@ -25199,6 +25492,397 @@ "integrity": "sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==", "dev": true }, + "matrix-appservice": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/matrix-appservice/-/matrix-appservice-0.8.0.tgz", + "integrity": "sha512-mfgMpmV3dWLtzrd4V/3XtqUD0P44I/mTgsRreW5jMhSaUnnRGZbpptBw2q4/axbLjw2FarlWtOVgertDGMtccA==", + "requires": { + "@types/express": "^4.17.8", + "body-parser": "^1.19.0", + "express": "^4.17.1", + "js-yaml": "^3.14.0", + "morgan": "^1.10.0" + } + }, + "matrix-appservice-bridge": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/matrix-appservice-bridge/-/matrix-appservice-bridge-3.1.2.tgz", + "integrity": "sha512-1VjKSalKS/9/MknrcAkAEFcoeOduzqBWr3LHmuwc4+T94vtCrA3WX+SciurxW8jfs0D8sLdnNjH1sMVAPfA2Gw==", + "requires": { + "chalk": "^4.1.0", + "extend": "^3.0.2", + "is-my-json-valid": "^2.20.5", + "js-yaml": "^4.0.0", + "matrix-appservice": "^0.8.0", + "matrix-bot-sdk": "^0.6.0-beta.2", + "matrix-js-sdk": "^9.9.0", + "nedb": "^1.8.0", + "nopt": "^5.0.0", + "p-queue": "^6.6.2", + "prom-client": "^13.1.0", + "winston": "^3.3.3", + "winston-daily-rotate-file": "^4.5.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "requires": { + "argparse": "^2.0.1" + } + }, + "p-queue": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz", + "integrity": "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==", + "requires": { + "eventemitter3": "^4.0.4", + "p-timeout": "^3.2.0" + } + }, + "prom-client": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-13.2.0.tgz", + "integrity": "sha512-wGr5mlNNdRNzEhRYXgboUU2LxHWIojxscJKmtG3R8f4/KiWqyYgXTLHs0+Ted7tG3zFT7pgHJbtomzZ1L0ARaQ==", + "requires": { + "tdigest": "^0.1.1" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "matrix-bot-sdk": { + "version": "0.6.0-beta.2", + "resolved": "https://registry.npmjs.org/matrix-bot-sdk/-/matrix-bot-sdk-0.6.0-beta.2.tgz", + "integrity": "sha512-D9aQ2++1bJIzka2uIz22HkaeyT058QGOh96xdxiDOaezyzLY5BN7ehYg+P0xRzDYDFKx9DbqDYCt97IkfahtPw==", + "requires": { + "@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.4.tgz", + "@types/express": "^4.17.13", + "another-json": "^0.2.0", + "better-sqlite3": "^7.4.3", + "chalk": "^4.1.0", + "express": "^4.17.1", + "glob-to-regexp": "^0.4.1", + "hash.js": "^1.1.7", + "html-to-text": "^6.0.0", + "htmlencode": "^0.0.4", + "lowdb": "^1.0.0", + "lru-cache": "^6.0.0", + "mkdirp": "^1.0.4", + "morgan": "^1.10.0", + "request": "^2.88.2", + "request-promise": "^4.2.6", + "sanitize-html": "^2.3.2" + }, + "dependencies": { + "@types/express": { + "version": "4.17.13", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", + "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", + "requires": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.18", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "dom-serializer": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz", + "integrity": "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==", + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + }, + "dependencies": { + "domhandler": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.2.2.tgz", + "integrity": "sha512-PzE9aBMsdZO8TK4BnuJwH0QT41wgMbRzuZrHUcpYncEjmQazq8QEaBWgLG7ZyC/DAZKEgglpIA6j4Qn/HmxS3w==", + "requires": { + "domelementtype": "^2.2.0" + } + } + } + }, + "domelementtype": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", + "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==" + }, + "domhandler": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-3.3.0.tgz", + "integrity": "sha512-J1C5rIANUbuYK+FuFL98650rihynUOEzRLxW+90bKZRWB6A1X1Tf82GxR1qAWLyfNPRvjqfip3Q5tdYlmAa9lA==", + "requires": { + "domelementtype": "^2.0.1" + } + }, + "domutils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", + "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "requires": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "dependencies": { + "domhandler": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.2.2.tgz", + "integrity": "sha512-PzE9aBMsdZO8TK4BnuJwH0QT41wgMbRzuZrHUcpYncEjmQazq8QEaBWgLG7ZyC/DAZKEgglpIA6j4Qn/HmxS3w==", + "requires": { + "domelementtype": "^2.2.0" + } + } + } + }, + "entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==" + }, + "glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "html-to-text": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/html-to-text/-/html-to-text-6.0.0.tgz", + "integrity": "sha512-r0KNC5aqCAItsjlgtirW6RW25c92Ee3ybQj8z//4Sl4suE3HIPqM4deGpYCUJULLjtVPEP1+Ma+1ZeX1iMsCiA==", + "requires": { + "deepmerge": "^4.2.2", + "he": "^1.2.0", + "htmlparser2": "^4.1.0", + "lodash": "^4.17.20", + "minimist": "^1.2.5" + } + }, + "htmlparser2": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-4.1.0.tgz", + "integrity": "sha512-4zDq1a1zhE4gQso/c5LP1OtrhYTncXNSpvJYtWJBtXAETPlMfi3IFNjGuQbYLuVY4ZR0QMqRVvo4Pdy9KLyP8Q==", + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^3.0.0", + "domutils": "^2.0.0", + "entities": "^2.0.0" + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } + }, + "matrix-js-sdk": { + "version": "9.11.0", + "resolved": "https://registry.npmjs.org/matrix-js-sdk/-/matrix-js-sdk-9.11.0.tgz", + "integrity": "sha512-wP28ybOxyQ7lbC48QddRORYr8atEwbTqDOsu8H6u9jTTgB2qqczI/bkSoXHtutODuSeLY5x0UuwLcxVCy4yxVQ==", + "requires": { + "@babel/runtime": "^7.12.5", + "another-json": "^0.2.0", + "browser-request": "^0.3.3", + "bs58": "^4.0.1", + "content-type": "^1.0.4", + "loglevel": "^1.7.1", + "qs": "^6.9.6", + "request": "^2.88.2", + "unhomoglyph": "^1.0.6" + }, + "dependencies": { + "qs": { + "version": "6.10.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", + "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", + "requires": { + "side-channel": "^1.0.4" + } + }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + } + } + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + } + } + }, "md5-file": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/md5-file/-/md5-file-5.0.0.tgz", @@ -27226,6 +27910,25 @@ "iced-runtime": ">=0.0.1" } }, + "morgan": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz", + "integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==", + "requires": { + "basic-auth": "~2.0.1", + "debug": "2.6.9", + "depd": "~2.0.0", + "on-finished": "~2.3.0", + "on-headers": "~1.0.2" + }, + "dependencies": { + "depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" + } + } + }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", @@ -27327,6 +28030,30 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "nedb": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/nedb/-/nedb-1.8.0.tgz", + "integrity": "sha1-DjUCzYLABNU1WkPJ5VV3vXvZHYg=", + "requires": { + "async": "0.2.10", + "binary-search-tree": "0.2.5", + "localforage": "^1.3.0", + "mkdirp": "~0.5.1", + "underscore": "~1.4.4" + }, + "dependencies": { + "async": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", + "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=" + }, + "underscore": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz", + "integrity": "sha1-YaajIBBiKvoHljvzJSA88SI51gQ=" + } + } + }, "negotiator": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", @@ -27659,6 +28386,14 @@ "resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz", "integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=" }, + "nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "requires": { + "abbrev": "1" + } + }, "normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -27788,6 +28523,11 @@ } } }, + "object-hash": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz", + "integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==" + }, "object-inspect": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", @@ -28105,8 +28845,7 @@ "on-headers": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", - "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", - "dev": true + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==" }, "once": { "version": "1.4.0", @@ -28116,6 +28855,14 @@ "wrappy": "1" } }, + "one-time": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", + "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==", + "requires": { + "fn.name": "1.x.x" + } + }, "onetime": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", @@ -28248,8 +28995,7 @@ "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" }, "p-is-promise": { "version": "2.1.0", @@ -28298,7 +29044,6 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", - "dev": true, "requires": { "p-finally": "^1.0.0" } @@ -28396,6 +29141,11 @@ "json-parse-better-errors": "^1.0.1" } }, + "parse-srcset": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/parse-srcset/-/parse-srcset-1.0.2.tgz", + "integrity": "sha1-8r0iH2zJcKk42IVWq8WJyqqiveE=" + }, "parse5": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", @@ -32147,6 +32897,17 @@ "throttleit": "^1.0.0" } }, + "request-promise": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.6.tgz", + "integrity": "sha512-HCHI3DJJUakkOr8fNoCc73E5nU5bqITjOYFMDrKHYOXWXrgD/SBaC7LjwuPymUprRyuF06UK7hd/lMHkmUXglQ==", + "requires": { + "bluebird": "^3.5.0", + "request-promise-core": "1.1.4", + "stealthy-require": "^1.1.1", + "tough-cookie": "^2.3.3" + } + }, "request-promise-core": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", @@ -32382,6 +33143,11 @@ "ret": "~0.1.10" } }, + "safe-stable-stringify": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-1.1.1.tgz", + "integrity": "sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw==" + }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -32431,6 +33197,100 @@ } } }, + "sanitize-html": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.5.3.tgz", + "integrity": "sha512-DGATXd1fs/Rm287/i5FBKVYSBBUL0iAaztOA1/RFhEs4yqo39/X52i/q/CwsfCUG5cilmXSBmnQmyWfnKhBlOg==", + "requires": { + "deepmerge": "^4.2.2", + "escape-string-regexp": "^4.0.0", + "htmlparser2": "^6.0.0", + "is-plain-object": "^5.0.0", + "parse-srcset": "^1.0.2", + "postcss": "^8.3.11" + }, + "dependencies": { + "dom-serializer": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz", + "integrity": "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==", + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + } + }, + "domelementtype": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", + "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==" + }, + "domhandler": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.2.2.tgz", + "integrity": "sha512-PzE9aBMsdZO8TK4BnuJwH0QT41wgMbRzuZrHUcpYncEjmQazq8QEaBWgLG7ZyC/DAZKEgglpIA6j4Qn/HmxS3w==", + "requires": { + "domelementtype": "^2.2.0" + } + }, + "domutils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", + "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "requires": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + } + }, + "entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==" + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" + }, + "htmlparser2": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", + "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.0.0", + "domutils": "^2.5.2", + "entities": "^2.0.0" + } + }, + "is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" + }, + "nanoid": { + "version": "3.1.30", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz", + "integrity": "sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==" + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "postcss": { + "version": "8.3.11", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.11.tgz", + "integrity": "sha512-hCmlUAIlUiav8Xdqw3Io4LcpA1DOt7h3LSTAC4G6JGHFFaWzI6qvFt9oilvl8BmkbBRX1IhM90ZAmpk68zccQA==", + "requires": { + "nanoid": "^3.1.30", + "picocolors": "^1.0.0", + "source-map-js": "^0.6.2" + } + } + } + }, "saslprep": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", @@ -33043,8 +33903,7 @@ "source-map-js": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", - "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", - "dev": true + "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==" }, "source-map-resolve": { "version": "0.5.2", @@ -33260,6 +34119,14 @@ "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" }, + "steno": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/steno/-/steno-0.4.4.tgz", + "integrity": "sha1-BxEFvfwobmYVwEA8J+nXtdy4Vcs=", + "requires": { + "graceful-fs": "^4.1.3" + } + }, "store2": { "version": "2.12.0", "resolved": "https://registry.npmjs.org/store2/-/store2-2.12.0.tgz", @@ -34980,6 +35847,73 @@ } } }, + "tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "optional": true, + "requires": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + }, + "dependencies": { + "bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "optional": true, + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "optional": true + } + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "optional": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "optional": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "optional": true, + "requires": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + } + } + } + }, "tar-stream": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", @@ -35211,6 +36145,11 @@ } } }, + "text-hex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", + "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==" + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -35473,6 +36412,11 @@ "integrity": "sha512-rjUWSqnfTNrjbB9NQWfPMH/xRK1deHeGsHoVfpxJ++XeYXE0d6B1En37AHfw3jtfTU7dzMzZL2jjpe8Qb5gLIQ==", "dev": true }, + "triple-beam": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", + "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==" + }, "triplesec": { "version": "3.0.27", "resolved": "https://registry.npmjs.org/triplesec/-/triplesec-3.0.27.tgz", @@ -36173,6 +37117,11 @@ "xtend": "^4.0.0" } }, + "unhomoglyph": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/unhomoglyph/-/unhomoglyph-1.0.6.tgz", + "integrity": "sha512-7uvcWI3hWshSADBu4JpnyYbTVc7YlhF5GDW/oPD5AxIxl34k4wXR3WDkPnzLxkN32LiTCTKMQLtKVZiwki3zGg==" + }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", @@ -37404,6 +38353,80 @@ "bs58check": "<3.0.0" } }, + "winston": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.3.3.tgz", + "integrity": "sha512-oEXTISQnC8VlSAKf1KYSSd7J6IWuRPQqDdo8eoRNaYKLvwSb5+79Z3Yi1lrl6KDpU6/VWaxpakDAtb1oQ4n9aw==", + "requires": { + "@dabh/diagnostics": "^2.0.2", + "async": "^3.1.0", + "is-stream": "^2.0.0", + "logform": "^2.2.0", + "one-time": "^1.0.0", + "readable-stream": "^3.4.0", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.4.0" + }, + "dependencies": { + "async": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.2.tgz", + "integrity": "sha512-H0E+qZaDEfx/FY4t7iLRv1W2fFI6+pyCeTw1uN20AQPiwqwM6ojPxHxdLv4z8hi2DtnW9BOckSspLucW7pIE5g==" + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "winston-daily-rotate-file": { + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/winston-daily-rotate-file/-/winston-daily-rotate-file-4.5.5.tgz", + "integrity": "sha512-ds0WahIjiDhKCiMXmY799pDBW+58ByqIBtUcsqr4oDoXrAI3Zn+hbgFdUxzMfqA93OG0mPLYVMiotqTgE/WeWQ==", + "requires": { + "file-stream-rotator": "^0.5.7", + "object-hash": "^2.0.1", + "triple-beam": "^1.3.0", + "winston-transport": "^4.4.0" + } + }, + "winston-transport": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.4.0.tgz", + "integrity": "sha512-Lc7/p3GtqtqPBYYtS6KCN3c77/2QCev51DvcJKbkFPQNoj1sinkGwLGFDxkXY9J6p9+EPnYs+D90uwbnaiURTw==", + "requires": { + "readable-stream": "^2.3.7", + "triple-beam": "^1.2.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + } + } + }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", diff --git a/package.json b/package.json index 5a7bcf01fbf7..e8e89167f306 100644 --- a/package.json +++ b/package.json @@ -225,6 +225,7 @@ "exif-be-gone": "^1.2.0", "express": "^4.17.1", "express-rate-limit": "^5.2.6", + "fastq": "^1.13.0", "fflate": "^0.7.1", "fibers": "4.0.3", "file-type": "^10.11.0", @@ -257,6 +258,7 @@ "lodash.get": "^4.4.2", "mailparser": "^3.2.0", "marked": "^0.7.0", + "matrix-appservice-bridge": "^3.1.2", "mem": "^6.1.1", "meteor-node-stubs": "^1.0.3", "mime-db": "^1.48.0", diff --git a/private/matrix/rocketchat-registration-a.yaml b/private/matrix/rocketchat-registration-a.yaml new file mode 100644 index 000000000000..5430e1569749 --- /dev/null +++ b/private/matrix/rocketchat-registration-a.yaml @@ -0,0 +1,12 @@ +id: rocketchat +hs_token: afe7e2d6f965b6d16c33b70e27492f072bb20dd6b19033950a5d4eae1c504142 +as_token: 784e89060d205cd5531046210731718586411761caca31ddda738cf28d2d4e13 +url: 'https://43f0-2804-2984-55c-6000-00-1006.ngrok.io' +sender_localpart: 'rc_a_bot' +namespaces: + users: + - exclusive: false + regex: '@rc_.*' + rooms: + - exclusive: false + regex: '@rc_.*' diff --git a/private/matrix/rocketchat-registration-b.yaml b/private/matrix/rocketchat-registration-b.yaml new file mode 100644 index 000000000000..373c5eb4b8c7 --- /dev/null +++ b/private/matrix/rocketchat-registration-b.yaml @@ -0,0 +1,12 @@ +id: rocketchat +hs_token: afe7e2d6f965b6d16c33b70e27492f072bb20dd6b19033950a5d4eae1c504142 +as_token: 784e89060d205cd5531046210731718586411761caca31ddda738cf28d2d4e13 +url: 'https://b8e9-2804-2984-55c-6000-00-1012.ngrok.io' +sender_localpart: 'rc_b_bot' +namespaces: + users: + - exclusive: false + regex: '@rc_.*' + rooms: + - exclusive: false + regex: '@rc_.*' diff --git a/server/importPackages.ts b/server/importPackages.ts index fb5ee5b21abc..432d67c300d1 100644 --- a/server/importPackages.ts +++ b/server/importPackages.ts @@ -23,6 +23,7 @@ import '../app/emoji-custom/server'; import '../app/emoji-emojione/server'; import '../app/error-handler'; import '../app/federation/server'; +import '../app/federation-bridge/server'; import '../app/file'; import '../app/file-upload'; import '../app/github-enterprise/server';