aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/lib/plugins/plugin-manager.ts10
1 files changed, 9 insertions, 1 deletions
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 {
79 79
80 registerWebSocketRouter () { 80 registerWebSocketRouter () {
81 this.server.on('upgrade', (request, socket, head) => { 81 this.server.on('upgrade', (request, socket, head) => {
82 // Check if it's a plugin websocket connection
83 // No need to destroy the stream when we abort the request
84 // Other handlers in PeerTube will catch this upgrade event too (socket.io, tracker etc)
85
82 const url = request.url 86 const url = request.url
83 87
84 const matched = url.match(`/plugins/([^/]+)/([^/]+/)?ws(/.*)`) 88 const matched = url.match(`/plugins/([^/]+)/([^/]+/)?ws(/.*)`)
@@ -95,7 +99,11 @@ export class PluginManager implements ServerHook {
95 const wss = routes.find(r => r.route.startsWith(subRoute)) 99 const wss = routes.find(r => r.route.startsWith(subRoute))
96 if (!wss) return 100 if (!wss) return
97 101
98 wss.handler(request, socket, head) 102 try {
103 wss.handler(request, socket, head)
104 } catch (err) {
105 logger.error('Exception in plugin handler ' + npmName, { err })
106 }
99 }) 107 })
100 } 108 }
101 109