diff --git a/app/src/Server.js b/app/src/Server.js index fa766e66..0078e7a2 100644 --- a/app/src/Server.js +++ b/app/src/Server.js @@ -64,7 +64,7 @@ dev dependencies: { * @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon * @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 * @author Miroslav Pejic - miroslav.pejic.85@gmail.com - * @version 1.9.98 + * @version 1.9.99 * */ @@ -1493,6 +1493,25 @@ function startServer() { res.sendFile(views.notFound); }); + // Global error handler for URIError and other errors + app.use((err, req, res, next) => { + if (err instanceof URIError) { + log.warn('Malformed URI detected', { + url: req.url, + ip: getIP(req), + error: err.message, + }); + return res.status(400).send({ status: 400, message: 'Invalid URL encoding' }); + } + // Handle other errors + log.error('Unhandled error', { + url: req.url, + error: err.message, + stack: err.stack, + }); + res.status(500).send({ status: 500, message: 'Internal server error' }); + }); + // #################################################### // SERVER CONFIG // #################################################### diff --git a/package-lock.json b/package-lock.json index 6ffb756e..73c56095 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mirotalksfu", - "version": "1.9.98", + "version": "1.9.99", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mirotalksfu", - "version": "1.9.98", + "version": "1.9.99", "license": "AGPL-3.0", "dependencies": { "@aws-sdk/client-s3": "^3.922.0", diff --git a/package.json b/package.json index 0588375e..94630021 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mirotalksfu", - "version": "1.9.98", + "version": "1.9.99", "description": "WebRTC SFU browser-based video calls", "main": "Server.js", "scripts": { diff --git a/public/js/Brand.js b/public/js/Brand.js index 932a1c96..5e302622 100644 --- a/public/js/Brand.js +++ b/public/js/Brand.js @@ -78,7 +78,7 @@ let BRAND = { }, about: { imageUrl: '../images/mirotalk-logo.gif', - title: 'WebRTC SFU v1.9.98', + title: 'WebRTC SFU v1.9.99', html: `