Skip to content

Commit

Permalink
Merge branch 'develop' into add-video-conference-endpoint-types
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-lehnen-rc committed May 3, 2022
2 parents f4af7a0 + 79f05d3 commit 6deffa5
Show file tree
Hide file tree
Showing 180 changed files with 6,757 additions and 4,285 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/packages/* @RocketChat/chat-engine
/packages/core-typings/ @RocketChat/chat-engine
/packages/rest-typings/ @RocketChat/chat-engine
/packages/eslint-config/ @RocketChat/chat-engine
/.vscode/ @RocketChat/chat-engine
/.github/ @RocketChat/chat-engine
/_templates/ @RocketChat/chat-engine
23 changes: 23 additions & 0 deletions .github/history.json
Original file line number Diff line number Diff line change
Expand Up @@ -73236,6 +73236,29 @@
]
}
]
},
"4.6.3": {
"node_version": "14.18.3",
"npm_version": "6.14.15",
"apps_engine_version": "1.31.0",
"mongo_versions": [
"3.6",
"4.0",
"4.2",
"4.4",
"5.0"
],
"pull_requests": [
{
"pr": "25220",
"title": "[FIX] Desktop notification on multi-instance environments",
"userLogin": "sampaiodiego",
"milestone": "4.6.3",
"contributors": [
"sampaiodiego"
]
}
]
}
}
}
2 changes: 1 addition & 1 deletion .github/no-js-action-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"added": {
"ignore": ["packages/accounts-linkedin/**/*", "packages/linkedin-oauth/**/*", "tests/cypress/integration/08-resolutions.spec.js"]
"ignore": ["packages/accounts-linkedin/**/*", "packages/linkedin-oauth/**/*", "tests/cypress/integration/08-resolutions.spec.js", "**/.eslintrc.js", "packages/eslint-config/**"]
}
}
32 changes: 32 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,38 @@ jobs:
docker build -t $IMAGE_NAME .
docker push $IMAGE_NAME
services-image-build-check:
runs-on: ubuntu-20.04
if: github.event.pull_request.head.repo.full_name == github.repository

strategy:
matrix:
service:
["ddp-streamer"]

steps:
- uses: actions/checkout@v3

- name: Use Node.js 14.18.3
uses: actions/setup-node@v3
with:
node-version: "14.18.3"

- name: Build Docker images
env:
IMAGE_TAG: check
run: |
yarn
yarn build:services
echo "Building Docker image for service: ${{ matrix.service }}:${IMAGE_TAG}"
docker build \
--build-arg SERVICE=${{ matrix.service }} \
-t rocketchat/${{ matrix.service }}-service:${IMAGE_TAG} \
-f ./apps/meteor/ee/server/services/Dockerfile \
.
release-versions:
runs-on: ubuntu-latest
outputs:
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict = true
File renamed without changes.
9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-engines.cjs
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;
}
};
546 changes: 546 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@ nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
spec: "https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js"
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"

