Skip to content

Commit

Permalink
Merge branch 'develop' into feat/single-contact-id
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-lehnen-rc authored Oct 16, 2024
2 parents a69fa44 + df7f669 commit 64bc5e6
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/cool-dryers-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": minor
---

Send messages with encrypted attachments to mobile notification service
5 changes: 5 additions & 0 deletions .changeset/modern-trees-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixed the regex for domains in the isValidDomain function
2 changes: 1 addition & 1 deletion apps/meteor/app/lib/server/functions/checkUrlForSsrf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const isValidIPv4 = (ip: string): boolean => {
};

export const isValidDomain = (domain: string): boolean => {
const domainPattern = /^(?!-)(?!.*--)[A-Za-z0-9-]{1,63}(?<!-)\.?([A-Za-z]{2,63}\.?)*[A-Za-z]{2,63}$/;
const domainPattern = /^(?!-)(?!.*--)[A-Za-z0-9-]{1,63}(?<!-)\.?([A-Za-z0-9-]{2,63}\.?)*[A-Za-z]{2,63}$/;
if (!domainPattern.test(domain)) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function getPushData({
name: settings.get('Push_show_username_room') ? room.name : '',
messageType: message.t,
tmid: message.tmid,
...(message.t === 'e2e' && { msg: message.msg }),
...(message.t === 'e2e' && { msg: message.msg, content: message.content }),
},
roomName:
settings.get('Push_show_username_room') && roomCoordinator.getRoomDirectives(room.t).isGroupChat(room)
Expand Down
20 changes: 20 additions & 0 deletions apps/meteor/app/statistics/server/lib/getAppsStatistics.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Apps } from '@rocket.chat/apps';
import { AppStatus, AppStatusUtils } from '@rocket.chat/apps-engine/definition/AppStatus';
import { AppInstallationSource } from '@rocket.chat/apps-engine/server/storage';
import mem from 'mem';

import { SystemLogger } from '../../../../server/lib/logger/system';
Expand All @@ -10,6 +11,8 @@ export type AppsStatistics = {
totalInstalled: number | false;
totalActive: number | false;
totalFailed: number | false;
totalPrivateApps: number | false;
totalPrivateAppsEnabled: number | false;
};

async function _getAppsStatistics(): Promise<AppsStatistics> {
Expand All @@ -19,6 +22,8 @@ async function _getAppsStatistics(): Promise<AppsStatistics> {
totalInstalled: false,
totalActive: false,
totalFailed: false,
totalPrivateApps: false,
totalPrivateAppsEnabled: false,
};
}

Expand All @@ -28,12 +33,23 @@ async function _getAppsStatistics(): Promise<AppsStatistics> {
let totalInstalled = 0;
let totalActive = 0;
let totalFailed = 0;
let totalPrivateApps = 0;
let totalPrivateAppsEnabled = 0;

await Promise.all(
apps.map(async (app) => {
totalInstalled++;

const status = await app.getStatus();
const storageItem = await app.getStorageItem();

if (storageItem.installationSource === AppInstallationSource.PRIVATE) {
totalPrivateApps++;

if (AppStatusUtils.isEnabled(status)) {
totalPrivateAppsEnabled++;
}
}

if (status === AppStatus.MANUALLY_DISABLED) {
totalFailed++;
Expand All @@ -50,6 +66,8 @@ async function _getAppsStatistics(): Promise<AppsStatistics> {
totalInstalled,
totalActive,
totalFailed,
totalPrivateApps,
totalPrivateAppsEnabled,
};
} catch (err: unknown) {
SystemLogger.error({ msg: 'Exception while getting Apps statistics', err });
Expand All @@ -58,6 +76,8 @@ async function _getAppsStatistics(): Promise<AppsStatistics> {
totalInstalled: false,
totalActive: false,
totalFailed: false,
totalPrivateApps: false,
totalPrivateAppsEnabled: false,
};
}
}
Expand Down
7 changes: 7 additions & 0 deletions apps/meteor/app/statistics/server/lib/statistics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ export const statistics = {
}),
);

// Number of livechat rooms with department
statsPms.push(
LivechatRooms.countLivechatRoomsWithDepartment().then((count) => {
statistics.totalLivechatRoomsWithDepartment = count;
}),
);

// Number of departments
statsPms.push(
LivechatDepartment.estimatedDocumentCount().then((count) => {
Expand Down
4 changes: 4 additions & 0 deletions apps/meteor/server/models/raw/LivechatRooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2609,6 +2609,10 @@ export class LivechatRoomsRaw extends BaseRaw<IOmnichannelRoom> implements ILive
.toArray();
}

countLivechatRoomsWithDepartment(): Promise<number> {
return this.col.countDocuments({ departmentId: { $exists: true } });
}

async unsetAllPredictedVisitorAbandonment(): Promise<void> {
throw new Error('Method not implemented.');
}
Expand Down
2 changes: 2 additions & 0 deletions packages/core-typings/src/IStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export interface IStats {
totalDirectMessages: number;
totalDiscussionsMessages: number;
totalLivechatMessages: number;
totalLivechatRoomsWithPriority: number;
totalLivechatRoomsWithDepartment: number;
totalTriggers: number;
totalMessages: number;
federatedServers: number;
Expand Down
1 change: 1 addition & 0 deletions packages/model-typings/src/models/ILivechatRoomsModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,5 @@ export interface ILivechatRoomsModel extends IBaseModel<IOmnichannelRoom> {
source?: string;
options?: FindOptions;
}): FindPaginated<FindCursor<IOmnichannelRoom>>;
countLivechatRoomsWithDepartment(): Promise<number>;
}

0 comments on commit 64bc5e6

Please sign in to comment.