aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/live-manager.ts2
-rw-r--r--server/lib/peertube-socket.ts14
2 files changed, 13 insertions, 3 deletions
diff --git a/server/lib/live-manager.ts b/server/lib/live-manager.ts
index 6eb05c9d6..d253d06fc 100644
--- a/server/lib/live-manager.ts
+++ b/server/lib/live-manager.ts
@@ -244,7 +244,7 @@ class LiveManager {
244 size: -1, 244 size: -1,
245 extname: '.ts', 245 extname: '.ts',
246 infoHash: null, 246 infoHash: null,
247 fps: -1, 247 fps,
248 videoStreamingPlaylistId: playlist.id 248 videoStreamingPlaylistId: playlist.id
249 }).catch(err => { 249 }).catch(err => {
250 logger.error('Cannot create file for live streaming.', { err }) 250 logger.error('Cannot create file for live streaming.', { err })
diff --git a/server/lib/peertube-socket.ts b/server/lib/peertube-socket.ts
index c918a8685..c4df399ca 100644
--- a/server/lib/peertube-socket.ts
+++ b/server/lib/peertube-socket.ts
@@ -6,6 +6,7 @@ import { UserNotificationModelForApi } from '@server/types/models/user'
6import { LiveVideoEventPayload, LiveVideoEventType } from '@shared/models' 6import { LiveVideoEventPayload, LiveVideoEventType } from '@shared/models'
7import { logger } from '../helpers/logger' 7import { logger } from '../helpers/logger'
8import { authenticateSocket } from '../middlewares' 8import { authenticateSocket } from '../middlewares'
9import { isIdValid } from '@server/helpers/custom-validators/misc'
9 10
10class PeerTubeSocket { 11class PeerTubeSocket {
11 12
@@ -39,8 +40,17 @@ class PeerTubeSocket {
39 40
40 this.liveVideosNamespace = io.of('/live-videos') 41 this.liveVideosNamespace = io.of('/live-videos')
41 .on('connection', socket => { 42 .on('connection', socket => {
42 socket.on('subscribe', ({ videoId }) => socket.join(videoId)) 43 socket.on('subscribe', ({ videoId }) => {
43 socket.on('unsubscribe', ({ videoId }) => socket.leave(videoId)) 44 if (!isIdValid(videoId)) return
45
46 socket.join(videoId)
47 })
48
49 socket.on('unsubscribe', ({ videoId }) => {
50 if (!isIdValid(videoId)) return
51
52 socket.leave(videoId)
53 })
44 }) 54 })
45 } 55 }
46 56