diff options
Diffstat (limited to 'server/lib/activitypub/videos.ts')
-rw-r--r-- | server/lib/activitypub/videos.ts | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 6b82f12d5..14c07fec0 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -2,21 +2,22 @@ import { join } from 'path' | |||
2 | import * as request from 'request' | 2 | import * as request from 'request' |
3 | import { Transaction } from 'sequelize' | 3 | import { Transaction } from 'sequelize' |
4 | import { ActivityIconObject } from '../../../shared/index' | 4 | import { ActivityIconObject } from '../../../shared/index' |
5 | import { doRequest, doRequestAndSaveToFile } from '../../helpers/requests' | 5 | import { doRequest, doRequestAndSaveToFile } from '../../helpers' |
6 | import { CONFIG, REMOTE_SCHEME, STATIC_PATHS } from '../../initializers/constants' | 6 | import { CONFIG, REMOTE_SCHEME, STATIC_PATHS } from '../../initializers' |
7 | import { AccountInstance } from '../../models/account/account-interface' | 7 | import { AccountModel } from '../../models/account/account' |
8 | import { VideoInstance } from '../../models/video/video-interface' | 8 | import { VideoModel } from '../../models/video/video' |
9 | import { sendLikeToOrigin } from './index' | ||
10 | import { sendCreateDislikeToOrigin, sendCreateDislikeToVideoFollowers } from './send/send-create' | ||
11 | import { sendLikeToVideoFollowers } from './send/send-like' | ||
12 | import { | 9 | import { |
10 | sendCreateDislikeToOrigin, | ||
11 | sendCreateDislikeToVideoFollowers, | ||
12 | sendLikeToOrigin, | ||
13 | sendLikeToVideoFollowers, | ||
13 | sendUndoDislikeToOrigin, | 14 | sendUndoDislikeToOrigin, |
14 | sendUndoDislikeToVideoFollowers, | 15 | sendUndoDislikeToVideoFollowers, |
15 | sendUndoLikeToOrigin, | 16 | sendUndoLikeToOrigin, |
16 | sendUndoLikeToVideoFollowers | 17 | sendUndoLikeToVideoFollowers |
17 | } from './send/send-undo' | 18 | } from './send' |
18 | 19 | ||
19 | function fetchRemoteVideoPreview (video: VideoInstance) { | 20 | function fetchRemoteVideoPreview (video: VideoModel) { |
20 | // FIXME: use url | 21 | // FIXME: use url |
21 | const host = video.VideoChannel.Account.Server.host | 22 | const host = video.VideoChannel.Account.Server.host |
22 | const path = join(STATIC_PATHS.PREVIEWS, video.getPreviewName()) | 23 | const path = join(STATIC_PATHS.PREVIEWS, video.getPreviewName()) |
@@ -24,7 +25,7 @@ function fetchRemoteVideoPreview (video: VideoInstance) { | |||
24 | return request.get(REMOTE_SCHEME.HTTP + '://' + host + path) | 25 | return request.get(REMOTE_SCHEME.HTTP + '://' + host + path) |
25 | } | 26 | } |
26 | 27 | ||
27 | async function fetchRemoteVideoDescription (video: VideoInstance) { | 28 | async function fetchRemoteVideoDescription (video: VideoModel) { |
28 | // FIXME: use url | 29 | // FIXME: use url |
29 | const host = video.VideoChannel.Account.Server.host | 30 | const host = video.VideoChannel.Account.Server.host |
30 | const path = video.getDescriptionPath() | 31 | const path = video.getDescriptionPath() |
@@ -37,7 +38,7 @@ async function fetchRemoteVideoDescription (video: VideoInstance) { | |||
37 | return body.description ? body.description : '' | 38 | return body.description ? body.description : '' |
38 | } | 39 | } |
39 | 40 | ||
40 | function generateThumbnailFromUrl (video: VideoInstance, icon: ActivityIconObject) { | 41 | function generateThumbnailFromUrl (video: VideoModel, icon: ActivityIconObject) { |
41 | const thumbnailName = video.getThumbnailName() | 42 | const thumbnailName = video.getThumbnailName() |
42 | const thumbnailPath = join(CONFIG.STORAGE.THUMBNAILS_DIR, thumbnailName) | 43 | const thumbnailPath = join(CONFIG.STORAGE.THUMBNAILS_DIR, thumbnailName) |
43 | 44 | ||
@@ -49,8 +50,8 @@ function generateThumbnailFromUrl (video: VideoInstance, icon: ActivityIconObjec | |||
49 | } | 50 | } |
50 | 51 | ||
51 | async function sendVideoRateChangeToFollowers ( | 52 | async function sendVideoRateChangeToFollowers ( |
52 | account: AccountInstance, | 53 | account: AccountModel, |
53 | video: VideoInstance, | 54 | video: VideoModel, |
54 | likes: number, | 55 | likes: number, |
55 | dislikes: number, | 56 | dislikes: number, |
56 | t: Transaction | 57 | t: Transaction |
@@ -69,8 +70,8 @@ async function sendVideoRateChangeToFollowers ( | |||
69 | } | 70 | } |
70 | 71 | ||
71 | async function sendVideoRateChangeToOrigin ( | 72 | async function sendVideoRateChangeToOrigin ( |
72 | account: AccountInstance, | 73 | account: AccountModel, |
73 | video: VideoInstance, | 74 | video: VideoModel, |
74 | likes: number, | 75 | likes: number, |
75 | dislikes: number, | 76 | dislikes: number, |
76 | t: Transaction | 77 | t: Transaction |