diff options
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r-- | server/controllers/api/videos/index.ts | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 89fd0432f..4e4697ef4 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -67,17 +67,17 @@ const reqVideoFileAdd = createReqFiles( | |||
67 | [ 'videofile', 'thumbnailfile', 'previewfile' ], | 67 | [ 'videofile', 'thumbnailfile', 'previewfile' ], |
68 | Object.assign({}, VIDEO_MIMETYPE_EXT, IMAGE_MIMETYPE_EXT), | 68 | Object.assign({}, VIDEO_MIMETYPE_EXT, IMAGE_MIMETYPE_EXT), |
69 | { | 69 | { |
70 | videofile: CONFIG.STORAGE.VIDEOS_DIR, | 70 | videofile: CONFIG.STORAGE.TMP_DIR, |
71 | thumbnailfile: CONFIG.STORAGE.THUMBNAILS_DIR, | 71 | thumbnailfile: CONFIG.STORAGE.TMP_DIR, |
72 | previewfile: CONFIG.STORAGE.PREVIEWS_DIR | 72 | previewfile: CONFIG.STORAGE.TMP_DIR |
73 | } | 73 | } |
74 | ) | 74 | ) |
75 | const reqVideoFileUpdate = createReqFiles( | 75 | const reqVideoFileUpdate = createReqFiles( |
76 | [ 'thumbnailfile', 'previewfile' ], | 76 | [ 'thumbnailfile', 'previewfile' ], |
77 | IMAGE_MIMETYPE_EXT, | 77 | IMAGE_MIMETYPE_EXT, |
78 | { | 78 | { |
79 | thumbnailfile: CONFIG.STORAGE.THUMBNAILS_DIR, | 79 | thumbnailfile: CONFIG.STORAGE.TMP_DIR, |
80 | previewfile: CONFIG.STORAGE.PREVIEWS_DIR | 80 | previewfile: CONFIG.STORAGE.TMP_DIR |
81 | } | 81 | } |
82 | ) | 82 | ) |
83 | 83 | ||
@@ -387,6 +387,11 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
387 | function getVideo (req: express.Request, res: express.Response) { | 387 | function getVideo (req: express.Request, res: express.Response) { |
388 | const videoInstance = res.locals.video | 388 | const videoInstance = res.locals.video |
389 | 389 | ||
390 | if (videoInstance.isOutdated()) { | ||
391 | JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'video', videoUrl: videoInstance.url } }) | ||
392 | .catch(err => logger.error('Cannot create AP refresher job for video %s.', videoInstance.url, { err })) | ||
393 | } | ||
394 | |||
390 | return res.json(videoInstance.toFormattedDetailsJSON()) | 395 | return res.json(videoInstance.toFormattedDetailsJSON()) |
391 | } | 396 | } |
392 | 397 | ||
@@ -406,12 +411,7 @@ async function viewVideo (req: express.Request, res: express.Response) { | |||
406 | ]) | 411 | ]) |
407 | 412 | ||
408 | const serverActor = await getServerActor() | 413 | const serverActor = await getServerActor() |
409 | 414 | await sendCreateView(serverActor, videoInstance, undefined) | |
410 | // Send the event to the origin server | ||
411 | // If we own the video, we'll send an update event when we'll process the views (in our job queue) | ||
412 | if (videoInstance.isOwned() === false) { | ||
413 | await sendCreateView(serverActor, videoInstance, undefined) | ||
414 | } | ||
415 | 415 | ||
416 | return res.status(204).end() | 416 | return res.status(204).end() |
417 | } | 417 | } |
@@ -429,7 +429,7 @@ async function getVideoDescription (req: express.Request, res: express.Response) | |||
429 | return res.json({ description }) | 429 | return res.json({ description }) |
430 | } | 430 | } |
431 | 431 | ||
432 | async function listVideos (req: express.Request, res: express.Response, next: express.NextFunction) { | 432 | async function listVideos (req: express.Request, res: express.Response) { |
433 | const resultList = await VideoModel.listForApi({ | 433 | const resultList = await VideoModel.listForApi({ |
434 | start: req.query.start, | 434 | start: req.query.start, |
435 | count: req.query.count, | 435 | count: req.query.count, |