aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/videos.ts')
-rw-r--r--server/lib/activitypub/videos.ts31
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'
2import * as request from 'request' 2import * as request from 'request'
3import { Transaction } from 'sequelize' 3import { Transaction } from 'sequelize'
4import { ActivityIconObject } from '../../../shared/index' 4import { ActivityIconObject } from '../../../shared/index'
5import { doRequest, doRequestAndSaveToFile } from '../../helpers/requests' 5import { doRequest, doRequestAndSaveToFile } from '../../helpers'
6import { CONFIG, REMOTE_SCHEME, STATIC_PATHS } from '../../initializers/constants' 6import { CONFIG, REMOTE_SCHEME, STATIC_PATHS } from '../../initializers'
7import { AccountInstance } from '../../models/account/account-interface' 7import { AccountModel } from '../../models/account/account'
8import { VideoInstance } from '../../models/video/video-interface' 8import { VideoModel } from '../../models/video/video'
9import { sendLikeToOrigin } from './index'
10import { sendCreateDislikeToOrigin, sendCreateDislikeToVideoFollowers } from './send/send-create'
11import { sendLikeToVideoFollowers } from './send/send-like'
12import { 9import {
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
19function fetchRemoteVideoPreview (video: VideoInstance) { 20function 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
27async function fetchRemoteVideoDescription (video: VideoInstance) { 28async 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
40function generateThumbnailFromUrl (video: VideoInstance, icon: ActivityIconObject) { 41function 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
51async function sendVideoRateChangeToFollowers ( 52async 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
71async function sendVideoRateChangeToOrigin ( 72async 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