-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into remo…
…veNull * 'develop' of github.com:RocketChat/Rocket.Chat: (21 commits) Regression: Use exact Node version on micro services Docker images (#25287) Chore: Add root package.json to houston files (#25286) Chore: Minor dependency updates (#25269) Chore: Add yarn plugin to check node and yarn version (#25224) Chore: Remove package-lock.json from houston files (#25280) feat: remove 'Company' email label on setup wiz (#25260) Chore: Fix return type warnings (#25275) [NEW] Expand Apps Engine's environment variable allowed list (#23870) Regression: Fix federation Matrix bridge startup (#25273) [FIX] Message preview not available for queued chats (#25092) [NEW] Alpha Matrix Federation (#23688) Chore: Bump Fuselage packages (#25259) [FIX] Incorrect websocket url in livechat widget (#25261) [FIX] Showing Blank Message Inside Report (#25007) [FIX] Add select message to system message, thread preview and allow select on legacy template (#25251) [FIX] Add katex render to new message react template (#25239) Chore: Update Livechat to the last version (#25257) [FIX] Custom sound error toast messages (#24515) Regression: Avatar not loading on first direct message (#25211) Bump version to 4.6.3 ...
- Loading branch information
Showing
98 changed files
with
2,985 additions
and
685 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
engine-strict = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* eslint-disable */ | ||
//prettier-ignore | ||
module.exports = { | ||
name: "@yarnpkg/plugin-engines", | ||
factory: function (require) { | ||
var plugin=(()=>{var l=Object.create,c=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var y=e=>c(e,"__esModule",{value:!0});var t=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var g=(e,o)=>{for(var r in o)c(e,r,{get:o[r],enumerable:!0})},P=(e,o,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of u(o))!h.call(e,s)&&s!=="default"&&c(e,s,{get:()=>o[s],enumerable:!(r=v(o,s))||r.enumerable});return e},i=e=>P(y(c(e!=null?l(m(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var k={};g(k,{default:()=>$});var n=i(t("@yarnpkg/core")),p=i(t("@yarnpkg/fslib")),d=i(t("fs")),f=i(t("path")),a=i(t("semver")),N={hooks:{validateProject:e=>{let o=(0,d.readFileSync)((0,f.resolve)(p.npath.fromPortablePath(e.cwd),"package.json"),"utf-8"),{engines:r={}}=JSON.parse(o);if(r.node!=null&&!(0,a.satisfies)(process.version,r.node))throw new n.ReportError(n.MessageName.UNNAMED,`The current Node version ${process.version} does not satisfy the required version ${r.node}.`);if(r.yarn!=null&&!(0,a.satisfies)(n.YarnVersion,r.yarn))throw new n.ReportError(n.MessageName.UNNAMED,`The current Yarn version v${n.YarnVersion} does not satisfy the required version ${r.yarn}.`)},setupScriptEnvironment:async e=>{let o=(0,d.readFileSync)((0,f.resolve)(p.npath.fromPortablePath(e.cwd),"package.json"),"utf-8"),{engines:r={}}=JSON.parse(o);r.node!=null&&!(0,a.satisfies)(process.version,r.node)&&(console.error(`The current Node version ${process.version} does not satisfy the required version ${r.node}.`),process.exit(1)),r.yarn!=null&&!(0,a.satisfies)(n.YarnVersion,r.yarn)&&(console.error(`The current Yarn version v${n.YarnVersion} does not satisfy the required version ${r.yarn}.`),process.exit(1))}}},$=N;return k;})(); | ||
return plugin; | ||
} | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Bridge, AppServiceRegistration } from 'matrix-appservice-bridge'; | ||
|
||
import { settings } from '../../settings/server'; | ||
import { IMatrixEvent } from './definitions/IMatrixEvent'; | ||
import { MatrixEventType } from './definitions/MatrixEventType'; | ||
import { addToQueue } from './queue'; | ||
import { getRegistrationInfo } from './config'; | ||
|
||
export const matrixBridge = new Bridge({ | ||
homeserverUrl: settings.get('Federation_Matrix_homeserver_url'), | ||
domain: settings.get('Federation_Matrix_homeserver_domain'), | ||
registration: AppServiceRegistration.fromObject(getRegistrationInfo()), | ||
disableStores: true, | ||
controller: { | ||
onAliasQuery: (alias, matrixRoomId): void => { | ||
console.log('onAliasQuery', alias, matrixRoomId); | ||
}, | ||
onEvent: async (request /* , context*/): Promise<void> => { | ||
// Get the event | ||
const event = request.getData() as unknown as IMatrixEvent<MatrixEventType>; | ||
|
||
addToQueue(event); | ||
}, | ||
onLog: async (line, isError): Promise<void> => { | ||
console.log(line, isError); | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import type { AppServiceOutput } from 'matrix-appservice-bridge'; | ||
|
||
import { settings } from '../../settings/server'; | ||
|
||
export type bridgeUrlTuple = [string, string, number]; | ||
|
||
export function getRegistrationInfo(): AppServiceOutput { | ||
/* eslint-disable @typescript-eslint/camelcase */ | ||
return { | ||
id: settings.get('Federation_Matrix_id'), | ||
hs_token: settings.get('Federation_Matrix_hs_token'), | ||
as_token: settings.get('Federation_Matrix_as_token'), | ||
url: settings.get<string>('Federation_Matrix_bridge_url'), | ||
sender_localpart: settings.get('Federation_Matrix_bridge_localpart'), | ||
namespaces: { | ||
users: [ | ||
{ | ||
exclusive: false, | ||
// Reserve these MXID's (usernames) | ||
regex: `.*`, | ||
}, | ||
], | ||
aliases: [ | ||
{ | ||
exclusive: false, | ||
// Reserve these room aliases | ||
regex: `.*`, | ||
}, | ||
], | ||
rooms: [ | ||
{ | ||
exclusive: false, | ||
// This regex is used to define which rooms we listen to with the bridge. | ||
// This does not reserve the rooms like the other namespaces. | ||
regex: '.*', | ||
}, | ||
], | ||
}, | ||
rate_limited: false, | ||
protocols: null, | ||
}; | ||
/* eslint-enable @typescript-eslint/camelcase */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as message from './message'; | ||
import * as room from './room'; | ||
import * as user from './user'; | ||
|
||
export const dataInterface = { | ||
message: message.normalize, | ||
room: room.normalize, | ||
user: user.normalize, | ||
}; |
17 changes: 17 additions & 0 deletions
17
apps/meteor/app/federation-v2/server/data-interface/message.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { IMessage, IUser } from '@rocket.chat/core-typings'; | ||
|
||
import { dataInterface } from '.'; | ||
|
||
interface INormalizedMessage extends IMessage { | ||
u: Required<Pick<IUser, '_id' | 'username' | 'name'>>; | ||
} | ||
|
||
export const normalize = async (message: IMessage): Promise<INormalizedMessage> => { | ||
// TODO: normalize the entire payload (if needed) | ||
const normalizedMessage: INormalizedMessage = message as INormalizedMessage; | ||
|
||
// Normalize the user | ||
normalizedMessage.u = (await dataInterface.user(message.u._id)) as Required<Pick<IUser, '_id' | 'username' | 'name'>>; | ||
|
||
return normalizedMessage; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { IRoom } from '@rocket.chat/core-typings'; | ||
|
||
import { Rooms } from '../../../models/server'; | ||
|
||
export const normalize = async (roomId: string): Promise<IRoom> => { | ||
// Normalize the user | ||
return Rooms.findOneById(roomId); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { IUser } from '@rocket.chat/core-typings'; | ||
|
||
import { Users } from '../../../models/server'; | ||
|
||
export const normalize = async (userId: string): Promise<IUser> => { | ||
// Normalize the user | ||
return Users.findOneById(userId); | ||
}; |
16 changes: 16 additions & 0 deletions
16
apps/meteor/app/federation-v2/server/definitions/IMatrixEvent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { MatrixEventType } from './MatrixEventType'; | ||
import { EventContent } from './IMatrixEventContent'; | ||
|
||
export interface IMatrixEvent<T extends MatrixEventType> { | ||
age: number; | ||
content: EventContent[T]; | ||
invite_room_state?: IMatrixEvent<MatrixEventType>[]; | ||
event_id: string; | ||
origin_server_ts: number; | ||
room_id: string; | ||
sender: string; | ||
state_key: string; | ||
type: T; | ||
unsigned: { age: number }; | ||
user_id: string; | ||
} |
10 changes: 10 additions & 0 deletions
10
...ederation-v2/server/definitions/IMatrixEventContent/IMatrixEventContentAddMemberToRoom.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export enum AddMemberToRoomMembership { | ||
JOIN = 'join', | ||
INVITE = 'invite', | ||
LEAVE = 'leave', | ||
} | ||
|
||
export interface IMatrixEventContentAddMemberToRoom { | ||
displayname: string; | ||
membership: AddMemberToRoomMembership; | ||
} |
4 changes: 4 additions & 0 deletions
4
...app/federation-v2/server/definitions/IMatrixEventContent/IMatrixEventContentCreateRoom.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface IMatrixEventContentCreateRoom { | ||
creator: string; | ||
room_version: string; | ||
} |
8 changes: 8 additions & 0 deletions
8
...pp/federation-v2/server/definitions/IMatrixEventContent/IMatrixEventContentSendMessage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export enum MatrixSendMessageType { | ||
'm.text', | ||
} | ||
|
||
export interface IMatrixEventContentSendMessage { | ||
body: string; | ||
msgtype: MatrixSendMessageType; | ||
} |
8 changes: 8 additions & 0 deletions
8
...deration-v2/server/definitions/IMatrixEventContent/IMatrixEventContentSetRoomJoinRules.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export enum SetRoomJoinRules { | ||
JOIN = 'public', | ||
INVITE = 'invite', | ||
} | ||
|
||
export interface IMatrixEventContentSetRoomJoinRules { | ||
join_rule: SetRoomJoinRules; | ||
} |
3 changes: 3 additions & 0 deletions
3
...pp/federation-v2/server/definitions/IMatrixEventContent/IMatrixEventContentSetRoomName.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface IMatrixEventContentSetRoomName { | ||
name: string; | ||
} |
3 changes: 3 additions & 0 deletions
3
...p/federation-v2/server/definitions/IMatrixEventContent/IMatrixEventContentSetRoomTopic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface IMatrixEventContentSetRoomTopic { | ||
topic: string; | ||
} |
16 changes: 16 additions & 0 deletions
16
apps/meteor/app/federation-v2/server/definitions/IMatrixEventContent/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { MatrixEventType } from '../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.ROOM_MEMBERSHIP]: IMatrixEventContentAddMemberToRoom; | ||
[MatrixEventType.SET_ROOM_JOIN_RULES]: IMatrixEventContentSetRoomJoinRules; | ||
[MatrixEventType.SET_ROOM_NAME]: IMatrixEventContentSetRoomName; | ||
[MatrixEventType.SET_ROOM_TOPIC]: IMatrixEventContentSetRoomTopic; | ||
[MatrixEventType.SEND_MESSAGE]: IMatrixEventContentSendMessage; | ||
}; |
12 changes: 12 additions & 0 deletions
12
apps/meteor/app/federation-v2/server/definitions/MatrixEventType.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export enum MatrixEventType { | ||
CREATE_ROOM = 'm.room.create', | ||
ROOM_MEMBERSHIP = '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', | ||
} |
Oops, something went wrong.