Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into fix/…
Browse files Browse the repository at this point in the history
…hideSysMes

* 'develop' of github.com:RocketChat/Rocket.Chat: (50 commits)
  fix: application crashing when clicking on "Files" button (#28878)
  revert: rate limiter bindEnvironment
  refactor: Changed settings registry's callbacks to work with async functions (#28784)
  revert: removal of `Meteor.bindEnvironment` on `DDPRateLimiter.addRule` (#28874)
  chore: Limit 10 usernames on reactions tooltip (#28141)
  fix: quote line break (#28798)
  fix: Add function to get installation source (#28806)
  regression: `fetch` call in `getWorkspaceAccessTokenWithScope` (#28866)
  fix(docs,readme): use raw image url (#28861)
  refactor: Make onLicense support async callbacks (#28791)
  refactor: remove some Meteor.bindEnvironment (#28822)
  refactor: Move callbacks to ts - 2 (#28771)
  chore: Update issue_template.md (#28753)
  fix: Fixed business hours route redirect (#28344)
  feat: add GA4 support (#28830)
  chore(deps): Prettier version (#28857)
  remove meteor.call from server (#28774)
  refactor: Remove fibers from `linkedin-oauth` (#28779)
  fix: Invalid JSON in Custom Translations setting crashes the UI (#28600)
  regression(e2e): Missing private key blocks sending message in encrypted rooms (#28831)
  ...
  • Loading branch information
gabriellsh committed Apr 12, 2023
2 parents 4b58b04 + 352b749 commit 0fc916f
Show file tree
Hide file tree
Showing 446 changed files with 5,277 additions and 6,577 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ about: Create a report to help us improve

<!--
Please see our guide for opening issues: https://rocket.chat/docs/contributing/reporting-issues
Please see our guide for opening issues: https://developer.rocket.chat/rocket.chat/contribute-to-rocket.chat/ways-to-contribute/report-bugs
If you have questions or are looking for help/support please see: https://rocket.chat/docs/getting-support
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- uses: Bhacaz/checkout-files@v2
with:
files: package.json
branch: ${{ github.ref }}

- id: var
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Every day, tens of millions of users in over 150 countries and in organizations

Using our self-managed offerings you can deploy Rocket.Chat on your own server, or you can use SaaS Rocket.Chat. We offer support for both community as well as commercial plans.

<img src="https://github.com/RocketChat/Rocket.Chat.Artwork/blob/master/Product%20Images/Welcome%20to%20RC%20(Readme).jpg" data-canonical-src="https://github.com/RocketChat/Rocket.Chat.Artwork/blob/master/Product%20Images/Welcome%20to%20RC%20(Readme).jpg" width="919" height="511" />
<img src="https://raw.githubusercontent.com/RocketChat/Rocket.Chat.Artwork/master/Product%20Images/Welcome%20to%20RC%20(Readme).jpg" data-canonical-src="https://raw.githubusercontent.com/RocketChat/Rocket.Chat.Artwork/master/Product%20Images/Welcome%20to%20RC%20(Readme).jpg" width="919" height="511" />

## Cloud Hosted Rocket.Chat

Expand Down
8 changes: 0 additions & 8 deletions apps/meteor/.meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,19 @@ ddp-common@1.4.0
dynamic-import@0.7.2
ecmascript@0.16.6
typescript@4.9.4
ejson@1.1.3
email@2.2.4
http@2.0.0
logging@1.3.2
meteor-base@1.5.1
mobile-experience@1.1.0
mongo@1.16.5
random@1.2.1
rate-limit@1.0.9
reactive-dict@1.3.1
reactive-var@1.0.12
reload@1.3.1
service-configuration@1.3.1
session@1.2.1
shell-server@0.5.0
spacebars
standard-minifier-js@2.8.1
tracker@1.3.1

Expand All @@ -58,26 +55,21 @@ mystor:device-detection
rocketchat:restivus
ostrio:cookies
pauli:accounts-linkedin
raix:handlebar-helpers

rocketchat:tap-i18n@3.0.0
underscore@1.0.12
littledata:synced-cron

autoupdate@1.8.0
babel-compiler@7.10.3
google-oauth@1.4.3
matb33:collection-hooks
meteorhacks:inject-initial
oauth@2.2.0
oauth2@1.3.2
routepolicy@1.1.1
sha@1.0.9
templating
webapp@1.13.4
webapp-hashing@1.1.1
rocketchat:oauth2-server
rocketchat:i18n
facts-base@1.0.1
url@1.3.2
standard-minifier-css@1.9.0
3 changes: 0 additions & 3 deletions apps/meteor/.meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ launch-screen@1.3.0
littledata:synced-cron@1.5.1
localstorage@1.2.0
logging@1.3.2
matb33:collection-hooks@1.2.1
mdg:validation-error@0.5.1
meteor@1.11.1
meteor-base@1.5.1
Expand Down Expand Up @@ -92,7 +91,6 @@ pauli:accounts-linkedin@6.0.0
pauli:linkedin-oauth@6.0.0
promise@0.12.2
raix:eventemitter@1.0.0
raix:handlebar-helpers@0.2.5
random@1.2.1
rate-limit@1.0.9
react-fast-refresh@0.2.6
Expand Down Expand Up @@ -132,4 +130,3 @@ underscore@1.0.12
url@1.3.2
webapp@1.13.4
webapp-hashing@1.1.1
zodern:types@1.0.9
4 changes: 2 additions & 2 deletions apps/meteor/app/2fa/client/TOTPOAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Meteor.loginWithLinkedin = function (options, cb) {
overrideLoginMethod(loginWithLinkedin, [options], cb, loginWithLinkedinAndTOTP);
};

Accounts.onPageLoadLogin((loginAttempt) => {
Accounts.onPageLoadLogin(async (loginAttempt) => {
if (loginAttempt?.error?.error !== 'totp-required') {
return;
}
Expand All @@ -119,7 +119,7 @@ Accounts.onPageLoadLogin((loginAttempt) => {
const { credentialToken, credentialSecret } = oAuthArgs.oauth;
const cb = loginAttempt.userCallback;

process2faReturn({
await process2faReturn({
error: loginAttempt.error,
originalCallback: cb,
onCode: (code) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/2fa/client/TOTPPassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ Meteor.loginWithPasswordAndTOTP = function (selector, password, code, callback)
const { loginWithPassword } = Meteor;

Meteor.loginWithPassword = function (email, password, cb) {
loginWithPassword(email, password, (error) => {
process2faReturn({
loginWithPassword(email, password, async (error) => {
await process2faReturn({
error,
originalCallback: cb,
emailOrUsername: email,
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/2fa/client/overrideMeteorCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const callWithTotp =
});

const callWithoutTotp = (methodName: string, args: unknown[], callback: Callback) => (): unknown =>
call(methodName, ...args, (error: unknown, result: unknown): void => {
process2faReturn({
call(methodName, ...args, async (error: unknown, result: unknown): Promise<void> => {
await process2faReturn({
error,
result,
onCode: callWithTotp(methodName, args, callback),
Expand Down
8 changes: 4 additions & 4 deletions apps/meteor/app/2fa/server/code/EmailCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ export class EmailCheck implements ICodeCheck {
return this.getUserVerifiedEmails(user).length > 0;
}

private send2FAEmail(address: string, random: string, user: IUser): void {
private async send2FAEmail(address: string, random: string, user: IUser): Promise<void> {
const language = user.language || settings.get('Language') || 'en';

const t = (s: string): string => TAPi18n.__(s, { lng: language });

Mailer.send({
await Mailer.send({
to: address,
from: settings.get('From_Email'),
subject: 'Authentication code',
Expand Down Expand Up @@ -103,8 +103,8 @@ ${t('If_you_didnt_try_to_login_in_your_account_please_ignore_this_email')}

await Users.addEmailCodeByUserId(user._id, encryptedRandom, expire);

for (const address of emails) {
this.send2FAEmail(address, random, user);
for await (const address of emails) {
await this.send2FAEmail(address, random, user);
}
}

Expand Down
34 changes: 16 additions & 18 deletions apps/meteor/app/2fa/server/functions/resetTOTP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,22 @@ const sendResetNotification = async function (uid: string): Promise<void> {
const from = settings.get('From_Email');
const subject = t('TOTP_reset_email');

for (const address of addresses) {
Meteor.defer(() => {
try {
Mailer.send({
to: address,
from,
subject,
text,
html,
} as any);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
throw new Meteor.Error('error-email-send-failed', `Error trying to send email: ${message}`, {
function: 'resetUserTOTP',
message,
});
}
});
for await (const address of addresses) {
try {
await Mailer.send({
to: address,
from,
subject,
text,
html,
} as any);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
throw new Meteor.Error('error-email-send-failed', `Error trying to send email: ${message}`, {
function: 'resetUserTOTP',
message,
});
}
}
};

Expand Down
22 changes: 12 additions & 10 deletions apps/meteor/app/2fa/server/startup/settings.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
import { settingsRegistry } from '../../../settings/server';

void settingsRegistry.addGroup('Accounts', function () {
this.section('Two Factor Authentication', function () {
void settingsRegistry.addGroup('Accounts', async function () {
await this.section('Two Factor Authentication', async function () {
const enable2FA = {
_id: 'Accounts_TwoFactorAuthentication_Enabled',
value: true,
};

this.add('Accounts_TwoFactorAuthentication_Enabled', true, {
await this.add('Accounts_TwoFactorAuthentication_Enabled', true, {
type: 'boolean',
public: true,
});
this.add('Accounts_TwoFactorAuthentication_MaxDelta', 1, {
await this.add('Accounts_TwoFactorAuthentication_MaxDelta', 1, {
type: 'int',
enableQuery: enable2FA,
});

this.add('Accounts_TwoFactorAuthentication_By_TOTP_Enabled', true, {
await this.add('Accounts_TwoFactorAuthentication_By_TOTP_Enabled', true, {
type: 'boolean',
enableQuery: enable2FA,
public: true,
});

this.add('Accounts_TwoFactorAuthentication_By_Email_Enabled', true, {
await this.add('Accounts_TwoFactorAuthentication_By_Email_Enabled', true, {
type: 'boolean',
enableQuery: enable2FA,
public: true,
});
this.add('Accounts_TwoFactorAuthentication_By_Email_Auto_Opt_In', true, {

await this.add('Accounts_TwoFactorAuthentication_By_Email_Auto_Opt_In', true, {
type: 'boolean',
enableQuery: [
enable2FA,
Expand All @@ -41,7 +42,8 @@ void settingsRegistry.addGroup('Accounts', function () {
order: 3,
},
});
this.add('Accounts_TwoFactorAuthentication_By_Email_Code_Expiration', 3600, {

await this.add('Accounts_TwoFactorAuthentication_By_Email_Code_Expiration', 3600, {
type: 'int',
enableQuery: [
enable2FA,
Expand All @@ -52,13 +54,13 @@ void settingsRegistry.addGroup('Accounts', function () {
],
});

this.add('Accounts_TwoFactorAuthentication_RememberFor', 1800, {
await this.add('Accounts_TwoFactorAuthentication_RememberFor', 1800, {
type: 'int',
enableQuery: enable2FA,
});

// TODO: Remove this setting for version 4.0
this.add('Accounts_TwoFactorAuthentication_Enforce_Password_Fallback', true, {
await this.add('Accounts_TwoFactorAuthentication_Enforce_Password_Fallback', true, {
type: 'boolean',
enableQuery: enable2FA,
public: true,
Expand Down
47 changes: 32 additions & 15 deletions apps/meteor/app/analytics/client/loadScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,39 @@ Template.body.onRendered(function () {

if (googleId) {
/*eslint-disable */
(function (i, s, o, g, r: 'ga', a?: any, m?: any) {
i['GoogleAnalyticsObject'] = r;
(i[r] =
i[r] ||
function () {
(i[r].q = i[r].q || []).push(arguments);
}),
(i[r].l = new Date().getTime());
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
if (googleId.startsWith("G-")) {
// Google Analytics 4
const f = document.getElementsByTagName('script')[0];
const j = document.createElement('script');
j.async = true;
j.src = `//www.googletagmanager.com/gtag/js?id=${googleId}`;
f.parentNode?.insertBefore(j, f);

window.ga('create', googleId, 'auto');
window.ga('send', 'pageview');
// injecting the dataLayer into the windows global object
const w: Window & { dataLayer?: any } = window;
let dataLayer = w.dataLayer || [];
function gtag(key: string, value: any) { dataLayer.push(key, value); }
gtag('js', new Date());
gtag('config', googleId);
} else {
// Google Analytics 3
(function (i, s, o, g, r: 'ga', a?: any, m?: any) {
i['GoogleAnalyticsObject'] = r;
(i[r] =
i[r] ||
function () {
(i[r].q = i[r].q || []).push(arguments);
}),
(i[r].l = new Date().getTime());
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

window.ga('create', googleId, 'auto');
window.ga('send', 'pageview');
}
/* eslint-enable */
}
}
Expand Down
Loading

0 comments on commit 0fc916f

Please sign in to comment.