From 816df07854b74a724c010ef0553e5a4df92205a3 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Tue, 16 Jul 2024 11:55:43 -0300 Subject: [PATCH 01/18] chore!: Remove pauli package --- .changeset/sixty-owls-arrive.md | 5 ++ apps/meteor/.meteor/packages | 7 +- apps/meteor/client/meteorOverrides/index.ts | 1 - .../client/meteorOverrides/login/linkedin.ts | 48 ----------- .../meteor/pauli-linkedin-oauth.d.ts | 3 - .../meteor/packages/accounts-linkedin/LICENSE | 20 ----- .../packages/accounts-linkedin/README.md | 83 ------------------- .../packages/accounts-linkedin/linkedin.js | 24 ------ .../packages/accounts-linkedin/notice.js | 10 --- .../packages/accounts-linkedin/package.js | 24 ------ 10 files changed, 8 insertions(+), 217 deletions(-) create mode 100644 .changeset/sixty-owls-arrive.md delete mode 100644 apps/meteor/client/meteorOverrides/login/linkedin.ts delete mode 100644 apps/meteor/definition/externals/meteor/pauli-linkedin-oauth.d.ts delete mode 100644 apps/meteor/packages/accounts-linkedin/LICENSE delete mode 100644 apps/meteor/packages/accounts-linkedin/README.md delete mode 100644 apps/meteor/packages/accounts-linkedin/linkedin.js delete mode 100644 apps/meteor/packages/accounts-linkedin/notice.js delete mode 100644 apps/meteor/packages/accounts-linkedin/package.js diff --git a/.changeset/sixty-owls-arrive.md b/.changeset/sixty-owls-arrive.md new file mode 100644 index 000000000000..c756e260635e --- /dev/null +++ b/.changeset/sixty-owls-arrive.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": major +--- + +Remove linkedin oauth package, now linkedin oauth must to me configured as custom oauth diff --git a/apps/meteor/.meteor/packages b/apps/meteor/.meteor/packages index 307b0d89eb0d..cad967285c53 100644 --- a/apps/meteor/.meteor/packages +++ b/apps/meteor/.meteor/packages @@ -24,10 +24,9 @@ accounts-oauth@1.4.4 accounts-password@2.4.0 accounts-twitter@1.5.0 -pauli:accounts-linkedin -google-oauth@1.4.4 -oauth@2.2.1 -oauth2@1.3.2 +google-oauth@1.4.5 +oauth@3.0.0 +oauth2@1.3.3 check@1.4.1 ddp-rate-limiter@1.2.1 diff --git a/apps/meteor/client/meteorOverrides/index.ts b/apps/meteor/client/meteorOverrides/index.ts index 9a1b0eb1f7be..b8e14d4138bd 100644 --- a/apps/meteor/client/meteorOverrides/index.ts +++ b/apps/meteor/client/meteorOverrides/index.ts @@ -8,7 +8,6 @@ import './login/facebook'; import './login/github'; import './login/google'; import './login/ldap'; -import './login/linkedin'; import './login/meteorDeveloperAccount'; import './login/oauth'; import './login/password'; diff --git a/apps/meteor/client/meteorOverrides/login/linkedin.ts b/apps/meteor/client/meteorOverrides/login/linkedin.ts deleted file mode 100644 index a10b8182feec..000000000000 --- a/apps/meteor/client/meteorOverrides/login/linkedin.ts +++ /dev/null @@ -1,48 +0,0 @@ -import type { LinkedinOAuthConfiguration } from '@rocket.chat/core-typings'; -import { Random } from '@rocket.chat/random'; -import { Meteor } from 'meteor/meteor'; -import { OAuth } from 'meteor/oauth'; -import { Linkedin } from 'meteor/pauli:linkedin-oauth'; - -import type { LoginCallback } from '../../lib/2fa/overrideLoginMethod'; -import { overrideLoginMethod } from '../../lib/2fa/overrideLoginMethod'; -import { wrapRequestCredentialFn } from '../../lib/wrapRequestCredentialFn'; -import { createOAuthTotpLoginMethod } from './oauth'; - -declare module 'meteor/meteor' { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace Meteor { - function loginWithLinkedin(options?: Meteor.LoginWithExternalServiceOptions, callback?: LoginCallback): void; - } -} -const { loginWithLinkedin } = Meteor; -const loginWithLinkedinAndTOTP = createOAuthTotpLoginMethod(Linkedin); -Meteor.loginWithLinkedin = (options, callback) => { - overrideLoginMethod(loginWithLinkedin, [options], callback, loginWithLinkedinAndTOTP); -}; - -Linkedin.requestCredential = wrapRequestCredentialFn( - 'linkedin', - ({ options, credentialRequestCompleteCallback, config, loginStyle }) => { - const credentialToken = Random.secret(); - - const { requestPermissions } = options; - const scope = (requestPermissions || ['openid', 'email', 'profile']).join('+'); - - const loginUrl = `https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=${ - config.clientId - }&redirect_uri=${OAuth._redirectUri('linkedin', config)}&state=${OAuth._stateParam(loginStyle, credentialToken)}&scope=${scope}`; - - OAuth.launchLogin({ - credentialRequestCompleteCallback, - credentialToken, - loginService: 'linkedin', - loginStyle, - loginUrl, - popupOptions: { - width: 390, - height: 628, - }, - }); - }, -); diff --git a/apps/meteor/definition/externals/meteor/pauli-linkedin-oauth.d.ts b/apps/meteor/definition/externals/meteor/pauli-linkedin-oauth.d.ts deleted file mode 100644 index 14c313059710..000000000000 --- a/apps/meteor/definition/externals/meteor/pauli-linkedin-oauth.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module 'meteor/pauli:linkedin-oauth' { - export const Linkedin: any; -} diff --git a/apps/meteor/packages/accounts-linkedin/LICENSE b/apps/meteor/packages/accounts-linkedin/LICENSE deleted file mode 100644 index 5f9ee7d18b2b..000000000000 --- a/apps/meteor/packages/accounts-linkedin/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/apps/meteor/packages/accounts-linkedin/README.md b/apps/meteor/packages/accounts-linkedin/README.md deleted file mode 100644 index fcbb24f50ad0..000000000000 --- a/apps/meteor/packages/accounts-linkedin/README.md +++ /dev/null @@ -1,83 +0,0 @@ -meteor-accounts-linkedin -============================ - -A meteor package for LinkedIn's login service. - -### Important -BREAKING CHANGE LinkedIn -> Linkedin inside code from v5.0.0 - -v4.0.0 works with Meteor@1.6.1 & up - -From March 1, 2019 Linkedin will be using only V2 API [Docs](https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq?context=linkedin/consumer/context) - -Install ------------ -``` -meteor add pauli:accounts-linkedin -``` - -Usage ------------ - -Core principles are the same as native Meteor external services login, all available params are in [meteor documentation](https://docs.meteor.com/api/accounts.html#Meteor-loginWith). So if you using `{{> loginButtons}}`, it will just appear in the selection. - -For custom usage, available functions in **Client**: - - login: ``Meteor.loginWithLinkedin([options], [callback])`` - credential request:``Meteor.requestCredential([options], [callback])`` - -If you are not using any other external login service, you need to `metoer add service-configuration`, otherwise just config it in server folder: - -```js -ServiceConfiguration.configurations.upsert( - { service: 'linkedin' }, - { - $set: { - clientId: "XXXXXXX", // Client ID - secret: "XXXXXXX" // Client Secret - } - } -); -``` - -As basic Linkedin permission now only allows `r_emailaddress` and `r_liteprofile`, this package by default will return this fields to `user.profile` - -```js - linkedinId, // Specific user id for your application only - firstName:{ - localized:{ - en_US:'Tina' - }, - preferredLocale:{ - country:'US', - language:'en' - } - }, - lastName:{ - localized:{ - en_US:'Belcher' - }, - preferredLocale:{ - country:'US', - language:'en' - } - }, - profilePicture: { - displayImage, // URN media handle - identifiersUrl, // Array of links to all available identifiers - }, - email, // First email from received emails during authentication - emails, // Array of all received emails during authentication -``` - -If you want during login process to ask for more fields, you need to pass requestPermissions to options. -To change popup options: -```js -popupOptions = { width: XXX, height: XXX } -``` - -More info [Linkedin API](https://docs.microsoft.com/en-us/linkedin/consumer/) - -License ------------ -[MIT](https://github.com/PauliBuccini/meteor-accounts-linkedin/blob/master/LICENSE) diff --git a/apps/meteor/packages/accounts-linkedin/linkedin.js b/apps/meteor/packages/accounts-linkedin/linkedin.js deleted file mode 100644 index c4430c2e79c9..000000000000 --- a/apps/meteor/packages/accounts-linkedin/linkedin.js +++ /dev/null @@ -1,24 +0,0 @@ -import { Accounts } from 'meteor/accounts-base'; -import { Meteor } from 'meteor/meteor'; -import { Linkedin } from 'meteor/pauli:linkedin-oauth'; - -Accounts.oauth.registerService('linkedin'); - -if (Meteor.isClient) { - const loginWithLinkedin = function (options, callback) { - // support a callback without options - if (!callback && typeof options === 'function') { - callback = options; - options = null; - } - const credentialRequestCompleteCallback = Accounts.oauth.credentialRequestCompleteHandler(callback); - void Linkedin.requestCredential(options, credentialRequestCompleteCallback).catch(credentialRequestCompleteCallback); - }; - Accounts.registerClientLoginFunction('linkedin', loginWithLinkedin); - - Meteor.loginWithLinkedin = (...args) => Accounts.applyLoginFunction('linkedin', args); -} else { - Accounts.addAutopublishFields({ - forLoggedInUser: ['services.linkedin'], - }); -} diff --git a/apps/meteor/packages/accounts-linkedin/notice.js b/apps/meteor/packages/accounts-linkedin/notice.js deleted file mode 100644 index 4150dd68c679..000000000000 --- a/apps/meteor/packages/accounts-linkedin/notice.js +++ /dev/null @@ -1,10 +0,0 @@ -if (Package['accounts-ui'] && !Package['service-configuration'] && !Package.hasOwnProperty('pauli:linkedin-config-ui')) { - console.warn( - "Note: You're using accounts-ui and pauli:accounts-linkedin,\n" + - "but didn't install the configuration UI for the Linkedin\n" + - 'OAuth. You can install it with:\n' + - '\n' + - ' meteor add pauli:linkedin-config-ui' + - '\n', - ); -} diff --git a/apps/meteor/packages/accounts-linkedin/package.js b/apps/meteor/packages/accounts-linkedin/package.js deleted file mode 100644 index a3078932a0b2..000000000000 --- a/apps/meteor/packages/accounts-linkedin/package.js +++ /dev/null @@ -1,24 +0,0 @@ -Package.describe({ - name: 'pauli:accounts-linkedin', - summary: 'Login service for LinkedIn accounts, use with Meteor 1.6.1 & up', - version: '6.0.0', - git: 'https://github.com/PoBuchi/meteor-accounts-linkedin.git', -}); - -Package.onUse((api) => { - api.versionsFrom('2.5'); - api.use('ecmascript'); - api.use('accounts-base', ['client', 'server']); - api.imply('accounts-base', ['client', 'server']); - api.use('accounts-oauth', ['client', 'server']); - api.use('pauli:linkedin-oauth@6.0.0', ['client', 'server']); - api.imply('pauli:linkedin-oauth'); - - api.use('http', ['client', 'server']); - - // If users use accounts-ui but not linkedin-config-ui, give them a tip. - api.use(['accounts-ui', 'pauli:linkedin-config-ui@5.0.0'], ['client', 'server'], { weak: true }); - api.addFiles('notice.js'); - - api.addFiles('linkedin.js'); -}); From 2aa0c469cd4714b99cc74b30c19ee515d0512774 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Fri, 12 Jan 2024 11:42:33 -0300 Subject: [PATCH 02/18] bump METEOR@3.0.3 and node 20.15.1 --- .../workflows/ci-deploy-gh-pages-preview.yml | 2 +- .github/workflows/ci-deploy-gh-pages.yml | 2 +- .github/workflows/new-release.yml | 2 +- .github/workflows/pr-update-description.yml | 2 +- .github/workflows/publish-release.yml | 2 +- _templates/service/new/package.json.ejs.t | 1 - apps/meteor/.docker-mongo/Dockerfile | 2 +- apps/meteor/.docker/Dockerfile | 2 +- apps/meteor/.docker/Dockerfile.alpine | 4 +- apps/meteor/.meteor/packages | 66 ++++--- apps/meteor/.meteor/release | 2 +- apps/meteor/.meteor/versions | 175 +++++++++--------- .../authentication/server/startup/index.js | 6 +- .../app/file-upload/server/lib/proxy.ts | 17 +- apps/meteor/app/lib/server/lib/RateLimiter.js | 2 +- apps/meteor/app/livechat/server/livechat.ts | 2 +- apps/meteor/app/ui-master/server/index.js | 2 +- apps/meteor/ee/server/services/Dockerfile | 4 +- apps/meteor/ee/server/services/package.json | 1 - apps/meteor/package.json | 4 +- .../packages/autoupdate/autoupdate_client.js | 2 +- .../packages/autoupdate/autoupdate_server.js | 59 +++--- apps/meteor/packages/autoupdate/package.js | 3 +- .../.npm/package/npm-shrinkwrap.json | 31 ++-- .../meteor/packages/linkedin-oauth/package.js | 1 - .../packages/meteor-restivus/package.js | 3 - .../packages/meteor-user-presence/package.js | 2 - apps/meteor/server/services/meteor/service.ts | 19 +- ee/apps/account-service/Dockerfile | 2 +- ee/apps/account-service/package.json | 1 - ee/apps/authorization-service/Dockerfile | 2 +- ee/apps/authorization-service/package.json | 1 - ee/apps/ddp-streamer/Dockerfile | 2 +- ee/apps/ddp-streamer/package.json | 1 - ee/apps/omnichannel-transcript/Dockerfile | 2 +- ee/apps/omnichannel-transcript/package.json | 1 - ee/apps/presence-service/Dockerfile | 2 +- ee/apps/presence-service/package.json | 1 - ee/apps/queue-worker/Dockerfile | 2 +- ee/apps/queue-worker/package.json | 1 - ee/apps/stream-hub-service/Dockerfile | 2 +- ee/apps/stream-hub-service/package.json | 1 - ee/packages/omnichannel-services/package.json | 1 - package.json | 4 +- packages/core-services/package.json | 4 +- .../core-services/src/lib/ContextStore.ts | 22 --- .../src/lib/asyncLocalStorage.ts | 5 +- yarn.lock | 35 +--- 48 files changed, 217 insertions(+), 295 deletions(-) diff --git a/.github/workflows/ci-deploy-gh-pages-preview.yml b/.github/workflows/ci-deploy-gh-pages-preview.yml index 8a0905a174bb..736117610f8e 100644 --- a/.github/workflows/ci-deploy-gh-pages-preview.yml +++ b/.github/workflows/ci-deploy-gh-pages-preview.yml @@ -22,7 +22,7 @@ jobs: uses: ./.github/actions/setup-node if: github.event.action != 'closed' with: - node-version: 14.21.3 + node-version: 20.15.1 deno-version: 1.37.1 cache-modules: true install: true diff --git a/.github/workflows/ci-deploy-gh-pages.yml b/.github/workflows/ci-deploy-gh-pages.yml index 0aab8022c7e6..986fe50d72d9 100644 --- a/.github/workflows/ci-deploy-gh-pages.yml +++ b/.github/workflows/ci-deploy-gh-pages.yml @@ -17,7 +17,7 @@ jobs: - name: Setup NodeJS uses: ./.github/actions/setup-node with: - node-version: 14.21.3 + node-version: 20.15.1 deno-version: 1.37.1 cache-modules: true install: true diff --git a/.github/workflows/new-release.yml b/.github/workflows/new-release.yml index 70e9eb354a06..0483eac311b8 100644 --- a/.github/workflows/new-release.yml +++ b/.github/workflows/new-release.yml @@ -34,7 +34,7 @@ jobs: - name: Setup NodeJS uses: ./.github/actions/setup-node with: - node-version: 14.21.3 + node-version: 20.15.1 deno-version: 1.37.1 cache-modules: true install: true diff --git a/.github/workflows/pr-update-description.yml b/.github/workflows/pr-update-description.yml index 26ffffc6c86f..1e6985a0cff8 100644 --- a/.github/workflows/pr-update-description.yml +++ b/.github/workflows/pr-update-description.yml @@ -21,7 +21,7 @@ jobs: - name: Setup NodeJS uses: ./.github/actions/setup-node with: - node-version: 14.21.3 + node-version: 20.15.1 deno-version: 1.37.1 cache-modules: true install: true diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index fe049f6a8369..b52cac7dd40e 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -24,7 +24,7 @@ jobs: - name: Setup NodeJS uses: ./.github/actions/setup-node with: - node-version: 14.21.3 + node-version: 20.15.1 deno-version: 1.37.1 cache-modules: true install: true diff --git a/_templates/service/new/package.json.ejs.t b/_templates/service/new/package.json.ejs.t index 0aa1bd69e995..21b7348b4421 100644 --- a/_templates/service/new/package.json.ejs.t +++ b/_templates/service/new/package.json.ejs.t @@ -29,7 +29,6 @@ to: ee/apps/<%= name %>/package.json "@types/node": "^14.18.51", "ejson": "^2.2.3", "eventemitter3": "^4.0.7", - "fibers": "^5.0.3", "mem": "^8.1.1", "moleculer": "^0.14.29", "mongodb": "^4.12.1", diff --git a/apps/meteor/.docker-mongo/Dockerfile b/apps/meteor/.docker-mongo/Dockerfile index 037aadf4917f..074eb00ad761 100644 --- a/apps/meteor/.docker-mongo/Dockerfile +++ b/apps/meteor/.docker-mongo/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.21.3-bullseye-slim +FROM node:20.15.1-bullseye-slim LABEL maintainer="buildmaster@rocket.chat" diff --git a/apps/meteor/.docker/Dockerfile b/apps/meteor/.docker/Dockerfile index 75df2cb90678..f8acfc80f03e 100644 --- a/apps/meteor/.docker/Dockerfile +++ b/apps/meteor/.docker/Dockerfile @@ -2,7 +2,7 @@ ARG DENO_VERSION="1.37.1" FROM denoland/deno:bin-${DENO_VERSION} as deno -FROM node:14.21.3-bullseye-slim +FROM node:20.15.1-bullseye-slim LABEL maintainer="buildmaster@rocket.chat" diff --git a/apps/meteor/.docker/Dockerfile.alpine b/apps/meteor/.docker/Dockerfile.alpine index aaa2d2552ab3..ea606ec6dcfe 100644 --- a/apps/meteor/.docker/Dockerfile.alpine +++ b/apps/meteor/.docker/Dockerfile.alpine @@ -2,7 +2,7 @@ ARG DENO_VERSION="1.37.1" FROM denoland/deno:bin-${DENO_VERSION} as deno -FROM node:14.21.3-alpine3.16 +FROM node:20.15.1-alpine3.20 LABEL maintainer="buildmaster@rocket.chat" @@ -80,7 +80,7 @@ RUN set -x \ # End hack for sharp # Start hack for isolated-vm... && rm -rf npm/node_modules/isolated-vm \ - && npm install isolated-vm@4.4.2 \ + && npm install isolated-vm@4.6.0 \ && mv node_modules/isolated-vm npm/node_modules/isolated-vm \ # End hack for isolated-vm && cd /app/bundle/programs/server/npm \ diff --git a/apps/meteor/.meteor/packages b/apps/meteor/.meteor/packages index cad967285c53..70518d252df9 100644 --- a/apps/meteor/.meteor/packages +++ b/apps/meteor/.meteor/packages @@ -8,42 +8,40 @@ rocketchat:ddp rocketchat:mongo-config -rocketchat:oauth2-server rocketchat:restivus rocketchat:livechat rocketchat:streamer rocketchat:version rocketchat:user-presence -accounts-base@2.2.11 -accounts-facebook@1.3.3 -accounts-github@1.5.0 -accounts-google@1.4.0 -accounts-meteor-developer@1.5.0 -accounts-oauth@1.4.4 -accounts-password@2.4.0 -accounts-twitter@1.5.0 +accounts-base@3.0.2 +accounts-facebook@1.3.4 +accounts-github@1.5.1 +accounts-google@1.4.1 +accounts-meteor-developer@1.5.1 +accounts-oauth@1.4.5 +accounts-password@3.0.2 +accounts-twitter@1.5.2 google-oauth@1.4.5 oauth@3.0.0 oauth2@1.3.3 -check@1.4.1 -ddp-rate-limiter@1.2.1 -rate-limit@1.1.1 -email@2.2.6 -http@2.0.0 +check@1.4.2 +ddp-rate-limiter@1.2.2 +rate-limit@1.1.2 +email@3.1.0 -meteor-base@1.5.1 -ddp-common@1.4.1 -webapp@1.13.8 +meteor-base@1.5.2 +ddp-common@1.4.4 +webapp@2.0.1 -mongo@1.16.10 +mongo@2.0.2 -reload@1.3.1 -service-configuration@1.3.4 -session@1.2.1 -shell-server@0.5.0 +reload@1.3.2 +service-configuration@1.3.5 +session@1.2.2 +shell-server@0.6.0 dispatch:run-as-user ostrio:cookies @@ -52,22 +50,22 @@ kadira:flow-router meteorhacks:inject-initial -routepolicy@1.1.1 +routepolicy@1.1.2 -webapp-hashing@1.1.1 -facts-base@1.0.1 +webapp-hashing@1.1.2 +facts-base@1.0.2 -tracker@1.3.3 -reactive-dict@1.3.1 -reactive-var@1.0.12 +tracker@1.3.4 +reactive-dict@1.3.2 +reactive-var@1.0.13 -babel-compiler@7.10.5 -standard-minifier-css@1.9.2 -dynamic-import@0.7.3 -ecmascript@0.16.8 -typescript@4.9.5 +babel-compiler@7.11.0 +standard-minifier-css@1.9.3 +dynamic-import@0.7.4 +ecmascript@0.16.9 +typescript@5.4.3 -autoupdate@1.8.0 +autoupdate@2.0.0 # photoswipe diff --git a/apps/meteor/.meteor/release b/apps/meteor/.meteor/release index 5152abe9d582..c41cba9c61a2 100644 --- a/apps/meteor/.meteor/release +++ b/apps/meteor/.meteor/release @@ -1 +1 @@ -METEOR@2.16 +METEOR@3.0.3 diff --git a/apps/meteor/.meteor/versions b/apps/meteor/.meteor/versions index 416ae456f05b..c41710f5aa16 100644 --- a/apps/meteor/.meteor/versions +++ b/apps/meteor/.meteor/versions @@ -1,102 +1,97 @@ -accounts-base@2.2.11 -accounts-facebook@1.3.3 -accounts-github@1.5.0 -accounts-google@1.4.0 -accounts-meteor-developer@1.5.0 -accounts-oauth@1.4.4 -accounts-password@2.4.0 -accounts-twitter@1.5.0 -allow-deny@1.1.1 -autoupdate@1.8.0 -babel-compiler@7.10.5 -babel-runtime@1.5.1 -base64@1.0.12 -binary-heap@1.0.11 -boilerplate-generator@1.7.2 -caching-compiler@1.2.2 -callback-hook@1.5.1 -check@1.4.1 -coffeescript@2.7.0 -coffeescript-compiler@2.4.1 -ddp@1.4.1 -ddp-client@2.6.2 -ddp-common@1.4.1 -ddp-rate-limiter@1.2.1 -ddp-server@2.7.1 -diff-sequence@1.1.2 +accounts-base@3.0.2 +accounts-facebook@1.3.4 +accounts-github@1.5.1 +accounts-google@1.4.1 +accounts-meteor-developer@1.5.1 +accounts-oauth@1.4.5 +accounts-password@3.0.2 +accounts-twitter@1.5.2 +allow-deny@2.0.0 +autoupdate@2.0.0 +babel-compiler@7.11.0 +babel-runtime@1.5.2 +base64@1.0.13 +binary-heap@1.0.12 +boilerplate-generator@2.0.0 +callback-hook@1.6.0 +check@1.4.2 +core-runtime@1.0.0 +ddp@1.4.2 +ddp-client@3.0.1 +ddp-common@1.4.4 +ddp-rate-limiter@1.2.2 +ddp-server@3.0.1 +diff-sequence@1.1.3 dispatch:run-as-user@1.1.1 -dynamic-import@0.7.3 -ecmascript@0.16.8 -ecmascript-runtime@0.8.1 -ecmascript-runtime-client@0.12.1 -ecmascript-runtime-server@0.11.0 -ejson@1.1.3 -email@2.2.6 -es5-shim@4.8.0 -facebook-oauth@1.11.3 -facts-base@1.0.1 -fetch@0.1.4 -geojson-utils@1.0.11 -github-oauth@1.4.1 -google-oauth@1.4.4 -hot-code-push@1.0.4 -http@2.0.0 -id-map@1.1.1 -inter-process-messaging@0.1.1 +dynamic-import@0.7.4 +ecmascript@0.16.9 +ecmascript-runtime@0.8.2 +ecmascript-runtime-client@0.12.2 +ecmascript-runtime-server@0.11.1 +ejson@1.1.4 +email@3.1.0 +es5-shim@4.8.1 +facebook-oauth@1.11.4 +facts-base@1.0.2 +fetch@0.1.5 +geojson-utils@1.0.12 +github-oauth@1.4.2 +google-oauth@1.4.5 +hot-code-push@1.0.5 +http@1.4.4 +id-map@1.2.0 +inter-process-messaging@0.1.2 kadira:flow-router@2.12.1 -localstorage@1.2.0 -logging@1.3.4 -meteor@1.11.5 -meteor-base@1.5.1 -meteor-developer-oauth@1.3.2 +localstorage@1.2.1 +logging@1.3.5 +meteor@2.0.1 +meteor-base@1.5.2 +meteor-developer-oauth@1.3.3 meteorhacks:inject-initial@1.0.5 -minifier-css@1.6.4 -minimongo@1.9.4 -modern-browsers@0.1.10 -modules@0.20.0 -modules-runtime@0.13.1 -mongo@1.16.10 -mongo-decimal@0.1.3 -mongo-dev-server@1.1.0 -mongo-id@1.0.8 -npm-mongo@4.17.2 -oauth@2.2.1 -oauth1@1.5.1 -oauth2@1.3.2 -ordered-dict@1.1.0 +minifier-css@2.0.0 +minimongo@2.0.1 +modern-browsers@0.1.11 +modules@0.20.1 +modules-runtime@0.13.2 +mongo@2.0.2 +mongo-decimal@0.1.4-beta300.7 +mongo-dev-server@1.1.1 +mongo-id@1.0.9 +npm-mongo@4.17.4 +oauth@3.0.0 +oauth1@1.5.2 +oauth2@1.3.3 +ordered-dict@1.2.0 ostrio:cookies@2.7.2 -pauli:accounts-linkedin@6.0.0 -pauli:linkedin-oauth@6.0.0 -promise@0.12.2 -random@1.2.1 -rate-limit@1.1.1 -react-fast-refresh@0.2.8 -reactive-dict@1.3.1 -reactive-var@1.0.12 -reload@1.3.1 -retry@1.1.0 +promise@1.0.0 +random@1.2.2 +rate-limit@1.1.2 +react-fast-refresh@0.2.9 +reactive-dict@1.3.2 +reactive-var@1.0.13 +reload@1.3.2 +retry@1.1.1 rocketchat:ddp@0.0.1 rocketchat:livechat@0.0.1 rocketchat:mongo-config@0.0.1 -rocketchat:oauth2-server@3.0.0 rocketchat:restivus@1.1.0 rocketchat:streamer@1.1.0 rocketchat:user-presence@2.6.3 rocketchat:version@1.0.0 -routepolicy@1.1.1 -service-configuration@1.3.4 -session@1.2.1 -sha@1.0.9 -shell-server@0.5.0 -socket-stream-client@0.5.2 -standard-minifier-css@1.9.2 -tracker@1.3.3 -twitter-oauth@1.3.3 -typescript@4.9.5 -underscore@1.6.1 -url@1.3.2 -webapp@1.13.8 -webapp-hashing@1.1.1 +routepolicy@1.1.2 +service-configuration@1.3.5 +session@1.2.2 +sha@1.0.10 +shell-server@0.6.0 +socket-stream-client@0.5.3 +standard-minifier-css@1.9.3 +tracker@1.3.4 +twitter-oauth@1.3.4 +typescript@5.4.3 +underscore@1.6.4 +url@1.3.3 +webapp@2.0.1 +webapp-hashing@1.1.2 zodern:caching-minifier@0.5.0 -zodern:standard-minifier-js@5.3.1 -zodern:types@1.0.13 +zodern:standard-minifier-js@5.2.0 +zodern:types@1.0.10 diff --git a/apps/meteor/app/authentication/server/startup/index.js b/apps/meteor/app/authentication/server/startup/index.js index 2e4c599ce558..576ca4cc88c7 100644 --- a/apps/meteor/app/authentication/server/startup/index.js +++ b/apps/meteor/app/authentication/server/startup/index.js @@ -262,7 +262,7 @@ const onCreateUserAsync = async function (options, user = {}) { Accounts.onCreateUser(function (...args) { // Depends on meteor support for Async - return Promise.await(onCreateUserAsync.call(this, ...args)); + return onCreateUserAsync.call(this, ...args); }); const { insertUserDoc } = Accounts; @@ -370,7 +370,7 @@ const insertUserDocAsync = async function (options, user) { Accounts.insertUserDoc = function (...args) { // Depends on meteor support for Async - return Promise.await(insertUserDocAsync.call(this, ...args)); + return insertUserDocAsync.call(this, ...args); }; const validateLoginAttemptAsync = async function (login) { @@ -442,7 +442,7 @@ const validateLoginAttemptAsync = async function (login) { Accounts.validateLoginAttempt(function (...args) { // Depends on meteor support for Async - return Promise.await(validateLoginAttemptAsync.call(this, ...args)); + return validateLoginAttemptAsync.call(this, ...args); }); Accounts.validateNewUser((user) => { diff --git a/apps/meteor/app/file-upload/server/lib/proxy.ts b/apps/meteor/app/file-upload/server/lib/proxy.ts index 048424af4bd9..dd9e692f0f98 100644 --- a/apps/meteor/app/file-upload/server/lib/proxy.ts +++ b/apps/meteor/app/file-upload/server/lib/proxy.ts @@ -99,8 +99,15 @@ async function handle(req: createServer.IncomingMessage, res: http.ServerRespons }); } -WebApp.connectHandlers.stack.unshift({ - route: '', - // eslint-disable-next-line @typescript-eslint/no-misused-promises - handle, -}); +// @ts-expect-error - l +const dummyRouter = WebApp.connectHandlers._router; + +// Create a dummy route +dummyRouter.route('*'); +// fetch the newly created "layer" +const stackedRoute = dummyRouter.stack.pop(); +stackedRoute.handle = handle; + +// Move the layer to the top :) +// @ts-expect-error - l +WebApp.connectHandlers._router.stack.unshift(stackedRoute); diff --git a/apps/meteor/app/lib/server/lib/RateLimiter.js b/apps/meteor/app/lib/server/lib/RateLimiter.js index 126b236426da..e1986e49e81e 100644 --- a/apps/meteor/app/lib/server/lib/RateLimiter.js +++ b/apps/meteor/app/lib/server/lib/RateLimiter.js @@ -94,7 +94,7 @@ export const RateLimiterClass = new (class { name: methodName, }; Object.entries(matchers).forEach(([key, matcher]) => { - match[key] = (...args) => Promise.await(matcher(...args)); + match[key] = (...args) => matcher(...args); }); return DDPRateLimiter.addRule(match, numRequests, timeInterval); } diff --git a/apps/meteor/app/livechat/server/livechat.ts b/apps/meteor/app/livechat/server/livechat.ts index 795deaba3452..313b75ba193c 100644 --- a/apps/meteor/app/livechat/server/livechat.ts +++ b/apps/meteor/app/livechat/server/livechat.ts @@ -7,7 +7,7 @@ import { WebApp } from 'meteor/webapp'; import { settings } from '../../settings/server'; import { addServerUrlToIndex } from '../lib/Assets'; -const indexHtmlWithServerURL = addServerUrlToIndex((await Assets.getTextAsync('livechat/index.html')) || ''); +const indexHtmlWithServerURL = addServerUrlToIndex((await Assets.getText('livechat/index.html')) || ''); function parseExtraAttributes(widgetData: string): string { const liveChatAdditionalScripts = settings.get('Livechat_AdditionalWidgetScripts'); diff --git a/apps/meteor/app/ui-master/server/index.js b/apps/meteor/app/ui-master/server/index.js index 2d4f3cc7de56..1079faaeace2 100644 --- a/apps/meteor/app/ui-master/server/index.js +++ b/apps/meteor/app/ui-master/server/index.js @@ -160,4 +160,4 @@ injectIntoBody( `, ); -injectIntoBody('icons', await Assets.getTextAsync('public/icons.svg')); +injectIntoBody('icons', await Assets.getText('public/icons.svg')); diff --git a/apps/meteor/ee/server/services/Dockerfile b/apps/meteor/ee/server/services/Dockerfile index fa2abf88946a..a23437031d80 100644 --- a/apps/meteor/ee/server/services/Dockerfile +++ b/apps/meteor/ee/server/services/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.21.3 as build +FROM node:20.15.1 as build WORKDIR /app @@ -28,7 +28,7 @@ COPY ./tsconfig.base.json . RUN yarn workspace @rocket.chat/core-typings run build \ && yarn workspace @rocket.chat/rest-typings run build -FROM node:14.21.3-alpine +FROM node:20.15.1-alpine3.20 ARG SERVICE diff --git a/apps/meteor/ee/server/services/package.json b/apps/meteor/ee/server/services/package.json index 9eb2e917819d..2cac0fd8f03d 100644 --- a/apps/meteor/ee/server/services/package.json +++ b/apps/meteor/ee/server/services/package.json @@ -38,7 +38,6 @@ "ejson": "^2.2.3", "eventemitter3": "^4.0.7", "express": "^4.17.3", - "fibers": "^5.0.3", "jaeger-client": "^3.19.0", "mem": "^8.1.1", "moleculer": "^0.14.34", diff --git a/apps/meteor/package.json b/apps/meteor/package.json index 4ef81ecb6d5c..01f8abb6258e 100644 --- a/apps/meteor/package.json +++ b/apps/meteor/package.json @@ -108,7 +108,6 @@ "@types/ejson": "^2.2.2", "@types/express": "^4.17.21", "@types/express-rate-limit": "^5.1.3", - "@types/fibers": "^3.1.4", "@types/google-libphonenumber": "^7.4.30", "@types/gravatar": "^1.8.6", "@types/he": "^1.1.2", @@ -342,7 +341,6 @@ "express-rate-limit": "^5.5.1", "fastq": "^1.13.0", "fflate": "^0.7.4", - "fibers": "^5.0.3", "file-type": "^16.5.4", "filenamify": "^4.3.0", "filesize": "9.0.11", @@ -361,7 +359,7 @@ "imap": "^0.8.19", "ip-range-check": "^0.2.0", "is-svg": "^4.3.2", - "isolated-vm": "4.4.2", + "isolated-vm": "4.6.0", "jschardet": "^3.0.0", "jsdom": "^16.7.0", "jsrsasign": "^10.5.24", diff --git a/apps/meteor/packages/autoupdate/autoupdate_client.js b/apps/meteor/packages/autoupdate/autoupdate_client.js index f9613935dbba..dfd924c7f1cf 100644 --- a/apps/meteor/packages/autoupdate/autoupdate_client.js +++ b/apps/meteor/packages/autoupdate/autoupdate_client.js @@ -42,7 +42,7 @@ export const Autoupdate = {}; const clientVersions = (Autoupdate._clientVersions = // Used by a self-test and hot-module-replacement new ClientVersions()); -Meteor.connection.registerStore('meteor_autoupdate_clientVersions', clientVersions.createStore()); +Meteor.connection.registerStoreClient('meteor_autoupdate_clientVersions', clientVersions.createStore()); Autoupdate.newClientAvailable = function () { return clientVersions.newClientAvailable(clientArch, ['versionRefreshable', 'versionNonRefreshable'], autoupdateVersions); diff --git a/apps/meteor/packages/autoupdate/autoupdate_server.js b/apps/meteor/packages/autoupdate/autoupdate_server.js index 5ffbf92e82a6..27a02c43428b 100644 --- a/apps/meteor/packages/autoupdate/autoupdate_server.js +++ b/apps/meteor/packages/autoupdate/autoupdate_server.js @@ -26,7 +26,6 @@ // the document are the versions described above. import { ClientVersions } from './client_versions.js'; -var Future = Npm.require('fibers/future'); export const Autoupdate = (__meteor_runtime_config__.autoupdate = { // Map from client architectures (web.browser, web.browser.legacy, @@ -53,12 +52,12 @@ Autoupdate.autoupdateVersionRefreshable = null; Autoupdate.autoupdateVersionCordova = null; Autoupdate.appId = __meteor_runtime_config__.appId = process.env.APP_ID; -var syncQueue = new Meteor._SynchronousQueue(); +var syncQueue = new Meteor._AsynchronousQueue(); -function updateVersions(shouldReloadClientProgram) { +async function updateVersions(shouldReloadClientProgram) { // Step 1: load the current client program on the server if (shouldReloadClientProgram) { - WebAppInternals.reloadClientPrograms(); + await WebAppInternals.reloadClientPrograms(); } const { @@ -83,7 +82,7 @@ function updateVersions(shouldReloadClientProgram) { // Step 3: form the new client boilerplate which contains the updated // assets and __meteor_runtime_config__. if (shouldReloadClientProgram) { - WebAppInternals.generateBoilerplate(); + await WebAppInternals.generateBoilerplate(); } // Step 4: update the ClientVersions collection. @@ -129,8 +128,8 @@ Meteor.publish( { is_auto: true }, ); -Meteor.startup(function () { - updateVersions(false); +Meteor.startup(async function () { + await updateVersions(false); // Force any connected clients that are still looking for these older // document IDs to reload. @@ -141,36 +140,26 @@ Meteor.startup(function () { }); }); -var fut = new Future(); - -// We only want 'refresh' to trigger 'updateVersions' AFTER onListen, -// so we add a queued task that waits for onListen before 'refresh' can queue -// tasks. Note that the `onListening` callbacks do not fire until after -// Meteor.startup, so there is no concern that the 'updateVersions' calls from -// 'refresh' will overlap with the `updateVersions` call from Meteor.startup. - -syncQueue.queueTask(function () { - fut.wait(); -}); - -WebApp.onListening(function () { - fut.return(); -}); - function enqueueVersionsRefresh() { - syncQueue.queueTask(function () { - updateVersions(true); + syncQueue.queueTask(async function () { + await updateVersions(true); }); } -// Listen for messages pertaining to the client-refresh topic. -import { onMessage } from 'meteor/inter-process-messaging'; -onMessage('client-refresh', enqueueVersionsRefresh); +const setupListeners = () => { + // Listen for messages pertaining to the client-refresh topic. + import { onMessage } from 'meteor/inter-process-messaging'; + onMessage('client-refresh', enqueueVersionsRefresh); -// Another way to tell the process to refresh: send SIGHUP signal -process.on( - 'SIGHUP', - Meteor.bindEnvironment(function () { - enqueueVersionsRefresh(); - }, 'handling SIGHUP signal for refresh'), -); + // Another way to tell the process to refresh: send SIGHUP signal + process.on( + 'SIGHUP', + Meteor.bindEnvironment(function () { + enqueueVersionsRefresh(); + }, 'handling SIGHUP signal for refresh'), + ); +}; + +WebApp.onListening(function () { + Promise.resolve(setupListeners()); +}); diff --git a/apps/meteor/packages/autoupdate/package.js b/apps/meteor/packages/autoupdate/package.js index 52941121a9b6..2ac8f4947815 100644 --- a/apps/meteor/packages/autoupdate/package.js +++ b/apps/meteor/packages/autoupdate/package.js @@ -1,6 +1,7 @@ Package.describe({ + name: 'autoupdate', summary: 'Update the client when new client code is available', - version: '1.8.0', + version: '2.0.0', }); Package.onUse(function (api) { diff --git a/apps/meteor/packages/flow-router/.npm/package/npm-shrinkwrap.json b/apps/meteor/packages/flow-router/.npm/package/npm-shrinkwrap.json index 8110d45c9f30..51321bcb0a55 100644 --- a/apps/meteor/packages/flow-router/.npm/package/npm-shrinkwrap.json +++ b/apps/meteor/packages/flow-router/.npm/package/npm-shrinkwrap.json @@ -1,23 +1,20 @@ { - "lockfileVersion": 1, + "lockfileVersion": 4, "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==" + }, "page": { - "version": "https://github.com/kadirahq/page.js/archive/34ddf45ea8e4c37269ce3df456b44fc0efc595c6.tar.gz", - "integrity": "sha512-BGG5XDCSYGI4C/pGoYdGIIU1YpEYdCYN2HxwuKpYLgIDdT+tlqRs4IOQTJLTRnXKbt9r07Cucj0Y6fTGZcYizw==", - "dependencies": { - "path-to-regexp": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.2.1.tgz", - "integrity": "sha512-DBw9IhWfevR2zCVwEZURTuQNseCvu/Q9f5ZgqMCK0Rh61bDa4uyjPAOy9b55yKiPT59zZn+7uYKxmWwsguInwg==", - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==" - } - } - } - } + "version": "1.6.4", + "resolved": "https://github.com/kadirahq/page.js/archive/34ddf45ea8e4c37269ce3df456b44fc0efc595c6.tar.gz", + "integrity": "sha512-BGG5XDCSYGI4C/pGoYdGIIU1YpEYdCYN2HxwuKpYLgIDdT+tlqRs4IOQTJLTRnXKbt9r07Cucj0Y6fTGZcYizw==" + }, + "path-to-regexp": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.2.1.tgz", + "integrity": "sha512-DBw9IhWfevR2zCVwEZURTuQNseCvu/Q9f5ZgqMCK0Rh61bDa4uyjPAOy9b55yKiPT59zZn+7uYKxmWwsguInwg==" }, "qs": { "version": "5.2.0", diff --git a/apps/meteor/packages/linkedin-oauth/package.js b/apps/meteor/packages/linkedin-oauth/package.js index 314734066248..ed7b37ae1cd4 100644 --- a/apps/meteor/packages/linkedin-oauth/package.js +++ b/apps/meteor/packages/linkedin-oauth/package.js @@ -7,7 +7,6 @@ Package.describe({ }); Package.onUse((api) => { - api.versionsFrom('2.5'); api.use('ecmascript'); api.use('oauth2', ['client', 'server']); api.use('oauth', ['client', 'server']); diff --git a/apps/meteor/packages/meteor-restivus/package.js b/apps/meteor/packages/meteor-restivus/package.js index e6e433d866b3..1f2856270ea9 100644 --- a/apps/meteor/packages/meteor-restivus/package.js +++ b/apps/meteor/packages/meteor-restivus/package.js @@ -6,9 +6,6 @@ Package.describe({ }); Package.onUse(function (api) { - // Minimum Meteor version - api.versionsFrom('2.5'); - // Meteor dependencies api.use('check'); api.use('webapp'); diff --git a/apps/meteor/packages/meteor-user-presence/package.js b/apps/meteor/packages/meteor-user-presence/package.js index 96950704caa7..700c67cdf737 100644 --- a/apps/meteor/packages/meteor-user-presence/package.js +++ b/apps/meteor/packages/meteor-user-presence/package.js @@ -6,8 +6,6 @@ Package.describe({ }); Package.onUse(function (api) { - api.versionsFrom('1.0.2.1'); - api.use('tracker'); api.use('check'); api.use('ecmascript'); diff --git a/apps/meteor/server/services/meteor/service.ts b/apps/meteor/server/services/meteor/service.ts index 2ed97981c842..075807ac31da 100644 --- a/apps/meteor/server/services/meteor/service.ts +++ b/apps/meteor/server/services/meteor/service.ts @@ -37,7 +37,7 @@ if (disableOplog) { // Overrides the native observe changes to prevent database polling and stores the callbacks // for the users' tokens to re-implement the reactivity based on our database listeners const { mongo } = MongoInternals.defaultRemoteCollectionDriver(); - MongoInternals.Connection.prototype._observeChanges = function ( + MongoInternals.Connection.prototype._observeChanges = async function ( { collectionName, selector, @@ -52,19 +52,18 @@ if (disableOplog) { }, _ordered: boolean, callbacks: Callbacks, - ): any { + ): Promise { // console.error('Connection.Collection.prototype._observeChanges', collectionName, selector, options); let cbs: Set<{ hashedToken: string; callbacks: Callbacks }>; let data: { hashedToken: string; callbacks: Callbacks }; if (callbacks?.added) { - const records = Promise.await( - mongo - .rawCollection(collectionName) - .find(selector, { - ...(options.projection || options.fields ? { projection: options.projection || options.fields } : {}), - }) - .toArray(), - ); + const records = await mongo + .rawCollection(collectionName) + .find(selector, { + ...(options.projection || options.fields ? { projection: options.projection || options.fields } : {}), + }) + .toArray(); + for (const { _id, ...fields } of records) { callbacks.added(String(_id), fields); } diff --git a/ee/apps/account-service/Dockerfile b/ee/apps/account-service/Dockerfile index a97290a43394..d30ad723b1e4 100644 --- a/ee/apps/account-service/Dockerfile +++ b/ee/apps/account-service/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.21.3-alpine +FROM node:20.15.1-alpine3.20 ARG SERVICE diff --git a/ee/apps/account-service/package.json b/ee/apps/account-service/package.json index 755327bfd874..31207fa71a58 100644 --- a/ee/apps/account-service/package.json +++ b/ee/apps/account-service/package.json @@ -29,7 +29,6 @@ "ejson": "^2.2.3", "event-loop-stats": "^1.4.1", "eventemitter3": "^4.0.7", - "fibers": "^5.0.3", "gc-stats": "^1.4.1", "mem": "^8.1.1", "moleculer": "^0.14.34", diff --git a/ee/apps/authorization-service/Dockerfile b/ee/apps/authorization-service/Dockerfile index 9ddeadd380fe..af71523045ad 100644 --- a/ee/apps/authorization-service/Dockerfile +++ b/ee/apps/authorization-service/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.21.3-alpine +FROM node:20.15.1-alpine3.20 ARG SERVICE diff --git a/ee/apps/authorization-service/package.json b/ee/apps/authorization-service/package.json index e9de2c4acd74..41de712c9fbd 100644 --- a/ee/apps/authorization-service/package.json +++ b/ee/apps/authorization-service/package.json @@ -27,7 +27,6 @@ "ejson": "^2.2.3", "event-loop-stats": "^1.4.1", "eventemitter3": "^4.0.7", - "fibers": "^5.0.3", "gc-stats": "^1.4.1", "mem": "^8.1.1", "moleculer": "^0.14.34", diff --git a/ee/apps/ddp-streamer/Dockerfile b/ee/apps/ddp-streamer/Dockerfile index dea2bc3790a1..7e115f154fea 100644 --- a/ee/apps/ddp-streamer/Dockerfile +++ b/ee/apps/ddp-streamer/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.21.3-alpine +FROM node:20.15.1-alpine3.20 ARG SERVICE diff --git a/ee/apps/ddp-streamer/package.json b/ee/apps/ddp-streamer/package.json index f250b9e33106..ff22893e8d48 100644 --- a/ee/apps/ddp-streamer/package.json +++ b/ee/apps/ddp-streamer/package.json @@ -29,7 +29,6 @@ "ejson": "^2.2.3", "event-loop-stats": "^1.4.1", "eventemitter3": "^4.0.7", - "fibers": "^5.0.3", "gc-stats": "^1.4.1", "jaeger-client": "^3.19.0", "mem": "^8.1.1", diff --git a/ee/apps/omnichannel-transcript/Dockerfile b/ee/apps/omnichannel-transcript/Dockerfile index 0f18534e1453..53d14b2f3063 100644 --- a/ee/apps/omnichannel-transcript/Dockerfile +++ b/ee/apps/omnichannel-transcript/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.21.3-alpine +FROM node:20.15.1-alpine3.20 ARG SERVICE diff --git a/ee/apps/omnichannel-transcript/package.json b/ee/apps/omnichannel-transcript/package.json index 4094ada4ef18..673d822c55fc 100644 --- a/ee/apps/omnichannel-transcript/package.json +++ b/ee/apps/omnichannel-transcript/package.json @@ -31,7 +31,6 @@ "emoji-toolkit": "^7.0.1", "event-loop-stats": "^1.4.1", "eventemitter3": "^4.0.7", - "fibers": "^5.0.3", "gc-stats": "^1.4.1", "mem": "^8.1.1", "moleculer": "^0.14.34", diff --git a/ee/apps/presence-service/Dockerfile b/ee/apps/presence-service/Dockerfile index 78c6a98f809a..cbabfcaf7079 100644 --- a/ee/apps/presence-service/Dockerfile +++ b/ee/apps/presence-service/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.21.3-alpine +FROM node:20.15.1-alpine3.20 ARG SERVICE diff --git a/ee/apps/presence-service/package.json b/ee/apps/presence-service/package.json index 736fffd09e49..560687aa4063 100644 --- a/ee/apps/presence-service/package.json +++ b/ee/apps/presence-service/package.json @@ -27,7 +27,6 @@ "ejson": "^2.2.3", "event-loop-stats": "^1.4.1", "eventemitter3": "^4.0.7", - "fibers": "^5.0.3", "gc-stats": "^1.4.1", "mem": "^8.1.1", "moleculer": "^0.14.34", diff --git a/ee/apps/queue-worker/Dockerfile b/ee/apps/queue-worker/Dockerfile index 0f18534e1453..53d14b2f3063 100644 --- a/ee/apps/queue-worker/Dockerfile +++ b/ee/apps/queue-worker/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.21.3-alpine +FROM node:20.15.1-alpine3.20 ARG SERVICE diff --git a/ee/apps/queue-worker/package.json b/ee/apps/queue-worker/package.json index 6712d59bba5e..22841c8b635a 100644 --- a/ee/apps/queue-worker/package.json +++ b/ee/apps/queue-worker/package.json @@ -29,7 +29,6 @@ "emoji-toolkit": "^7.0.1", "event-loop-stats": "^1.4.1", "eventemitter3": "^4.0.7", - "fibers": "^5.0.3", "gc-stats": "^1.4.1", "mem": "^8.1.1", "moleculer": "^0.14.34", diff --git a/ee/apps/stream-hub-service/Dockerfile b/ee/apps/stream-hub-service/Dockerfile index 9ddeadd380fe..af71523045ad 100644 --- a/ee/apps/stream-hub-service/Dockerfile +++ b/ee/apps/stream-hub-service/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.21.3-alpine +FROM node:20.15.1-alpine3.20 ARG SERVICE diff --git a/ee/apps/stream-hub-service/package.json b/ee/apps/stream-hub-service/package.json index 4858d24d9611..03a0878f0324 100644 --- a/ee/apps/stream-hub-service/package.json +++ b/ee/apps/stream-hub-service/package.json @@ -27,7 +27,6 @@ "ejson": "^2.2.3", "event-loop-stats": "^1.4.1", "eventemitter3": "^4.0.7", - "fibers": "^5.0.3", "gc-stats": "^1.4.1", "mem": "^8.1.1", "moleculer": "^0.14.34", diff --git a/ee/packages/omnichannel-services/package.json b/ee/packages/omnichannel-services/package.json index 98f507325586..40248add477a 100644 --- a/ee/packages/omnichannel-services/package.json +++ b/ee/packages/omnichannel-services/package.json @@ -26,7 +26,6 @@ "ejson": "^2.2.3", "emoji-toolkit": "^7.0.1", "eventemitter3": "^4.0.7", - "fibers": "^5.0.3", "mem": "^8.1.1", "moment-timezone": "^0.5.45", "mongo-message-queue": "^1.0.0", diff --git a/package.json b/package.json index 7323f2d07f54..0dda76229d08 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "homepage": "https://github.com/RocketChat/Rocket.Chat#readme", "engines": { "yarn": "3.5.0", - "node": "14.21.3", + "node": "20.15.1", "npm": "Use yarn instead" }, "packageManager": "yarn@3.5.0", @@ -54,7 +54,7 @@ ] }, "volta": { - "node": "14.21.3", + "node": "20.15.1", "yarn": "1.22.18" }, "resolutions": { diff --git a/packages/core-services/package.json b/packages/core-services/package.json index 77277f6a4b87..fb2db9691b29 100644 --- a/packages/core-services/package.json +++ b/packages/core-services/package.json @@ -38,8 +38,6 @@ "@rocket.chat/message-parser": "workspace:^", "@rocket.chat/models": "workspace:^", "@rocket.chat/rest-typings": "workspace:^", - "@rocket.chat/ui-kit": "workspace:~", - "@types/fibers": "^3.1.4", - "fibers": "^5.0.3" + "@rocket.chat/ui-kit": "workspace:~" } } diff --git a/packages/core-services/src/lib/ContextStore.ts b/packages/core-services/src/lib/ContextStore.ts index a886e537df39..f04cb2f27561 100644 --- a/packages/core-services/src/lib/ContextStore.ts +++ b/packages/core-services/src/lib/ContextStore.ts @@ -1,7 +1,5 @@ import { AsyncLocalStorage } from 'async_hooks'; -import Fiber from 'fibers'; - interface IContextStore { getStore(): T | undefined; run(store: T, callback: (...args: any) => void, ...args: any): void; @@ -9,23 +7,3 @@ interface IContextStore { // This is the default implementation of the context store but there is a bug on Meteor 2.5 that prevents us from using it export class AsyncContextStore extends AsyncLocalStorage implements IContextStore {} - -export class FibersContextStore implements IContextStore { - getStore(): T | undefined { - return Fiber.current as unknown as T; - } - - run(store: T, callback: (...args: any) => void, ...args: any): void { - // eslint-disable-next-line new-cap - return Fiber((...rest: any) => { - const fiber = Fiber.current as Record; - for (const key in store) { - if (store.hasOwnProperty(key)) { - fiber[key] = store[key]; - } - } - - Fiber.yield(callback(...rest)); - }).run(...args); - } -} diff --git a/packages/core-services/src/lib/asyncLocalStorage.ts b/packages/core-services/src/lib/asyncLocalStorage.ts index 04352e99f95b..cec53d979e97 100644 --- a/packages/core-services/src/lib/asyncLocalStorage.ts +++ b/packages/core-services/src/lib/asyncLocalStorage.ts @@ -1,5 +1,4 @@ import type { IServiceContext } from '../types/ServiceClass'; -import { FibersContextStore } from './ContextStore'; +import { AsyncContextStore } from './ContextStore'; -// TODO Evalute again using AsyncContextStore instead of FibersContextStore in a future Meteor release (after 2.5) -export const asyncLocalStorage = new FibersContextStore(); +export const asyncLocalStorage = new AsyncContextStore(); diff --git a/yarn.lock b/yarn.lock index 7f181db83005..6c64513af6a8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8590,7 +8590,6 @@ __metadata: eslint: ~8.45.0 event-loop-stats: ^1.4.1 eventemitter3: ^4.0.7 - fibers: ^5.0.3 gc-stats: ^1.4.1 mem: ^8.1.1 moleculer: ^0.14.34 @@ -8725,7 +8724,6 @@ __metadata: eslint: ~8.45.0 event-loop-stats: ^1.4.1 eventemitter3: ^4.0.7 - fibers: ^5.0.3 gc-stats: ^1.4.1 mem: ^8.1.1 moleculer: ^0.14.34 @@ -8780,11 +8778,9 @@ __metadata: "@rocket.chat/models": "workspace:^" "@rocket.chat/rest-typings": "workspace:^" "@rocket.chat/ui-kit": "workspace:~" - "@types/fibers": ^3.1.4 "@types/jest": ~29.5.13 babel-jest: ^29.5.0 eslint: ~8.45.0 - fibers: ^5.0.3 jest: ~29.7.0 mongodb: ^4.17.2 prettier: ~2.8.8 @@ -8895,7 +8891,6 @@ __metadata: eslint: ~8.45.0 event-loop-stats: ^1.4.1 eventemitter3: ^4.0.7 - fibers: ^5.0.3 gc-stats: ^1.4.1 jaeger-client: ^3.19.0 mem: ^8.1.1 @@ -9629,7 +9624,6 @@ __metadata: "@types/ejson": ^2.2.2 "@types/express": ^4.17.21 "@types/express-rate-limit": ^5.1.3 - "@types/fibers": ^3.1.4 "@types/google-libphonenumber": ^7.4.30 "@types/gravatar": ^1.8.6 "@types/he": ^1.1.2 @@ -9755,7 +9749,6 @@ __metadata: fast-glob: ^3.2.12 fastq: ^1.13.0 fflate: ^0.7.4 - fibers: ^5.0.3 file-type: ^16.5.4 filenamify: ^4.3.0 filesize: 9.0.11 @@ -9775,7 +9768,7 @@ __metadata: imap: ^0.8.19 ip-range-check: ^0.2.0 is-svg: ^4.3.2 - isolated-vm: 4.4.2 + isolated-vm: 4.6.0 jest: ~29.7.0 jschardet: ^3.0.0 jsdom: ^16.7.0 @@ -9993,7 +9986,6 @@ __metadata: emoji-toolkit: ^7.0.1 eslint: ~8.45.0 eventemitter3: ^4.0.7 - fibers: ^5.0.3 jest: ~29.7.0 mem: ^8.1.1 moment-timezone: ^0.5.45 @@ -10028,7 +10020,6 @@ __metadata: eslint: ~8.45.0 event-loop-stats: ^1.4.1 eventemitter3: ^4.0.7 - fibers: ^5.0.3 gc-stats: ^1.4.1 mem: ^8.1.1 moleculer: ^0.14.34 @@ -10164,7 +10155,6 @@ __metadata: eslint: ~8.45.0 event-loop-stats: ^1.4.1 eventemitter3: ^4.0.7 - fibers: ^5.0.3 gc-stats: ^1.4.1 mem: ^8.1.1 moleculer: ^0.14.34 @@ -10230,7 +10220,6 @@ __metadata: eslint: ~8.45.0 event-loop-stats: ^1.4.1 eventemitter3: ^4.0.7 - fibers: ^5.0.3 gc-stats: ^1.4.1 mem: ^8.1.1 moleculer: ^0.14.34 @@ -10389,7 +10378,6 @@ __metadata: eslint: ~8.45.0 event-loop-stats: ^1.4.1 eventemitter3: ^4.0.7 - fibers: ^5.0.3 gc-stats: ^1.4.1 mem: ^8.1.1 moleculer: ^0.14.34 @@ -21899,7 +21887,7 @@ __metadata: languageName: node linkType: hard -"detect-libc@npm:^1.0.2, detect-libc@npm:^1.0.3": +"detect-libc@npm:^1.0.2": version: 1.0.3 resolution: "detect-libc@npm:1.0.3" bin: @@ -24421,15 +24409,6 @@ __metadata: languageName: node linkType: hard -"fibers@npm:^5.0.3": - version: 5.0.3 - resolution: "fibers@npm:5.0.3" - dependencies: - detect-libc: ^1.0.3 - checksum: d66c5e18a911aab3480b846e1c837e5c7cfacb27a2a5fe512919865eaecef33cdd4abc14d777191a6a93473dc52356d48549c91a2a7b8b3450544c44104b23f3 - languageName: node - linkType: hard - "figgy-pudding@npm:^3.5.1": version: 3.5.2 resolution: "figgy-pudding@npm:3.5.2" @@ -28670,12 +28649,13 @@ __metadata: languageName: node linkType: hard -"isolated-vm@npm:4.4.2": - version: 4.4.2 - resolution: "isolated-vm@npm:4.4.2" +"isolated-vm@npm:4.6.0": + version: 4.6.0 + resolution: "isolated-vm@npm:4.6.0" dependencies: node-gyp: latest - checksum: 86d12d96f90ceef74a3fc096439c71b0c115235ae3053d600eb8f7c678443d9ca3c8a2805dcd7f97463d11eb7d2e667868946b90e377a3e6d50fdd4085506fbc + prebuild-install: ^7.1.1 + checksum: 011853d46bc934751012f5c1ed3eaba43dc4bd274672e59ff8e4c7eb0df668c93f3e0b91e3b4e812d2b8476c9ace218f34e7a3188b08b343409370e70044a874 languageName: node linkType: hard @@ -38314,7 +38294,6 @@ __metadata: ejson: ^2.2.3 eventemitter3: ^4.0.7 express: ^4.17.3 - fibers: ^5.0.3 jaeger-client: ^3.19.0 mem: ^8.1.1 moleculer: ^0.14.34 From 6f44faa6cd942171ed8e4a628c5a911243ab6109 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Fri, 12 Jan 2024 12:37:27 -0300 Subject: [PATCH 03/18] change accounts to async api --- apps/meteor/app/authentication/server/startup/index.js | 10 +++------- .../app/custom-oauth/server/custom_oauth_server.js | 7 ++----- apps/meteor/app/livechat/server/livechat.ts | 2 +- .../meteor/app/meteor-accounts-saml/server/lib/SAML.ts | 2 +- apps/meteor/app/ui-master/server/index.js | 2 +- apps/meteor/server/configuration/accounts_meld.js | 8 +------- apps/meteor/server/lib/cas/createNewUser.ts | 2 +- apps/meteor/server/methods/registerUser.ts | 6 +++--- apps/meteor/server/startup/initialData.js | 2 +- 9 files changed, 14 insertions(+), 27 deletions(-) diff --git a/apps/meteor/app/authentication/server/startup/index.js b/apps/meteor/app/authentication/server/startup/index.js index 576ca4cc88c7..10ba3fd44154 100644 --- a/apps/meteor/app/authentication/server/startup/index.js +++ b/apps/meteor/app/authentication/server/startup/index.js @@ -266,7 +266,8 @@ Accounts.onCreateUser(function (...args) { }); const { insertUserDoc } = Accounts; -const insertUserDocAsync = async function (options, user) { + +Accounts.insertUserDoc = async function (options, user) { const globalRoles = new Set(); if (Match.test(options.globalRoles, [String]) && options.globalRoles.length > 0) { @@ -307,7 +308,7 @@ const insertUserDocAsync = async function (options, user) { user.roles = []; } - const _id = insertUserDoc.call(Accounts, options, user); + const _id = await insertUserDoc.call(Accounts, options, user); user = await Users.findOne({ _id, @@ -368,11 +369,6 @@ const insertUserDocAsync = async function (options, user) { return _id; }; -Accounts.insertUserDoc = function (...args) { - // Depends on meteor support for Async - return insertUserDocAsync.call(this, ...args); -}; - const validateLoginAttemptAsync = async function (login) { login = await callbacks.run('beforeValidateLogin', login); diff --git a/apps/meteor/app/custom-oauth/server/custom_oauth_server.js b/apps/meteor/app/custom-oauth/server/custom_oauth_server.js index 16407bf134de..a546a7c527eb 100644 --- a/apps/meteor/app/custom-oauth/server/custom_oauth_server.js +++ b/apps/meteor/app/custom-oauth/server/custom_oauth_server.js @@ -437,7 +437,8 @@ export class CustomOAuth { } const { updateOrCreateUserFromExternalService } = Accounts; -const updateOrCreateUserFromExternalServiceAsync = async function (...args /* serviceName, serviceData, options*/) { + +Accounts.updateOrCreateUserFromExternalService = async function (...args /* serviceName, serviceData, options*/) { for await (const hook of BeforeUpdateOrCreateUserFromExternalService) { await hook.apply(this, args); } @@ -458,7 +459,3 @@ const updateOrCreateUserFromExternalServiceAsync = async function (...args /* se return user; }; - -Accounts.updateOrCreateUserFromExternalService = function (...args /* serviceName, serviceData, options*/) { - return Promise.await(updateOrCreateUserFromExternalServiceAsync.call(this, ...args)); -}; diff --git a/apps/meteor/app/livechat/server/livechat.ts b/apps/meteor/app/livechat/server/livechat.ts index 313b75ba193c..795deaba3452 100644 --- a/apps/meteor/app/livechat/server/livechat.ts +++ b/apps/meteor/app/livechat/server/livechat.ts @@ -7,7 +7,7 @@ import { WebApp } from 'meteor/webapp'; import { settings } from '../../settings/server'; import { addServerUrlToIndex } from '../lib/Assets'; -const indexHtmlWithServerURL = addServerUrlToIndex((await Assets.getText('livechat/index.html')) || ''); +const indexHtmlWithServerURL = addServerUrlToIndex((await Assets.getTextAsync('livechat/index.html')) || ''); function parseExtraAttributes(widgetData: string): string { const liveChatAdditionalScripts = settings.get('Livechat_AdditionalWidgetScripts'); diff --git a/apps/meteor/app/meteor-accounts-saml/server/lib/SAML.ts b/apps/meteor/app/meteor-accounts-saml/server/lib/SAML.ts index 6e68518ef31c..be9bef0f2e7a 100644 --- a/apps/meteor/app/meteor-accounts-saml/server/lib/SAML.ts +++ b/apps/meteor/app/meteor-accounts-saml/server/lib/SAML.ts @@ -163,7 +163,7 @@ export class SAML { } } - const userId = Accounts.insertUserDoc({}, newUser); + const userId = await Accounts.insertUserDoc({}, newUser); user = await Users.findOneById(userId); if (user && userObject.channels && channelsAttributeUpdate !== true) { diff --git a/apps/meteor/app/ui-master/server/index.js b/apps/meteor/app/ui-master/server/index.js index 1079faaeace2..2d4f3cc7de56 100644 --- a/apps/meteor/app/ui-master/server/index.js +++ b/apps/meteor/app/ui-master/server/index.js @@ -160,4 +160,4 @@ injectIntoBody( `, ); -injectIntoBody('icons', await Assets.getText('public/icons.svg')); +injectIntoBody('icons', await Assets.getTextAsync('public/icons.svg')); diff --git a/apps/meteor/server/configuration/accounts_meld.js b/apps/meteor/server/configuration/accounts_meld.js index 64d8a4eeb109..037150def37e 100644 --- a/apps/meteor/server/configuration/accounts_meld.js +++ b/apps/meteor/server/configuration/accounts_meld.js @@ -4,8 +4,7 @@ import _ from 'underscore'; export async function configureAccounts() { const orig_updateOrCreateUserFromExternalService = Accounts.updateOrCreateUserFromExternalService; - - const updateOrCreateUserFromExternalServiceAsync = async function (serviceName, serviceData = {}, ...args /* , options*/) { + Accounts.updateOrCreateUserFromExternalService = async function (serviceName, serviceData = {}, ...args /* , options*/) { const services = ['facebook', 'github', 'gitlab', 'google', 'meteor-developer', 'linkedin', 'twitter', 'apple']; if (services.includes(serviceName) === false && serviceData._OAuthCustom !== true) { @@ -46,9 +45,4 @@ export async function configureAccounts() { return orig_updateOrCreateUserFromExternalService.apply(this, [serviceName, serviceData, ...args]); }; - - Accounts.updateOrCreateUserFromExternalService = function (...args) { - // Depends on meteor support for Async - return Promise.await(updateOrCreateUserFromExternalServiceAsync.call(this, ...args)); - }; } diff --git a/apps/meteor/server/lib/cas/createNewUser.ts b/apps/meteor/server/lib/cas/createNewUser.ts index d04fa2d22497..ebb4143b53be 100644 --- a/apps/meteor/server/lib/cas/createNewUser.ts +++ b/apps/meteor/server/lib/cas/createNewUser.ts @@ -36,7 +36,7 @@ export const createNewUser = async (username: string, { attributes, casVersion, // Create the user logger.debug(`User "${username}" does not exist yet, creating it`); - const userId = Accounts.insertUserDoc({}, newUser); + const userId = await Accounts.insertUserDoc({}, newUser); // Fetch and use it const user = await Users.findOneById(userId); diff --git a/apps/meteor/server/methods/registerUser.ts b/apps/meteor/server/methods/registerUser.ts index 09e44c5e1b82..178061aafa60 100644 --- a/apps/meteor/server/methods/registerUser.ts +++ b/apps/meteor/server/methods/registerUser.ts @@ -33,7 +33,7 @@ Meteor.methods({ const AllowAnonymousWrite = settings.get('Accounts_AllowAnonymousWrite'); const manuallyApproveNewUsers = settings.get('Accounts_ManuallyApproveNewUsers'); if (AllowAnonymousRead === true && AllowAnonymousWrite === true && !formData.email) { - const userId = Accounts.insertUserDoc( + const userId = await Accounts.insertUserDoc( {}, { globalRoles: ['anonymous'], @@ -41,9 +41,9 @@ Meteor.methods({ }, ); - const stampedLoginToken = Accounts._generateStampedLoginToken(); + const stampedLoginToken = await Accounts._generateStampedLoginToken(); - Accounts._insertLoginToken(userId, stampedLoginToken); + await Accounts._insertLoginToken(userId, stampedLoginToken); return stampedLoginToken; } check( diff --git a/apps/meteor/server/startup/initialData.js b/apps/meteor/server/startup/initialData.js index cefed3eef922..f4570093294d 100644 --- a/apps/meteor/server/startup/initialData.js +++ b/apps/meteor/server/startup/initialData.js @@ -146,7 +146,7 @@ Meteor.startup(async () => { await addUserRolesAsync('rocket.cat', ['bot']); - const buffer = Buffer.from(await Assets.getBinaryAsync('avatars/rocketcat.png')); + const buffer = Buffer.from(await Assets.getBinary('avatars/rocketcat.png')); const rs = RocketChatFile.bufferToStream(buffer, 'utf8'); const fileStore = FileUpload.getStore('Avatars'); From 322dde8277afede8faa4e5810cc797a31429ff9f Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Tue, 16 Jan 2024 18:12:12 -0300 Subject: [PATCH 04/18] Remove Promise.await missing --- apps/meteor/app/lib/server/lib/interceptDirectReplyEmails.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/app/lib/server/lib/interceptDirectReplyEmails.js b/apps/meteor/app/lib/server/lib/interceptDirectReplyEmails.js index 41a704d5afb6..f9af0911bcc6 100644 --- a/apps/meteor/app/lib/server/lib/interceptDirectReplyEmails.js +++ b/apps/meteor/app/lib/server/lib/interceptDirectReplyEmails.js @@ -21,7 +21,7 @@ export class DirectReplyIMAPInterceptor extends IMAPInterceptor { super(imapConfig, options); - this.on('email', (email) => Promise.await(processDirectEmail(email))); + this.on('email', (email) => processDirectEmail(email)); } } From 78dfa840ef4d3c574bfeb8976cb4abee8cfcfd3e Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Tue, 23 Jan 2024 15:05:27 -0300 Subject: [PATCH 05/18] fix: Missing plural keys on file ca.i18n --- packages/i18n/src/locales/ca.i18n.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/i18n/src/locales/ca.i18n.json b/packages/i18n/src/locales/ca.i18n.json index 6af75d34a44e..3e44112a6aa5 100644 --- a/packages/i18n/src/locales/ca.i18n.json +++ b/packages/i18n/src/locales/ca.i18n.json @@ -708,6 +708,7 @@ "Call_Center": "Centre de trucades", "Calls_in_queue_zero": "La cua és buida", "Calls_in_queue_one": "{{count}} Trucada a la cua", + "Calls_in_queue_many": "{{count}} Trucades a la cua", "Calls_in_queue_other": "{{count}} Trucades a la cua", "Call_declined": "Trucada rebutjada!", "Call_Information": "Informació de la trucada", @@ -2822,6 +2823,7 @@ "Message_Code_highlight": "Llista d'idiomes de ressaltat de codi", "Message_Code_highlight_Description": "Llista d'idiomes separats per comes (tots els idiomes admesos en [highlight.js](https://github.com/highlightjs/highlight.js/tree/11.6.0#supported-languages)) que s'utilitzarà per a ressaltar blocs de codi", "message_counter_one": "missatge {{count}}", + "message_counter_many": "{{count}} missatges", "message_counter_other": "{{count}} missatges", "Message_DateFormat": "Format de data", "Message_DateFormat_Description": "Veure: [Moment.js](http://momentjs.com/docs/#/displaying/format/)", @@ -2915,6 +2917,7 @@ "meteor_status_failed": "La connexió del servidor ha fallat", "meteor_status_offline": "Mode fora de línia", "meteor_status_reconnect_in_one": "intentant de nou en un segon ...", + "meteor_status_reconnect_in_many": "provant de nou d'aquí a {{count}} segons ...", "meteor_status_reconnect_in_other": "provant de nou d'aquí a {{count}} segons ...", "meteor_status_try_now_offline": "Connectar de nou", "meteor_status_try_now_waiting": "Prova-ho ara", From d6b4062af6bbd38a8f77c08f7c65de80b04b35dc Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Thu, 15 Feb 2024 14:18:06 -0500 Subject: [PATCH 06/18] Create large-bikes-brake.md --- .changeset/large-bikes-brake.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/large-bikes-brake.md diff --git a/.changeset/large-bikes-brake.md b/.changeset/large-bikes-brake.md new file mode 100644 index 000000000000..b2c86cc4545e --- /dev/null +++ b/.changeset/large-bikes-brake.md @@ -0,0 +1,6 @@ +--- +"@rocket.chat/meteor": major +"rocketchat-services": major +--- + +feat!: Meteor 3.0 From d8738d8407fa8e7491b7e4531a46b3c4cd510902 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Tue, 26 Mar 2024 14:32:02 -0300 Subject: [PATCH 07/18] reorganize imports --- apps/meteor/ee/app/license/server/startup.ts | 81 ++++++++++---------- apps/meteor/ee/server/startup/index.ts | 1 - apps/meteor/ee/server/startup/services.ts | 26 ++++--- apps/meteor/server/main.ts | 32 ++++---- 4 files changed, 70 insertions(+), 70 deletions(-) diff --git a/apps/meteor/ee/app/license/server/startup.ts b/apps/meteor/ee/app/license/server/startup.ts index 3c47c8738613..14f88bc27d61 100644 --- a/apps/meteor/ee/app/license/server/startup.ts +++ b/apps/meteor/ee/app/license/server/startup.ts @@ -105,57 +105,60 @@ export const startLicense = async () => { } }; - // When settings are loaded, apply the current license if there is one. - settings.onReady(async () => { - if (!(await applyLicense(settings.get('Enterprise_License') ?? '', false))) { - // License from the envvar is always treated as new, because it would have been saved on the setting if it was already in use. - if (process.env.ROCKETCHAT_LICENSE && !License.hasValidLicense()) { - await applyLicense(process.env.ROCKETCHAT_LICENSE, true); + License.setLicenseLimitCounter('activeUsers', () => Users.getActiveLocalUserCount()); + License.setLicenseLimitCounter('guestUsers', () => Users.getActiveLocalGuestCount()); + License.setLicenseLimitCounter('roomsPerGuest', async (context) => (context?.userId ? Subscriptions.countByUserId(context.userId) : 0)); + License.setLicenseLimitCounter('privateApps', () => getAppCount('private')); + License.setLicenseLimitCounter('marketplaceApps', () => getAppCount('marketplace')); + License.setLicenseLimitCounter('monthlyActiveContacts', () => LivechatVisitors.countVisitorsOnPeriod(moment.utc().format('YYYY-MM'))); + + return new Promise((resolve) => { + // When settings are loaded, apply the current license if there is one. + settings.onReady(async () => { + if (!(await applyLicense(settings.get('Enterprise_License') ?? '', false))) { + // License from the envvar is always treated as new, because it would have been saved on the setting if it was already in use. + if (process.env.ROCKETCHAT_LICENSE && !License.hasValidLicense()) { + await applyLicense(process.env.ROCKETCHAT_LICENSE, true); + } } - } - // After the current license is already loaded, watch the setting value to react to new licenses being applied. - settings.change('Enterprise_License', (license) => applyLicenseOrRemove(license, true)); + // After the current license is already loaded, watch the setting value to react to new licenses being applied. + settings.change('Enterprise_License', (license) => applyLicenseOrRemove(license, true)); - callbacks.add('workspaceLicenseRemoved', () => License.remove()); + callbacks.add('workspaceLicenseRemoved', () => License.remove()); - callbacks.add('workspaceLicenseChanged', (updatedLicense) => applyLicense(updatedLicense, true)); + callbacks.add('workspaceLicenseChanged', (updatedLicense) => applyLicense(updatedLicense, true)); - License.onInstall(async () => void api.broadcast('license.actions', {} as Record, boolean>)); + License.onInstall(async () => void api.broadcast('license.actions', {} as Record, boolean>)); - License.onInvalidate(async () => void api.broadcast('license.actions', {} as Record, boolean>)); + License.onInvalidate(async () => void api.broadcast('license.actions', {} as Record, boolean>)); - License.onBehaviorTriggered('prevent_action', (context) => syncByTriggerDebounced(`prevent_action_${context.limit}`)); + License.onBehaviorTriggered('prevent_action', (context) => syncByTriggerDebounced(`prevent_action_${context.limit}`)); - License.onBehaviorTriggered('start_fair_policy', async (context) => syncByTriggerDebounced(`start_fair_policy_${context.limit}`)); + License.onBehaviorTriggered('start_fair_policy', async (context) => syncByTriggerDebounced(`start_fair_policy_${context.limit}`)); - License.onBehaviorTriggered('disable_modules', async (context) => syncByTriggerDebounced(`disable_modules_${context.limit}`)); + License.onBehaviorTriggered('disable_modules', async (context) => syncByTriggerDebounced(`disable_modules_${context.limit}`)); - License.onChange(() => api.broadcast('license.sync')); + License.onChange(() => api.broadcast('license.sync')); - License.onBehaviorToggled('prevent_action', (context) => { - if (!context.limit) { - return; - } - void api.broadcast('license.actions', { - [context.limit]: true, - } as Record, boolean>); - }); + License.onBehaviorToggled('prevent_action', (context) => { + if (!context.limit) { + return; + } + void api.broadcast('license.actions', { + [context.limit]: true, + } as Record, boolean>); + }); - License.onBehaviorToggled('allow_action', (context) => { - if (!context.limit) { - return; - } - void api.broadcast('license.actions', { - [context.limit]: false, - } as Record, boolean>); + License.onBehaviorToggled('allow_action', (context) => { + if (!context.limit) { + return; + } + void api.broadcast('license.actions', { + [context.limit]: false, + } as Record, boolean>); + }); + resolve(); }); }); - - License.setLicenseLimitCounter('activeUsers', () => Users.getActiveLocalUserCount()); - License.setLicenseLimitCounter('guestUsers', () => Users.getActiveLocalGuestCount()); - License.setLicenseLimitCounter('roomsPerGuest', async (context) => (context?.userId ? Subscriptions.countByUserId(context.userId) : 0)); - License.setLicenseLimitCounter('privateApps', () => getAppCount('private')); - License.setLicenseLimitCounter('marketplaceApps', () => getAppCount('marketplace')); - License.setLicenseLimitCounter('monthlyActiveContacts', () => LivechatVisitors.countVisitorsOnPeriod(moment.utc().format('YYYY-MM'))); }; diff --git a/apps/meteor/ee/server/startup/index.ts b/apps/meteor/ee/server/startup/index.ts index eb09ca6ed30f..51bb011828ba 100644 --- a/apps/meteor/ee/server/startup/index.ts +++ b/apps/meteor/ee/server/startup/index.ts @@ -4,7 +4,6 @@ import './audit'; import './deviceManagement'; import './engagementDashboard'; import './maxRoomsPerGuest'; -import './services'; import './upsell'; import { api } from '@rocket.chat/core-services'; diff --git a/apps/meteor/ee/server/startup/services.ts b/apps/meteor/ee/server/startup/services.ts index dc072fb1d9b0..c7cd0491bda9 100644 --- a/apps/meteor/ee/server/startup/services.ts +++ b/apps/meteor/ee/server/startup/services.ts @@ -26,17 +26,19 @@ if (!isRunningMs()) { api.registerService(new InstanceService()); } -let federationService: FederationService; +export const startFederationService = async (): Promise => { + let federationService: FederationService; -if (!License.hasValidLicense()) { - federationService = await FederationService.createFederationService(); - api.registerService(federationService); -} - -void License.onLicense('federation', async () => { - const federationServiceEE = await FederationServiceEE.createFederationService(); - if (federationService) { - await api.destroyService(federationService); + if (!License.hasValidLicense()) { + federationService = await FederationService.createFederationService(); + api.registerService(federationService); } - api.registerService(federationServiceEE); -}); + + void License.onLicense('federation', async () => { + const federationServiceEE = await FederationServiceEE.createFederationService(); + if (federationService) { + await api.destroyService(federationService); + } + api.registerService(federationServiceEE); + }); +}; diff --git a/apps/meteor/server/main.ts b/apps/meteor/server/main.ts index 893a970578b0..294cdcd4feab 100644 --- a/apps/meteor/server/main.ts +++ b/apps/meteor/server/main.ts @@ -1,35 +1,31 @@ import './models/startup'; - /** * ./settings uses top level await, in theory the settings creation * and the startup should be done in parallel */ import './settings'; -import '../app/lib/server/startup'; +import '../app/settings/server'; +import { startLicense } from '../ee/app/license/server/startup'; +import { registerEEBroker } from '../ee/server'; +import { startFederationService } from '../ee/server/startup/services'; import { configureLoginServices } from './configuration'; import { configureLogLevel } from './configureLogLevel'; -import { startLicense, registerEEBroker } from './ee'; import { registerServices } from './services/startup'; import { startup } from './startup'; + +import './routes'; +import '../app/lib/server/startup'; import './importPackages'; import './methods'; import './publications'; -import './routes'; - -await import('./lib/logger/startup'); - -await import('../lib/oauthRedirectUriServer'); +import './lib/logger/startup'; +import '../lib/oauthRedirectUriServer'; +import './lib/pushConfig'; +import './features/EmailInbox/index'; -await import('./lib/pushConfig'); +await Promise.all([configureLogLevel(), registerServices(), registerEEBroker(), startup()]); -await import('./stream/stdout'); -await import('./features/EmailInbox/index'); - -await configureLogLevel(); -await registerServices(); -await import('../app/settings/server'); -await configureLoginServices(); -await registerEEBroker(); -await startup(); await startLicense(); + +await Promise.all([configureLoginServices(), startFederationService()]); From 585cc6c97331bd8fbdb6216e6695d5aeb4b2af94 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Thu, 11 Apr 2024 23:27:20 -0400 Subject: [PATCH 08/18] Update large-bikes-brake.md --- .changeset/large-bikes-brake.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.changeset/large-bikes-brake.md b/.changeset/large-bikes-brake.md index b2c86cc4545e..6dfa769cc7a4 100644 --- a/.changeset/large-bikes-brake.md +++ b/.changeset/large-bikes-brake.md @@ -3,4 +3,12 @@ "rocketchat-services": major --- -feat!: Meteor 3.0 +Upgrades the version of the Meteor framework to 3.0 + +The main reason behind this is the upgrade of the Node.js version, where version 14 will be removed and version 20 will be used instead. + +Internally, significant changes have been made, mostly due to the removal of fibers. + +As a result, it was necessary to adapt our code to work with the new version. + +No functionality should have been affected by this, but if you are running Rocket.Chat in unconventional ways, please note that you need to upgrade your Node.js version. From f2b018da079c388bef904045a937fd2172d9a85b Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Thu, 11 Apr 2024 23:28:05 -0400 Subject: [PATCH 09/18] Create quick-moles-jump.md --- .changeset/quick-moles-jump.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/quick-moles-jump.md diff --git a/.changeset/quick-moles-jump.md b/.changeset/quick-moles-jump.md new file mode 100644 index 000000000000..d9912e012acb --- /dev/null +++ b/.changeset/quick-moles-jump.md @@ -0,0 +1,6 @@ +--- +"@rocket.chat/meteor": major +"rocketchat-services": major +--- + +Node.js 20.x support From 661d19f893d594342b92bd8c68659b9beb3fa551 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Thu, 25 Apr 2024 11:09:23 -0300 Subject: [PATCH 10/18] increase eslint max-old-space-size 8192 --- apps/meteor/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/package.json b/apps/meteor/package.json index 01f8abb6258e..9bf584471233 100644 --- a/apps/meteor/package.json +++ b/apps/meteor/package.json @@ -25,7 +25,7 @@ "debug": "meteor run --inspect", "debug-brk": "meteor run --inspect-brk", "lint": "yarn stylelint && yarn eslint", - "eslint": "NODE_OPTIONS=\"--max-old-space-size=6144\" eslint --ext .js,.jsx,.ts,.tsx . --cache", + "eslint": "NODE_OPTIONS=\"--max-old-space-size=8192\" eslint --ext .js,.jsx,.ts,.tsx . --cache", "eslint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --fix --cache", "obj:dev": "TEST_MODE=true yarn dev", "stylelint": "stylelint \"app/**/*.css\" \"client/**/*.css\" \"app/**/*.less\" \"client/**/*.less\" \"ee/**/*.less\"", From 1d5aea32f1ce65cf31e03a378baaafe520a45fa6 Mon Sep 17 00:00:00 2001 From: gabriellsh Date: Mon, 24 Jun 2024 14:13:35 -0300 Subject: [PATCH 11/18] fix usePruneWarningMessage tests --- .../InfoPanel/RetentionPolicyCallout.spec.tsx | 2 +- .../hooks/usePruneWarningMessage.spec.ts | 31 ++++++++++--------- .../room/body/RetentionPolicyWarning.spec.tsx | 2 +- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/apps/meteor/client/components/InfoPanel/RetentionPolicyCallout.spec.tsx b/apps/meteor/client/components/InfoPanel/RetentionPolicyCallout.spec.tsx index 8db42e8c649d..a9305b5f1f15 100644 --- a/apps/meteor/client/components/InfoPanel/RetentionPolicyCallout.spec.tsx +++ b/apps/meteor/client/components/InfoPanel/RetentionPolicyCallout.spec.tsx @@ -18,7 +18,7 @@ describe('RetentionPolicyCallout', () => { legacyRoot: true, wrapper: createMock({ appliesToChannels: true, TTLChannels: 60000 }), }); - expect(screen.getByRole('alert')).toHaveTextContent('a minute June 1, 2024, 12:30 AM'); + expect(screen.getByRole('alert')).toHaveTextContent('a minute June 1, 2024 at 12:30 AM'); }); it('Should not render callout if settings are invalid', () => { diff --git a/apps/meteor/client/hooks/usePruneWarningMessage.spec.ts b/apps/meteor/client/hooks/usePruneWarningMessage.spec.ts index 4f51bd2040de..2bf4b813be12 100644 --- a/apps/meteor/client/hooks/usePruneWarningMessage.spec.ts +++ b/apps/meteor/client/hooks/usePruneWarningMessage.spec.ts @@ -20,6 +20,9 @@ const getRetentionRoomProps = (props: Partial { jest.setSystemTime(new Date(2024, 5, 1, 0, 0, 0)); @@ -36,9 +39,9 @@ describe('usePruneWarningMessage hook', () => { TTLChannels: 60000, }), }); - expect(result.current).toEqual('a minute June 1, 2024, 12:30 AM'); + expect(result.current).toEqual('a minute June 1, 2024 at 12:30 AM'); jest.advanceTimersByTime(31 * 60 * 1000); - expect(result.current).toEqual('a minute June 1, 2024, 1:00 AM'); + expect(result.current).toEqual('a minute June 1, 2024 at 1:00 AM'); }); it('Should return the default warning with precision set to every_hour', () => { @@ -51,7 +54,7 @@ describe('usePruneWarningMessage hook', () => { precision: '1', }), }); - expect(result.current).toEqual('a minute June 1, 2024, 1:00 AM'); + expect(result.current).toEqual('a minute June 1, 2024 at 1:00 AM'); }); it('Should return the default warning with precision set to every_six_hours', () => { @@ -64,7 +67,7 @@ describe('usePruneWarningMessage hook', () => { precision: '2', }), }); - expect(result.current).toEqual('a minute June 1, 2024, 6:00 AM'); + expect(result.current).toEqual('a minute June 1, 2024 at 6:00 AM'); }); it('Should return the default warning with precision set to every_day', () => { @@ -77,7 +80,7 @@ describe('usePruneWarningMessage hook', () => { precision: '3', }), }); - expect(result.current).toEqual('a minute June 2, 2024, 12:00 AM'); + expect(result.current).toEqual('a minute June 2, 2024 at 12:00 AM'); }); it('Should return the default warning with advanced precision', () => { @@ -91,7 +94,7 @@ describe('usePruneWarningMessage hook', () => { advancedPrecisionCron: '0 0 1 */1 *', }), }); - expect(result.current).toEqual('a minute July 1, 2024, 12:00 AM'); + expect(result.current).toEqual('a minute July 1, 2024 at 12:00 AM'); }); }); @@ -105,7 +108,7 @@ describe('usePruneWarningMessage hook', () => { TTLChannels: 60000, }), }); - expect(result.current).toEqual('a minute June 1, 2024, 12:30 AM'); + expect(result.current).toEqual('a minute June 1, 2024 at 12:30 AM'); }); it('Should return the unpinned messages warning', () => { @@ -118,7 +121,7 @@ describe('usePruneWarningMessage hook', () => { doNotPrunePinned: true, }), }); - expect(result.current).toEqual('Unpinned a minute June 1, 2024, 12:30 AM'); + expect(result.current).toEqual('Unpinned a minute June 1, 2024 at 12:30 AM'); }); it('Should return the files only warning', () => { @@ -132,7 +135,7 @@ describe('usePruneWarningMessage hook', () => { filesOnly: true, }), }); - expect(result.current).toEqual('FilesOnly a minute June 1, 2024, 12:30 AM'); + expect(result.current).toEqual('FilesOnly a minute June 1, 2024 at 12:30 AM'); }); it('Should return the unpinned files only warning', () => { @@ -147,7 +150,7 @@ describe('usePruneWarningMessage hook', () => { doNotPrunePinned: true, }), }); - expect(result.current).toEqual('UnpinnedFilesOnly a minute June 1, 2024, 12:30 AM'); + expect(result.current).toEqual('UnpinnedFilesOnly a minute June 1, 2024 at 12:30 AM'); }); }); @@ -158,7 +161,7 @@ describe('usePruneWarningMessage hook', () => { legacyRoot: true, wrapper: createMock(), }); - expect(result.current).toEqual('30 days June 1, 2024, 12:30 AM'); + expect(result.current).toEqual('30 days June 1, 2024 at 12:30 AM'); }); it('Should return the unpinned messages warning', () => { @@ -167,7 +170,7 @@ describe('usePruneWarningMessage hook', () => { legacyRoot: true, wrapper: createMock(), }); - expect(result.current).toEqual('Unpinned 30 days June 1, 2024, 12:30 AM'); + expect(result.current).toEqual('Unpinned 30 days June 1, 2024 at 12:30 AM'); }); it('Should return the files only warning', () => { @@ -177,7 +180,7 @@ describe('usePruneWarningMessage hook', () => { legacyRoot: true, wrapper: createMock(), }); - expect(result.current).toEqual('FilesOnly 30 days June 1, 2024, 12:30 AM'); + expect(result.current).toEqual('FilesOnly 30 days June 1, 2024 at 12:30 AM'); }); it('Should return the unpinned files only warning', () => { @@ -187,7 +190,7 @@ describe('usePruneWarningMessage hook', () => { legacyRoot: true, wrapper: createMock(), }); - expect(result.current).toEqual('UnpinnedFilesOnly 30 days June 1, 2024, 12:30 AM'); + expect(result.current).toEqual('UnpinnedFilesOnly 30 days June 1, 2024 at 12:30 AM'); }); }); }); diff --git a/apps/meteor/client/views/room/body/RetentionPolicyWarning.spec.tsx b/apps/meteor/client/views/room/body/RetentionPolicyWarning.spec.tsx index 712a2b9850cc..5e4e13fa3eab 100644 --- a/apps/meteor/client/views/room/body/RetentionPolicyWarning.spec.tsx +++ b/apps/meteor/client/views/room/body/RetentionPolicyWarning.spec.tsx @@ -18,7 +18,7 @@ describe('RetentionPolicyWarning', () => { legacyRoot: true, wrapper: createMock({ appliesToChannels: true, TTLChannels: 60000 }), }); - expect(screen.getByRole('alert')).toHaveTextContent('a minute June 1, 2024, 12:30 AM'); + expect(screen.getByRole('alert')).toHaveTextContent('a minute June 1, 2024 at 12:30 AM'); }); it('Should not render callout if settings are invalid', () => { From ae71e3197b2f4ddd37feae35ab5fbb40999a7881 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Tue, 16 Jul 2024 18:15:37 -0300 Subject: [PATCH 12/18] add py3-setuptools to ci build --- apps/meteor/.docker/Dockerfile.alpine | 2 +- apps/meteor/ee/server/services/Dockerfile | 2 +- ee/apps/account-service/Dockerfile | 2 +- ee/apps/authorization-service/Dockerfile | 2 +- ee/apps/ddp-streamer/Dockerfile | 2 +- ee/apps/omnichannel-transcript/Dockerfile | 2 +- ee/apps/presence-service/Dockerfile | 2 +- ee/apps/queue-worker/Dockerfile | 2 +- ee/apps/stream-hub-service/Dockerfile | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/meteor/.docker/Dockerfile.alpine b/apps/meteor/.docker/Dockerfile.alpine index ea606ec6dcfe..ed2709894845 100644 --- a/apps/meteor/.docker/Dockerfile.alpine +++ b/apps/meteor/.docker/Dockerfile.alpine @@ -70,7 +70,7 @@ ENV DEPLOY_METHOD=docker \ Accounts_AvatarStorePath=/app/uploads RUN set -x \ - && apk add --no-cache --virtual .fetch-deps python3 make g++ \ + && apk add --no-cache --virtual .fetch-deps python3 make g++ py3-setuptools \ && cd /app/bundle/programs/server \ && npm install --omit=dev --unsafe-perm \ # Start hack for sharp... diff --git a/apps/meteor/ee/server/services/Dockerfile b/apps/meteor/ee/server/services/Dockerfile index a23437031d80..eb8a7de0a4c1 100644 --- a/apps/meteor/ee/server/services/Dockerfile +++ b/apps/meteor/ee/server/services/Dockerfile @@ -69,7 +69,7 @@ ENV NODE_ENV=production \ WORKDIR /app/apps/meteor/ee/server/services RUN apk update && \ - apk --no-cache --virtual build-dependencies add g++ python3 make && \ + apk --no-cache --virtual build-dependencies add g++ python3 make py3-setuptools && \ yarn workspaces focus --production && \ rm -rf /var/cache/apk/* && \ apk del build-dependencies diff --git a/ee/apps/account-service/Dockerfile b/ee/apps/account-service/Dockerfile index d30ad723b1e4..136e0134ca21 100644 --- a/ee/apps/account-service/Dockerfile +++ b/ee/apps/account-service/Dockerfile @@ -69,7 +69,7 @@ ENV NODE_ENV=production \ WORKDIR /app/ee/apps/${SERVICE} RUN apk update && \ - apk --no-cache --virtual build-dependencies add g++ python3 make && \ + apk --no-cache --virtual build-dependencies add g++ python3 make py3-setuptools && \ yarn workspaces focus --production && \ rm -rf /var/cache/apk/* && \ apk del build-dependencies diff --git a/ee/apps/authorization-service/Dockerfile b/ee/apps/authorization-service/Dockerfile index af71523045ad..10dad15760b1 100644 --- a/ee/apps/authorization-service/Dockerfile +++ b/ee/apps/authorization-service/Dockerfile @@ -66,7 +66,7 @@ ENV NODE_ENV=production \ WORKDIR /app/ee/apps/${SERVICE} RUN apk update && \ - apk --no-cache --virtual build-dependencies add g++ python3 make && \ + apk --no-cache --virtual build-dependencies add g++ python3 make py3-setuptools && \ yarn workspaces focus --production && \ rm -rf /var/cache/apk/* && \ apk del build-dependencies diff --git a/ee/apps/ddp-streamer/Dockerfile b/ee/apps/ddp-streamer/Dockerfile index 7e115f154fea..7a1ee05c0590 100644 --- a/ee/apps/ddp-streamer/Dockerfile +++ b/ee/apps/ddp-streamer/Dockerfile @@ -72,7 +72,7 @@ ENV NODE_ENV=production \ WORKDIR /app/ee/apps/${SERVICE} RUN apk update && \ - apk --no-cache --virtual build-dependencies add g++ python3 make && \ + apk --no-cache --virtual build-dependencies add g++ python3 make py3-setuptools && \ yarn workspaces focus --production && \ rm -rf /var/cache/apk/* && \ apk del build-dependencies diff --git a/ee/apps/omnichannel-transcript/Dockerfile b/ee/apps/omnichannel-transcript/Dockerfile index 53d14b2f3063..6ec2a636124b 100644 --- a/ee/apps/omnichannel-transcript/Dockerfile +++ b/ee/apps/omnichannel-transcript/Dockerfile @@ -75,7 +75,7 @@ ENV NODE_ENV=production \ WORKDIR /app/ee/apps/${SERVICE} RUN apk update && \ - apk --no-cache --virtual build-dependencies add g++ python3 make && \ + apk --no-cache --virtual build-dependencies add g++ python3 make py3-setuptools && \ yarn workspaces focus --production && \ rm -rf /var/cache/apk/* && \ apk del build-dependencies diff --git a/ee/apps/presence-service/Dockerfile b/ee/apps/presence-service/Dockerfile index cbabfcaf7079..09bf36b4c565 100644 --- a/ee/apps/presence-service/Dockerfile +++ b/ee/apps/presence-service/Dockerfile @@ -69,7 +69,7 @@ ENV NODE_ENV=production \ WORKDIR /app/ee/apps/${SERVICE} RUN apk update && \ - apk --no-cache --virtual build-dependencies add g++ python3 make && \ + apk --no-cache --virtual build-dependencies add g++ python3 make py3-setuptools && \ yarn workspaces focus --production && \ rm -rf /var/cache/apk/* && \ apk del build-dependencies diff --git a/ee/apps/queue-worker/Dockerfile b/ee/apps/queue-worker/Dockerfile index 53d14b2f3063..6ec2a636124b 100644 --- a/ee/apps/queue-worker/Dockerfile +++ b/ee/apps/queue-worker/Dockerfile @@ -75,7 +75,7 @@ ENV NODE_ENV=production \ WORKDIR /app/ee/apps/${SERVICE} RUN apk update && \ - apk --no-cache --virtual build-dependencies add g++ python3 make && \ + apk --no-cache --virtual build-dependencies add g++ python3 make py3-setuptools && \ yarn workspaces focus --production && \ rm -rf /var/cache/apk/* && \ apk del build-dependencies diff --git a/ee/apps/stream-hub-service/Dockerfile b/ee/apps/stream-hub-service/Dockerfile index af71523045ad..10dad15760b1 100644 --- a/ee/apps/stream-hub-service/Dockerfile +++ b/ee/apps/stream-hub-service/Dockerfile @@ -66,7 +66,7 @@ ENV NODE_ENV=production \ WORKDIR /app/ee/apps/${SERVICE} RUN apk update && \ - apk --no-cache --virtual build-dependencies add g++ python3 make && \ + apk --no-cache --virtual build-dependencies add g++ python3 make py3-setuptools && \ yarn workspaces focus --production && \ rm -rf /var/cache/apk/* && \ apk del build-dependencies From 0a83cbc7094b407bc61293fe23fcde30726b11b3 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Wed, 17 Jul 2024 14:22:51 -0300 Subject: [PATCH 13/18] bump isolated-vm --- apps/meteor/package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/meteor/package.json b/apps/meteor/package.json index 9bf584471233..0346d70dd96f 100644 --- a/apps/meteor/package.json +++ b/apps/meteor/package.json @@ -359,7 +359,7 @@ "imap": "^0.8.19", "ip-range-check": "^0.2.0", "is-svg": "^4.3.2", - "isolated-vm": "4.6.0", + "isolated-vm": "5.0.1", "jschardet": "^3.0.0", "jsdom": "^16.7.0", "jsrsasign": "^10.5.24", diff --git a/yarn.lock b/yarn.lock index 6c64513af6a8..f872d3318dd6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9768,7 +9768,7 @@ __metadata: imap: ^0.8.19 ip-range-check: ^0.2.0 is-svg: ^4.3.2 - isolated-vm: 4.6.0 + isolated-vm: 5.0.1 jest: ~29.7.0 jschardet: ^3.0.0 jsdom: ^16.7.0 @@ -28649,13 +28649,13 @@ __metadata: languageName: node linkType: hard -"isolated-vm@npm:4.6.0": - version: 4.6.0 - resolution: "isolated-vm@npm:4.6.0" +"isolated-vm@npm:5.0.1": + version: 5.0.1 + resolution: "isolated-vm@npm:5.0.1" dependencies: node-gyp: latest prebuild-install: ^7.1.1 - checksum: 011853d46bc934751012f5c1ed3eaba43dc4bd274672e59ff8e4c7eb0df668c93f3e0b91e3b4e812d2b8476c9ace218f34e7a3188b08b343409370e70044a874 + checksum: 33ca559797d8c20571015733309b313f55df667cbaf17f7c6445b707fcdfd8bef6896264a30e48eaaa5635ab1d33e826b4aa95a1ba0bf8d26b045a1226956956 languageName: node linkType: hard From 012ae90bedc9bd275ad8a739710b0a8468147860 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Wed, 24 Jul 2024 18:50:25 -0300 Subject: [PATCH 14/18] assets `getBinary` to `getBinaryAsync` --- apps/meteor/server/startup/initialData.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/server/startup/initialData.js b/apps/meteor/server/startup/initialData.js index f4570093294d..cefed3eef922 100644 --- a/apps/meteor/server/startup/initialData.js +++ b/apps/meteor/server/startup/initialData.js @@ -146,7 +146,7 @@ Meteor.startup(async () => { await addUserRolesAsync('rocket.cat', ['bot']); - const buffer = Buffer.from(await Assets.getBinary('avatars/rocketcat.png')); + const buffer = Buffer.from(await Assets.getBinaryAsync('avatars/rocketcat.png')); const rs = RocketChatFile.bufferToStream(buffer, 'utf8'); const fileStore = FileUpload.getStore('Avatars'); From 805f6efb8b114fca7090f2d24afd284f51cb5685 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Fri, 27 Sep 2024 17:48:51 -0300 Subject: [PATCH 15/18] fix: temporary storybook ssh issue --- packages/gazzodown/package.json | 6 +++--- packages/ui-composer/package.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/gazzodown/package.json b/packages/gazzodown/package.json index 98104d7e2faa..3ec24fb0dfeb 100644 --- a/packages/gazzodown/package.json +++ b/packages/gazzodown/package.json @@ -9,13 +9,13 @@ ], "scripts": { "build": "rm -rf dist && tsc -p tsconfig.build.json", - "build-storybook": "build-storybook", - "build-preview": "build-storybook --quiet", + "build-storybook": "NODE_OPTIONS=--openssl-legacy-provider build-storybook", + "build-preview": "NODE_OPTIONS=--openssl-legacy-provider build-storybook --quiet", ".:build-preview-move": "mkdir -p ../../.preview && cp -r ./storybook-static ../../.preview/gazzodown", "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput", "lint": "eslint --ext .js,.jsx,.ts,.tsx .", "lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --fix", - "storybook": "start-storybook -p 6006", + "storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6006", "test": "jest", "testunit": "jest", "typecheck": "tsc --noEmit" diff --git a/packages/ui-composer/package.json b/packages/ui-composer/package.json index 562865bfd2d1..6acfa137e846 100644 --- a/packages/ui-composer/package.json +++ b/packages/ui-composer/package.json @@ -13,8 +13,8 @@ "build": "rm -rf dist && tsc -p tsconfig.build.json", "typecheck": "tsc --noEmit", "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput", - "storybook": "start-storybook -p 6006", - "build-preview": "build-storybook", + "storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6006", + "build-preview": "NODE_OPTIONS=--openssl-legacy-provider build-storybook", ".:build-preview-move": "mkdir -p ../../.preview/ && cp -r ./storybook-static ../../.preview/ui-composer" }, "devDependencies": { From 48b0bf498b4ddd14a2b4d83a90cfbe5d764501d4 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Tue, 1 Oct 2024 13:49:47 -0700 Subject: [PATCH 16/18] .. --- apps/meteor/.docker/Dockerfile.alpine | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/meteor/.docker/Dockerfile.alpine b/apps/meteor/.docker/Dockerfile.alpine index ed2709894845..4dd0c8a31a89 100644 --- a/apps/meteor/.docker/Dockerfile.alpine +++ b/apps/meteor/.docker/Dockerfile.alpine @@ -78,11 +78,11 @@ RUN set -x \ && npm install sharp@0.32.6 \ && mv node_modules/sharp npm/node_modules/sharp \ # End hack for sharp - # Start hack for isolated-vm... - && rm -rf npm/node_modules/isolated-vm \ - && npm install isolated-vm@4.6.0 \ - && mv node_modules/isolated-vm npm/node_modules/isolated-vm \ - # End hack for isolated-vm + # # Start hack for isolated-vm... + # && rm -rf npm/node_modules/isolated-vm \ + # && npm install isolated-vm@4.6.0 \ + # && mv node_modules/isolated-vm npm/node_modules/isolated-vm \ + # # End hack for isolated-vm && cd /app/bundle/programs/server/npm \ && npm rebuild bcrypt --build-from-source \ && npm cache clear --force \ From 4913e63718687b2d1c829f90e0c9ce2de7a5bba6 Mon Sep 17 00:00:00 2001 From: Douglas Gubert Date: Tue, 8 Oct 2024 18:43:12 -0300 Subject: [PATCH 17/18] Refactor apps listeners for license events --- .../ee/server/startup/apps/trialExpiration.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/meteor/ee/server/startup/apps/trialExpiration.ts b/apps/meteor/ee/server/startup/apps/trialExpiration.ts index 3c4d80291647..f9a6800951b0 100644 --- a/apps/meteor/ee/server/startup/apps/trialExpiration.ts +++ b/apps/meteor/ee/server/startup/apps/trialExpiration.ts @@ -1,12 +1,15 @@ import { License } from '@rocket.chat/license'; import { Meteor } from 'meteor/meteor'; +import { Apps } from '../../apps'; + Meteor.startup(async () => { - const { Apps } = await import('../../apps'); - License.onInvalidateLicense(async () => { - void Apps.migratePrivateApps(); - }); - License.onRemoveLicense(async () => { + const migratePrivateAppsCallback = async () => { + if (!Apps.isInitialized) return; + void Apps.migratePrivateApps(); - }); + }; + + License.onInvalidateLicense(migratePrivateAppsCallback); + License.onRemoveLicense(migratePrivateAppsCallback); }); From 216657f98cfb259d56c04aa45157500d68953b7a Mon Sep 17 00:00:00 2001 From: Douglas Gubert Date: Tue, 8 Oct 2024 23:41:34 -0300 Subject: [PATCH 18/18] Update alpine image to use deno apk package and isolated-vm 4.7.2 --- apps/meteor/.docker/Dockerfile.alpine | 56 +-------------------------- apps/meteor/package.json | 2 +- yarn.lock | 10 ++--- 3 files changed, 8 insertions(+), 60 deletions(-) diff --git a/apps/meteor/.docker/Dockerfile.alpine b/apps/meteor/.docker/Dockerfile.alpine index 4dd0c8a31a89..43f24e47b209 100644 --- a/apps/meteor/.docker/Dockerfile.alpine +++ b/apps/meteor/.docker/Dockerfile.alpine @@ -1,62 +1,10 @@ -ARG DENO_VERSION="1.37.1" - -FROM denoland/deno:bin-${DENO_VERSION} as deno - FROM node:20.15.1-alpine3.20 LABEL maintainer="buildmaster@rocket.chat" ENV LANG=C.UTF-8 -## Alpine 3.16 does not have a deno package, but newer versions have it -## So as soon as we can update the Alpine version, we can replace the following -## GLIBC installation part by an `apk add deno` - -# Installing glibc deps required by Deno -# This replaces libc6-compat -# Copied from https://github.com/Docker-Hub-frolvlad/docker-alpine-glibc, which denoland/deno:alpine-1.37.1 uses -# NOTE: Glibc 2.35 package is broken: https://github.com/sgerrand/alpine-pkg-glibc/issues/176, so we stick to 2.34 for now -RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" && \ - ALPINE_GLIBC_PACKAGE_VERSION="2.34-r0" && \ - ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \ - ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \ - ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \ - apk add --no-cache --virtual=.build-dependencies wget ca-certificates ttf-dejavu && \ - echo \ - "-----BEGIN PUBLIC KEY-----\ - MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApZ2u1KJKUu/fW4A25y9m\ - y70AGEa/J3Wi5ibNVGNn1gT1r0VfgeWd0pUybS4UmcHdiNzxJPgoWQhV2SSW1JYu\ - tOqKZF5QSN6X937PTUpNBjUvLtTQ1ve1fp39uf/lEXPpFpOPL88LKnDBgbh7wkCp\ - m2KzLVGChf83MS0ShL6G9EQIAUxLm99VpgRjwqTQ/KfzGtpke1wqws4au0Ab4qPY\ - KXvMLSPLUp7cfulWvhmZSegr5AdhNw5KNizPqCJT8ZrGvgHypXyiFvvAH5YRtSsc\ - Zvo9GI2e2MaZyo9/lvb+LbLEJZKEQckqRj4P26gmASrZEPStwc+yqy1ShHLA0j6m\ - 1QIDAQAB\ - -----END PUBLIC KEY-----" | sed 's/ */\n/g' > "/etc/apk/keys/sgerrand.rsa.pub" && \ - wget \ - "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ - "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ - "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \ - mv /etc/nsswitch.conf /etc/nsswitch.conf.bak && \ - apk add --no-cache --force-overwrite \ - "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ - "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ - "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \ - \ - mv /etc/nsswitch.conf.bak /etc/nsswitch.conf && \ - rm "/etc/apk/keys/sgerrand.rsa.pub" && \ - (/usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true) && \ - echo "export LANG=$LANG" > /etc/profile.d/locale.sh && \ - \ - apk del glibc-i18n && \ - \ - rm "/root/.wget-hsts" && \ - apk del .build-dependencies && \ - rm \ - "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ - "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ - "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" - -COPY --from=deno /deno /bin/deno +RUN apk add --no-cache deno ttf-dejavu ADD . /app @@ -70,7 +18,7 @@ ENV DEPLOY_METHOD=docker \ Accounts_AvatarStorePath=/app/uploads RUN set -x \ - && apk add --no-cache --virtual .fetch-deps python3 make g++ py3-setuptools \ + && apk add --no-cache --virtual .fetch-deps python3 make g++ py3-setuptools libc6-compat \ && cd /app/bundle/programs/server \ && npm install --omit=dev --unsafe-perm \ # Start hack for sharp... diff --git a/apps/meteor/package.json b/apps/meteor/package.json index 0346d70dd96f..f0e9b0387a5c 100644 --- a/apps/meteor/package.json +++ b/apps/meteor/package.json @@ -359,7 +359,7 @@ "imap": "^0.8.19", "ip-range-check": "^0.2.0", "is-svg": "^4.3.2", - "isolated-vm": "5.0.1", + "isolated-vm": "4.7.2", "jschardet": "^3.0.0", "jsdom": "^16.7.0", "jsrsasign": "^10.5.24", diff --git a/yarn.lock b/yarn.lock index f872d3318dd6..522f7b388288 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9768,7 +9768,7 @@ __metadata: imap: ^0.8.19 ip-range-check: ^0.2.0 is-svg: ^4.3.2 - isolated-vm: 5.0.1 + isolated-vm: 4.7.2 jest: ~29.7.0 jschardet: ^3.0.0 jsdom: ^16.7.0 @@ -28649,13 +28649,13 @@ __metadata: languageName: node linkType: hard -"isolated-vm@npm:5.0.1": - version: 5.0.1 - resolution: "isolated-vm@npm:5.0.1" +"isolated-vm@npm:4.7.2": + version: 4.7.2 + resolution: "isolated-vm@npm:4.7.2" dependencies: node-gyp: latest prebuild-install: ^7.1.1 - checksum: 33ca559797d8c20571015733309b313f55df667cbaf17f7c6445b707fcdfd8bef6896264a30e48eaaa5635ab1d33e826b4aa95a1ba0bf8d26b045a1226956956 + checksum: 16f43f6413623dc7009a8bb9fa567fb30ffc151e21e9a7ae616f25626e750ba823527fb24e2e17408943c6bbbcc7235db89f41262d43a8d8155ad99e888b0760 languageName: node linkType: hard