Skip to content

Commit ce6b6f4

Browse files
[mirotalkc2c] - fix: strip ANSI escape codes from Sentry log messages
1 parent c1eb23a commit ce6b6f4

6 files changed

Lines changed: 14 additions & 8 deletions

File tree

.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ====================================================
2-
# MiroTalk C2C v.1.2.79 - Environment Configuration
2+
# MiroTalk C2C v.1.2.80 - Environment Configuration
33
# ====================================================
44

55
# App environment

backend/sentry.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,26 @@ const SENTRY_ENABLED = process.env.SENTRY_ENABLED === 'true';
88
const SENTRY_LOG_LEVELS = (process.env.SENTRY_LOG_LEVELS || 'error').split(',').map((level) => level.trim());
99
const SENTRY_DSN = process.env.SENTRY_DSN;
1010
const SENTRY_TRACES_SAMPLE_RATE = parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE || '0.5');
11+
const ANSI_REGEX = /\u001b\[[0-9;]*m/g;
12+
13+
function stripAnsi(str) {
14+
return typeof str === 'string' ? str.replace(ANSI_REGEX, '') : str;
15+
}
1116

1217
function patchConsoleForSentry() {
1318
const originalConsole = {};
1419
SENTRY_LOG_LEVELS.forEach((level) => {
1520
originalConsole[level] = console[level];
1621
console[level] = function (...args) {
22+
const cleanArgs = args.map(stripAnsi);
1723
switch (level) {
1824
case 'warn':
19-
SentryNode.captureMessage(args.join(' '), 'warning');
25+
SentryNode.captureMessage(cleanArgs.join(' '), 'warning');
2026
break;
2127
case 'error':
2228
args[0] instanceof Error
2329
? SentryNode.captureException(args[0])
24-
: SentryNode.captureException(new Error(args.join(' ')));
30+
: SentryNode.captureException(new Error(cleanArgs.join(' ')));
2531
break;
2632
}
2733
originalConsole[level].apply(console, args);

backend/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @license For private project or commercial purposes contact us at: license.mirotalk@gmail.com or purchase it directly via Code Canyon:
1010
* @license https://codecanyon.net/item/mirotalk-c2c-webrtc-real-time-cam-2-cam-video-conferences-and-screen-sharing/43383005
1111
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
12-
* @version 1.2.79
12+
* @version 1.2.80
1313
*/
1414

1515
require('dotenv').config();

frontend/js/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @license For private project or commercial purposes contact us at: license.mirotalk@gmail.com or purchase it directly via Code Canyon:
1010
* @license https://codecanyon.net/item/mirotalk-c2c-webrtc-real-time-cam-2-cam-video-conferences-and-screen-sharing/43383005
1111
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
12-
* @version 1.2.79
12+
* @version 1.2.80
1313
*/
1414

1515
const roomId = new URLSearchParams(window.location.search).get('room');

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mirotalkc2c",
3-
"version": "1.2.79",
3+
"version": "1.2.80",
44
"description": "A free WebRTC Cam-2-Cam browser-based video calls",
55
"main": "server.js",
66
"scripts": {

0 commit comments

Comments
 (0)