Skip to content

Commit

Permalink
Merge branch 'develop' into CS-312-remove-login-button-and-login-rest…
Browse files Browse the repository at this point in the history
…rictions-for-rocket-chat-marketplace
  • Loading branch information
PedroRorato authored Feb 2, 2023
2 parents 9bdc1aa + da78db4 commit 70db82a
Show file tree
Hide file tree
Showing 20 changed files with 32 additions and 21 deletions.
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/ar.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,6 @@
"Busy": "مشغول",
"By": "بواسطة",
"by": "بواسطة",
"By_author": "بواسطة __author__",
"cache_cleared": "تم محو التخزين المؤقت",
"Call": "مكالمة",
"Calling": "يتم الآن الاتصال",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/ca.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,6 @@
"Busy": "Ocupat",
"By": "per",
"by": "per",
"By_author": "Per __author__",
"cache_cleared": "Memòria cau esborrada",
"Call": "Trucada",
"Calling": "Trucant",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/cs.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@
"busy": "zaneprázdněný",
"Busy": "Zaneprázdněný",
"by": "od",
"By_author": "Od __author__",
"cache_cleared": "Cache vyčistěna",
"Call": "Hovor",
"call-management": "Správa hovorů",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/da.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@
"busy": "travl",
"Busy": "Travl",
"by": "ved",
"By_author": "Af __author__",
"cache_cleared": "Cache ryddet",
"Call": "Opkald",
"call-management": "Opkaldsadministration",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/de.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,6 @@
"Buy": "Kaufen",
"By": "Von",
"by": "von",
"By_author": "Von __author__",
"cache_cleared": "Zwischenspeicher gelöscht",
"Call": "Anruf",
"Call_back": "Rückruf",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/es.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,6 @@
"Busy": "Ocupado",
"By": "Por",
"by": "por",
"By_author": "Por __author__",
"cache_cleared": "Caché borrada",
"Call": "Llamada",
"Calling": "Llamando",
Expand Down
3 changes: 1 addition & 2 deletions apps/meteor/packages/rocketchat-i18n/i18n/fi.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,6 @@
"Buy": "Osta",
"By": "Mukaan",
"by": "mukaan",
"By_author": "Mukaan __author__",
"cache_cleared": "Välimuisti tyhjennetty",
"Call": "Soita",
"Call_back": "Soita takaisin",
Expand Down Expand Up @@ -4795,7 +4794,7 @@
"To_users": "Käyttäjille",
"Today": "Tänään",
"Toggle_original_translated": "Vaihda alkuperäinen/käännetty",
"toggle-room-e2e-encryption": "Vaihda huoneen Room E2E-salaus",
"toggle-room-e2e-encryption": "Vaihda huoneen täysi salaus",
"toggle-room-e2e-encryption_description": "Lupa vaihtaa E2E-salaushuone",
"Token": "Tunniste",
"Token_Access": "Tunniste, kulku",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/fr.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,6 @@
"Busy": "Occupé",
"By": "Par",
"by": "par",
"By_author": "Par __author__",
"cache_cleared": "Cache effacé",
"Call": "Appeler",
"Calling": "Appel",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/hu.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,6 @@
"Buy": "Vétel",
"By": "–",
"by": "–",
"By_author": "– __author__",
"cache_cleared": "Gyorsítótár törölve",
"Call": "Hívás",
"Call_back": "Visszahívás",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/ja.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,6 @@
"Busy": "取り込み中",
"By": "による",
"by": "による",
"By_author": "__author__による",
"cache_cleared": "キャッシュがクリアされました",
"Call": "通話",
"Calling": "通話中",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/ko.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,6 @@
"busy": "바쁨",
"Busy": "바쁨",
"by": "으로",
"By_author": "작성자 __author__",
"cache_cleared": "캐시가 삭제됨",
"Call": "요청",
"call-management": "통화 관리",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/nl.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,6 @@
"Busy": "Bezig",
"By": "Door",
"by": "door",
"By_author": "Door __author__",
"cache_cleared": "Cache gewist",
"Call": "Bel",
"Calling": "Bellen",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/pl.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,6 @@
"Buy": "Kup",
"By": "Autor:",
"by": "autor:",
"By_author": "Autor: __author__",
"cache_cleared": "Pamięć podręczna wyczyszczona",
"Call": "Zadzwoń",
"Calling": "Dzwoni",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,6 @@
"Busy": "Ocupado",
"By": "Por",
"by": "por",
"By_author": "Por __author__",
"cache_cleared": "Cache limpo",
"Call": "Ligação",
"Calling": "Chamando",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/ru.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,6 @@
"Buy": "Купить",
"By": "От",
"by": "по",
"By_author": "От __author__",
"cache_cleared": "Кэш очищен",
"Call": "Звонок",
"Call_back": "Обратный звонок",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/sv.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,6 @@
"Buy": "Köp",
"By": "Av",
"by": "av",
"By_author": "Av __author__",
"cache_cleared": "Cachen rensad",
"Call": "Ring upp",
"Call_back": "Ring tillbaka",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/zh-TW.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,6 @@
"Busy": "忙碌",
"By": "通過",
"by": "通過",
"By_author": "由__author__",
"cache_cleared": "快取已清除",
"Call": "呼叫",
"Calling": "正在通話",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/zh.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,6 @@
"busy": "忙碌",
"Busy": "忙碌",
"by": "通过",
"By_author": "由 __author__",
"cache_cleared": "缓存已清理",
"Call": "调用",
"call-management": "呼叫管理",
Expand Down
10 changes: 9 additions & 1 deletion ee/apps/ddp-streamer/src/Server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EventEmitter } from 'events';

