diff options
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/server/debug.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/videos/view.ts | 10 |
2 files changed, 2 insertions, 10 deletions
diff --git a/server/controllers/api/server/debug.ts b/server/controllers/api/server/debug.ts index 6b6ff027c..e09510dc3 100644 --- a/server/controllers/api/server/debug.ts +++ b/server/controllers/api/server/debug.ts | |||
@@ -43,7 +43,7 @@ async function runCommand (req: express.Request, res: express.Response) { | |||
43 | const processors: { [id in SendDebugCommand['command']]: () => Promise<any> } = { | 43 | const processors: { [id in SendDebugCommand['command']]: () => Promise<any> } = { |
44 | 'remove-dandling-resumable-uploads': () => RemoveDanglingResumableUploadsScheduler.Instance.execute(), | 44 | 'remove-dandling-resumable-uploads': () => RemoveDanglingResumableUploadsScheduler.Instance.execute(), |
45 | 'process-video-views-buffer': () => VideoViewsBufferScheduler.Instance.execute(), | 45 | 'process-video-views-buffer': () => VideoViewsBufferScheduler.Instance.execute(), |
46 | 'process-video-viewers': () => VideoViewsManager.Instance.processViewers() | 46 | 'process-video-viewers': () => VideoViewsManager.Instance.processViewerStats() |
47 | } | 47 | } |
48 | 48 | ||
49 | await processors[body.command]() | 49 | await processors[body.command]() |
diff --git a/server/controllers/api/videos/view.ts b/server/controllers/api/videos/view.ts index e28cf371a..db1091f2d 100644 --- a/server/controllers/api/videos/view.ts +++ b/server/controllers/api/videos/view.ts | |||
@@ -1,8 +1,6 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { sendView } from '@server/lib/activitypub/send/send-view' | ||
3 | import { Hooks } from '@server/lib/plugins/hooks' | 2 | import { Hooks } from '@server/lib/plugins/hooks' |
4 | import { VideoViewsManager } from '@server/lib/views/video-views-manager' | 3 | import { VideoViewsManager } from '@server/lib/views/video-views-manager' |
5 | import { getServerActor } from '@server/models/application/application' | ||
6 | import { MVideoId } from '@server/types/models' | 4 | import { MVideoId } from '@server/types/models' |
7 | import { HttpStatusCode, VideoView } from '@shared/models' | 5 | import { HttpStatusCode, VideoView } from '@shared/models' |
8 | import { asyncMiddleware, methodsValidator, openapiOperationDoc, optionalAuthenticate, videoViewValidator } from '../../../middlewares' | 6 | import { asyncMiddleware, methodsValidator, openapiOperationDoc, optionalAuthenticate, videoViewValidator } from '../../../middlewares' |
@@ -33,7 +31,7 @@ async function viewVideo (req: express.Request, res: express.Response) { | |||
33 | const body = req.body as VideoView | 31 | const body = req.body as VideoView |
34 | 32 | ||
35 | const ip = req.ip | 33 | const ip = req.ip |
36 | const { successView, successViewer } = await VideoViewsManager.Instance.processLocalView({ | 34 | const { successView } = await VideoViewsManager.Instance.processLocalView({ |
37 | video, | 35 | video, |
38 | ip, | 36 | ip, |
39 | currentTime: body.currentTime, | 37 | currentTime: body.currentTime, |
@@ -41,15 +39,9 @@ async function viewVideo (req: express.Request, res: express.Response) { | |||
41 | }) | 39 | }) |
42 | 40 | ||
43 | if (successView) { | 41 | if (successView) { |
44 | await sendView({ byActor: await getServerActor(), video, type: 'view' }) | ||
45 | |||
46 | Hooks.runAction('action:api.video.viewed', { video: video, ip, req, res }) | 42 | Hooks.runAction('action:api.video.viewed', { video: video, ip, req, res }) |
47 | } | 43 | } |
48 | 44 | ||
49 | if (successViewer) { | ||
50 | await sendView({ byActor: await getServerActor(), video, type: 'viewer' }) | ||
51 | } | ||
52 | |||
53 | await updateUserHistoryIfNeeded(body, video, res) | 45 | await updateUserHistoryIfNeeded(body, video, res) |
54 | 46 | ||
55 | return res.status(HttpStatusCode.NO_CONTENT_204).end() | 47 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |