X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fplugins%2Fplugin-manager.ts;h=d368aecfc282fea5487650e3852b8289ca1fba7e;hb=82d1653d799ccc0bcc228bb5e5aafef7a071c2db;hp=c4d9b65740a9cc0e1779841475e41d10effb64bb;hpb=9d4c60dccc8e7e777ad139a82e9f61feda9d21fc;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts index c4d9b6574..d368aecfc 100644 --- a/server/lib/plugins/plugin-manager.ts +++ b/server/lib/plugins/plugin-manager.ts @@ -79,6 +79,10 @@ export class PluginManager implements ServerHook { registerWebSocketRouter () { this.server.on('upgrade', (request, socket, head) => { + // Check if it's a plugin websocket connection + // No need to destroy the stream when we abort the request + // Other handlers in PeerTube will catch this upgrade event too (socket.io, tracker etc) + const url = request.url const matched = url.match(`/plugins/([^/]+)/([^/]+/)?ws(/.*)`) @@ -95,7 +99,11 @@ export class PluginManager implements ServerHook { const wss = routes.find(r => r.route.startsWith(subRoute)) if (!wss) return - wss.handler(request, socket, head) + try { + wss.handler(request, socket, head) + } catch (err) { + logger.error('Exception in plugin handler ' + npmName, { err }) + } }) }