import type WebSocket from 'ws';
import WebSocket from 'ws';
import ejson from 'ejson';
import { v1 as uuidv1 } from 'uuid';
import { MeteorService, isMeteorError, MeteorError } from '@rocket.chat/core-services';
Expand Down Expand Up @@ -53,6 +53,10 @@ export class Server extends EventEmitter {
};

async call(client: Client, packet: IPacket): Promise<void> {
// if client is not connected we don't need to do anything
if (client.ws.readyState !== WebSocket.OPEN) {
return;
}
try {
// if method was not defined on DDP Streamer we fall back to Meteor
if (!this._methods.has(packet.method)) {
Expand Down Expand Up @@ -86,6 +90,10 @@ export class Server extends EventEmitter {
}

async subscribe(client: Client, packet: IPacket): Promise<void> {
// if client is not connected we don't need to do anything
if (client.ws.readyState !== WebSocket.OPEN) {
return;
}
try {
if (!this._subscriptions.has(packet.name)) {
throw new MeteorError(404, `Subscription '${packet.name}' not found`);
Expand Down
23 changes: 22 additions & 1 deletion ee/apps/ddp-streamer/src/Streamer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,22 @@ export class Stream extends Streamer {
};

for await (const { subscription } of subscriptions) {
// if the connection state is not open anymore, it somehow got to a weird state,
// we'll emit close so it can clean up the weird state, and so we stop emitting to it
if (subscription.client.ws.readyState !== WebSocket.OPEN) {
subscription.client.ws.emit('close');
continue;
}

if (this.retransmitToSelf === false && origin && origin === subscription.connection) {
continue;
}

if (await this.isEmitAllowed(subscription, eventName, ...args)) {
if (!(await this.isEmitAllowed(subscription, eventName, ...args))) {
continue;
}

try {
await new Promise<void>((resolve, reject) => {
const frame = data[subscription.client.meteorClient ? 'meteor' : 'normal'];

Expand All @@ -72,6 +83,16 @@ export class Stream extends Streamer {
resolve();
});
});
} catch (error: any) {
if (error.code === 'ERR_STREAM_DESTROYED') {
console.warn('Trying to send data to destroyed stream, closing connection.');

// if we still tried to send data to a destroyed stream, we'll try again to close the connection
if (subscription.client.ws.readyState !== WebSocket.OPEN) {
subscription.client.ws.emit('close');
}
}
console.error('Error trying to send data to stream.', error);
}
}
}
Expand Down

0 comments on commit 70db82a

Please sign in to comment.