yarnPath: .yarn/releases/yarn-3.2.0.cjs
4 changes: 2 additions & 2 deletions _templates/package/new/package.json.ejs.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ to: packages/<%= name %>/package.json
"typescript": "~4.3.5"
},
"scripts": {
"eslint": "eslint --ext .js,.jsx,.ts,.tsx .",
"eslint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --fix",
"lint": "eslint --ext .js,.jsx,.ts,.tsx .",
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --fix",
"jest": "jest",
"build": "tsc -p tsconfig.json"
},
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.gitignore
LICENSE
README.md
docker-compose.yml
docker-compose.yml
tests/e2e/test-failures/
2 changes: 2 additions & 0 deletions apps/meteor/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules
data/
tests/e2e/test-failures/
packages/autoupdate/
packages/meteor-streams/
packages/meteor-timesync/
Expand Down
62 changes: 3 additions & 59 deletions apps/meteor/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"extends": ["@rocket.chat/eslint-config", "plugin:prettier/recommended"],
"parser": "babel-eslint",
"extends": ["@rocket.chat/eslint-config"],
"globals": {
"__meteor_bootstrap__": false,
"__meteor_runtime_config__": false,
Expand All @@ -10,7 +9,6 @@
},
"plugins": ["react", "react-hooks"],
"rules": {
"jsx-quotes": ["error", "prefer-single"],
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react/jsx-no-undef": "error",
Expand All @@ -24,79 +22,25 @@
]
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".ts", ".tsx"]
}
},
"react": {
"version": "detect"
}
},
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx"],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"@rocket.chat/eslint-config",
"plugin:prettier/recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2018,
"warnOnUnsupportedTypeScriptVersion": false,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"legacyDecorators": true
}
},
"plugins": ["react", "@typescript-eslint", "anti-trojan-source"],
"plugins": ["react"],
"rules": {
"func-call-spacing": "off",
"jsx-quotes": ["error", "prefer-single"],
"indent": "off",
"no-dupe-class-members": "off",
"no-spaced-func": "off",
"no-unused-vars": "off",
"no-useless-constructor": "off",
"no-use-before-define": "off",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react/jsx-no-undef": "error",
"react/jsx-fragments": ["error", "syntax"],
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/interface-name-prefix": ["error", "always"],
"@typescript-eslint/no-dupe-class-members": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"@typescript-eslint/prefer-optional-chain": "warn",
"anti-trojan-source/no-bidi": "error"
},
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
"react/jsx-fragments": ["error", "syntax"]
},

"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".ts", ".tsx"]
}
},
"react": {
"version": "detect"
}
Expand Down
2 changes: 2 additions & 0 deletions apps/meteor/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,5 @@ tests/end-to-end/temporary_staged_test
/tests/cypress/videos
coverage
.nyc_output
data/
tests/e2e/test-failures/
18 changes: 18 additions & 0 deletions apps/meteor/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@

# 4.6.3
`2022-04-19 · 1 🐛 · 1 👩‍💻👨‍💻`

### Engine versions
- Node: `14.18.3`
- NPM: `6.14.15`
- MongoDB: `3.6, 4.0, 4.2, 4.4, 5.0`
- Apps-Engine: `1.31.0`

### 🐛 Bug fixes


- Desktop notification on multi-instance environments ([#25220](https://github.com/RocketChat/Rocket.Chat/pull/25220))

### 👩‍💻👨‍💻 Core Team 🤓

- [@sampaiodiego](https://github.com/sampaiodiego)

# 4.6.2
`2022-04-14 · 2 🐛 · 2 👩‍💻👨‍💻`

Expand Down
13 changes: 7 additions & 6 deletions apps/meteor/app/api/server/lib/getUploadFormData.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import Busboy from 'busboy';
import busboy from 'busboy';

export const getUploadFormData = async ({ request }) =>
new Promise((resolve, reject) => {
const busboy = new Busboy({ headers: request.headers });
const bb = busboy({ headers: request.headers });

const fields = {};

busboy.on('file', (fieldname, file, filename, encoding, mimetype) => {
bb.on('file', (fieldname, file, { filename, encoding, mimeType: mimetype }) => {
const fileData = [];

console.log(file);
file.on('data', (data) => fileData.push(data));

file.on('end', () => {
Expand All @@ -26,11 +27,11 @@ export const getUploadFormData = async ({ request }) =>
});
});

busboy.on('field', (fieldname, value) => {
bb.on('field', (fieldname, value) => {
fields[fieldname] = value;
});

busboy.on('finish', () => resolve(fields));
bb.on('finish', () => resolve(fields));

request.pipe(busboy);
request.pipe(bb);
});
2 changes: 1 addition & 1 deletion apps/meteor/app/federation-v2/server/bridge.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Bridge, AppServiceRegistration } from 'matrix-appservice-bridge';
import { Bridge, AppServiceRegistration } from '@rocket.chat/forked-matrix-appservice-bridge';

import { settings } from '../../settings/server';
import { IMatrixEvent } from './definitions/IMatrixEvent';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/federation-v2/server/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AppServiceOutput } from 'matrix-appservice-bridge';
import type { AppServiceOutput } from '@rocket.chat/forked-matrix-appservice-bridge';

import { settings } from '../../settings/server';

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/federation-v2/server/matrix-client/user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MatrixProfileInfo } from 'matrix-bot-sdk';
import { MatrixProfileInfo } from '@rocket.chat/forked-matrix-bot-sdk';
import { IUser } from '@rocket.chat/core-typings';

import { matrixBridge } from '../bridge';
Expand Down
22 changes: 19 additions & 3 deletions apps/meteor/app/lib/server/startup/rateLimiter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@ import { DDPRateLimiter } from 'meteor/ddp-rate-limiter';
import { RateLimiter } from 'meteor/rate-limit';

import { settings } from '../../../settings/server';
import { metrics } from '../../../metrics';
import { Logger } from '../../../logger';
import { metrics } from '../../../metrics/server';
import { Logger } from '../../../logger/server';

const logger = new Logger('RateLimiter');

const slowDownRate = parseInt(process.env.RATE_LIMITER_SLOWDOWN_RATE);

const rateLimiterConsoleLog = ({ msg, reply, input }) => {
console.warn('DDP RATE LIMIT:', msg);
console.warn(JSON.stringify({ reply, input }, null, 2));
};

const rateLimiterLogger = ({ msg, reply, input }) => logger.info({ msg, reply, input });

const rateLimiterLog = String(process.env.RATE_LIMITER_LOGGER) === 'console' ? rateLimiterConsoleLog : rateLimiterLogger;

// Get initial set of names already registered for rules
const names = new Set(
Object.values(DDPRateLimiter.printRules())
Expand Down Expand Up @@ -85,6 +96,7 @@ RateLimiter.prototype.check = function (input) {
callbackReply.timeToReset = ruleResult.timeToNextReset;
callbackReply.allowed = false;
callbackReply.numInvocationsLeft = 0;
callbackReply.numInvocationsExceeded = numInvocations - rule.options.numRequestsAllowed;
rule._executeCallback(callbackReply, input);
// ==== END OVERRIDE ====
} else {
Expand Down Expand Up @@ -112,7 +124,7 @@ const ruleIds = {};

const callback = (msg, name) => (reply, input) => {
if (reply.allowed === false) {
logger.info({ msg, reply, input });
rateLimiterLog({ msg, reply, input });
metrics.ddpRateLimitExceeded.inc({
limit_name: name,
user_id: input.userId,
Expand All @@ -121,6 +133,10 @@ const callback = (msg, name) => (reply, input) => {
name: input.name,
connection_id: input.connectionId,
});
// sleep before sending the error to slow down next requests
if (slowDownRate > 0 && reply.numInvocationsExceeded) {
Meteor._sleepForMs(slowDownRate * reply.numInvocationsExceeded);
}
// } else {
// console.log('DDP RATE LIMIT:', message);
// console.log(JSON.stringify({ ...reply, ...input }, null, 2));
Expand Down
6 changes: 3 additions & 3 deletions apps/meteor/app/lib/server/startup/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,11 @@ settingsRegistry.addGroup('Accounts', function () {
i18nLabel: 'Notifications_Sound_Volume',
});

this.add('Accounts_Default_User_Preferences_enableLegacyMessages', false, {
this.add('Accounts_Default_User_Preferences_enableNewMessageTemplate', false, {
type: 'boolean',
public: true,
i18nLabel: 'Enable_legacy_messages',
alert: 'Enable_legacy_messages_alert',
i18nLabel: 'Enable_New_Message_Template',
alert: 'Enable_New_Message_Template_alert',
});
});

Expand Down
Loading

0 comments on commit 6deffa5

Please sign in to comment.