aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/actor.ts13
-rw-r--r--server/lib/activitypub/process/process-announce.ts4
-rw-r--r--server/lib/activitypub/process/process-create.ts4
-rw-r--r--server/lib/activitypub/video-comments.ts4
-rw-r--r--server/lib/activitypub/videos.ts12
-rw-r--r--server/lib/avatar.ts4
-rw-r--r--server/lib/emailer.ts6
-rw-r--r--server/lib/job-queue/handlers/activitypub-follow.ts17
-rw-r--r--server/lib/job-queue/handlers/video-import.ts22
-rw-r--r--server/lib/notifier.ts6
-rw-r--r--server/lib/schedulers/videos-redundancy-scheduler.ts4
11 files changed, 53 insertions, 43 deletions
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts
index 7862b0f00..5201bdeef 100644
--- a/server/lib/activitypub/actor.ts
+++ b/server/lib/activitypub/actor.ts
@@ -24,15 +24,17 @@ import { ActorFetchByUrlType, fetchActorByUrl } from '../../helpers/actor'
24import { sequelizeTypescript } from '../../initializers/database' 24import { sequelizeTypescript } from '../../initializers/database'
25import { 25import {
26 MAccount, 26 MAccount,
27 MAccountDefault,
27 MActor, 28 MActor,
28 MActorAccountChannelId, 29 MActorAccountChannelId,
30 MActorAccountChannelIdActor,
29 MActorAccountId, 31 MActorAccountId,
30 MActorDefault, 32 MActorDefault,
31 MActorFull, 33 MActorFull,
34 MActorFullActor,
32 MActorId, 35 MActorId,
33 MActorAccountChannelIdActor,
34 MChannel, 36 MChannel,
35 MActorFullActor, MAccountActorDefault, MChannelActorDefault, MChannelActorAccountDefault 37 MChannelAccountDefault
36} from '../../typings/models' 38} from '../../typings/models'
37 39
38// Set account keys, this could be long so process after the account creation and do not block the client 40// Set account keys, this could be long so process after the account creation and do not block the client
@@ -374,12 +376,11 @@ function saveActorAndServerAndModelIfNotExist (
374 }) 376 })
375 377
376 if (actorCreated.type === 'Person' || actorCreated.type === 'Application') { 378 if (actorCreated.type === 'Person' || actorCreated.type === 'Application') {
377 actorCreated.Account = await saveAccount(actorCreated, result, t) as MAccountActorDefault 379 actorCreated.Account = await saveAccount(actorCreated, result, t) as MAccountDefault
378 actorCreated.Account.Actor = actorCreated 380 actorCreated.Account.Actor = actorCreated
379 } else if (actorCreated.type === 'Group') { // Video channel 381 } else if (actorCreated.type === 'Group') { // Video channel
380 actorCreated.VideoChannel = await saveVideoChannel(actorCreated, result, ownerActor, t) as MChannelActorAccountDefault 382 const channel = await saveVideoChannel(actorCreated, result, ownerActor, t)
381 actorCreated.VideoChannel.Actor = actorCreated 383 actorCreated.VideoChannel = Object.assign(channel, { Actor: actorCreated, Account: ownerActor.Account })
382 actorCreated.VideoChannel.Account = ownerActor.Account
383 } 384 }
384 385
385 actorCreated.Server = server 386 actorCreated.Server = server
diff --git a/server/lib/activitypub/process/process-announce.ts b/server/lib/activitypub/process/process-announce.ts
index 91a9ad72c..7e22125d5 100644
--- a/server/lib/activitypub/process/process-announce.ts
+++ b/server/lib/activitypub/process/process-announce.ts
@@ -7,7 +7,7 @@ import { getOrCreateVideoAndAccountAndChannel } from '../videos'
7import { Notifier } from '../../notifier' 7import { Notifier } from '../../notifier'
8import { logger } from '../../../helpers/logger' 8import { logger } from '../../../helpers/logger'
9import { APProcessorOptions } from '../../../typings/activitypub-processor.model' 9import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
10import { MActorSignature, MVideoAccountAllFiles } from '../../../typings/models' 10import { MActorSignature, MVideoAccountLightBlacklistAllFiles } from '../../../typings/models'
11 11
12async function processAnnounceActivity (options: APProcessorOptions<ActivityAnnounce>) { 12async function processAnnounceActivity (options: APProcessorOptions<ActivityAnnounce>) {
13 const { activity, byActor: actorAnnouncer } = options 13 const { activity, byActor: actorAnnouncer } = options
@@ -28,7 +28,7 @@ export {
28async function processVideoShare (actorAnnouncer: MActorSignature, activity: ActivityAnnounce, notify: boolean) { 28async function processVideoShare (actorAnnouncer: MActorSignature, activity: ActivityAnnounce, notify: boolean) {
29 const objectUri = typeof activity.object === 'string' ? activity.object : activity.object.id 29 const objectUri = typeof activity.object === 'string' ? activity.object : activity.object.id
30 30
31 let video: MVideoAccountAllFiles 31 let video: MVideoAccountLightBlacklistAllFiles
32 let videoCreated: boolean 32 let videoCreated: boolean
33 33
34 try { 34 try {
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts
index c45f09f52..bee853721 100644
--- a/server/lib/activitypub/process/process-create.ts
+++ b/server/lib/activitypub/process/process-create.ts
@@ -11,7 +11,7 @@ import { Notifier } from '../../notifier'
11import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' 11import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
12import { createOrUpdateVideoPlaylist } from '../playlist' 12import { createOrUpdateVideoPlaylist } from '../playlist'
13import { APProcessorOptions } from '../../../typings/activitypub-processor.model' 13import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
14import { MActorSignature, MCommentOwnerVideo, MVideoAccountAllFiles } from '../../../typings/models' 14import { MActorSignature, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../../typings/models'
15 15
16async function processCreateActivity (options: APProcessorOptions<ActivityCreate>) { 16async function processCreateActivity (options: APProcessorOptions<ActivityCreate>) {
17 const { activity, byActor } = options 17 const { activity, byActor } = options
@@ -81,7 +81,7 @@ async function processCreateVideoComment (activity: ActivityCreate, byActor: MAc
81 81
82 if (!byAccount) throw new Error('Cannot create video comment with the non account actor ' + byActor.url) 82 if (!byAccount) throw new Error('Cannot create video comment with the non account actor ' + byActor.url)
83 83
84 let video: MVideoAccountAllFiles 84 let video: MVideoAccountLightBlacklistAllFiles
85 let created: boolean 85 let created: boolean
86 let comment: MCommentOwnerVideo 86 let comment: MCommentOwnerVideo
87 try { 87 try {
diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts
index 375ac0aad..3e8306fa4 100644
--- a/server/lib/activitypub/video-comments.ts
+++ b/server/lib/activitypub/video-comments.ts
@@ -7,7 +7,7 @@ import { getOrCreateActorAndServerAndModel } from './actor'
7import { getOrCreateVideoAndAccountAndChannel } from './videos' 7import { getOrCreateVideoAndAccountAndChannel } from './videos'
8import * as Bluebird from 'bluebird' 8import * as Bluebird from 'bluebird'
9import { checkUrlsSameHost } from '../../helpers/activitypub' 9import { checkUrlsSameHost } from '../../helpers/activitypub'
10import { MCommentOwner, MCommentOwnerVideo, MVideoAccountAllFiles } from '../../typings/models/video' 10import { MCommentOwner, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../typings/models/video'
11 11
12type ResolveThreadParams = { 12type ResolveThreadParams = {
13 url: string, 13 url: string,
@@ -15,7 +15,7 @@ type ResolveThreadParams = {
15 isVideo?: boolean, 15 isVideo?: boolean,
16 commentCreated?: boolean 16 commentCreated?: boolean
17} 17}
18type ResolveThreadResult = Promise<{ video: MVideoAccountAllFiles, comment: MCommentOwnerVideo, commentCreated: boolean }> 18type ResolveThreadResult = Promise<{ video: MVideoAccountLightBlacklistAllFiles, comment: MCommentOwnerVideo, commentCreated: boolean }>
19 19
20async function addVideoComments (commentUrls: string[]) { 20async function addVideoComments (commentUrls: string[]) {
21 return Bluebird.map(commentUrls, commentUrl => { 21 return Bluebird.map(commentUrls, commentUrl => {
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts
index 035994da8..970a953fc 100644
--- a/server/lib/activitypub/videos.ts
+++ b/server/lib/activitypub/videos.ts
@@ -58,7 +58,7 @@ import {
58 MChannelDefault, 58 MChannelDefault,
59 MChannelId, 59 MChannelId,
60 MVideo, 60 MVideo,
61 MVideoAccountAllFiles, 61 MVideoAccountLightBlacklistAllFiles,
62 MVideoAccountLight, 62 MVideoAccountLight,
63 MVideoAP, 63 MVideoAP,
64 MVideoAPWithoutCaption, 64 MVideoAPWithoutCaption,
@@ -213,19 +213,19 @@ function getOrCreateVideoAndAccountAndChannel (options: {
213 syncParam?: SyncParam, 213 syncParam?: SyncParam,
214 fetchType?: 'all', 214 fetchType?: 'all',
215 allowRefresh?: boolean 215 allowRefresh?: boolean
216}): Promise<{ video: MVideoAccountAllFiles, created: boolean, autoBlacklisted?: boolean }> 216}): Promise<{ video: MVideoAccountLightBlacklistAllFiles, created: boolean, autoBlacklisted?: boolean }>
217function getOrCreateVideoAndAccountAndChannel (options: { 217function getOrCreateVideoAndAccountAndChannel (options: {
218 videoObject: { id: string } | string, 218 videoObject: { id: string } | string,
219 syncParam?: SyncParam, 219 syncParam?: SyncParam,
220 fetchType?: VideoFetchByUrlType, 220 fetchType?: VideoFetchByUrlType,
221 allowRefresh?: boolean 221 allowRefresh?: boolean
222}): Promise<{ video: MVideoAccountAllFiles | MVideoThumbnail, created: boolean, autoBlacklisted?: boolean }> 222}): Promise<{ video: MVideoAccountLightBlacklistAllFiles | MVideoThumbnail, created: boolean, autoBlacklisted?: boolean }>
223async function getOrCreateVideoAndAccountAndChannel (options: { 223async function getOrCreateVideoAndAccountAndChannel (options: {
224 videoObject: { id: string } | string, 224 videoObject: { id: string } | string,
225 syncParam?: SyncParam, 225 syncParam?: SyncParam,
226 fetchType?: VideoFetchByUrlType, 226 fetchType?: VideoFetchByUrlType,
227 allowRefresh?: boolean // true by default 227 allowRefresh?: boolean // true by default
228}): Promise<{ video: MVideoAccountAllFiles | MVideoThumbnail, created: boolean, autoBlacklisted?: boolean }> { 228}): Promise<{ video: MVideoAccountLightBlacklistAllFiles | MVideoThumbnail, created: boolean, autoBlacklisted?: boolean }> {
229 // Default params 229 // Default params
230 const syncParam = options.syncParam || { likes: true, dislikes: true, shares: true, comments: true, thumbnail: true, refreshVideo: false } 230 const syncParam = options.syncParam || { likes: true, dislikes: true, shares: true, comments: true, thumbnail: true, refreshVideo: false }
231 const fetchType = options.fetchType || 'all' 231 const fetchType = options.fetchType || 'all'
@@ -263,7 +263,7 @@ async function getOrCreateVideoAndAccountAndChannel (options: {
263} 263}
264 264
265async function updateVideoFromAP (options: { 265async function updateVideoFromAP (options: {
266 video: MVideoAccountAllFiles, 266 video: MVideoAccountLightBlacklistAllFiles,
267 videoObject: VideoTorrentObject, 267 videoObject: VideoTorrentObject,
268 account: MAccountActor, 268 account: MAccountActor,
269 channel: MChannelDefault, 269 channel: MChannelDefault,
@@ -420,7 +420,7 @@ async function refreshVideoIfNeeded (options: {
420 420
421 // We need more attributes if the argument video was fetched with not enough joints 421 // We need more attributes if the argument video was fetched with not enough joints
422 const video = options.fetchedType === 'all' 422 const video = options.fetchedType === 'all'
423 ? options.video as MVideoAccountAllFiles 423 ? options.video as MVideoAccountLightBlacklistAllFiles
424 : await VideoModel.loadByUrlAndPopulateAccount(options.video.url) 424 : await VideoModel.loadByUrlAndPopulateAccount(options.video.url)
425 425
426 try { 426 try {
diff --git a/server/lib/avatar.ts b/server/lib/avatar.ts
index 9005b3e22..ad4cdd3ab 100644
--- a/server/lib/avatar.ts
+++ b/server/lib/avatar.ts
@@ -11,11 +11,11 @@ import { sequelizeTypescript } from '../initializers/database'
11import * as LRUCache from 'lru-cache' 11import * as LRUCache from 'lru-cache'
12import { queue } from 'async' 12import { queue } from 'async'
13import { downloadImage } from '../helpers/requests' 13import { downloadImage } from '../helpers/requests'
14import { MAccountActorDefault, MChannelActorDefault } from '../typings/models' 14import { MAccountDefault, MChannelDefault } from '../typings/models'
15 15
16async function updateActorAvatarFile ( 16async function updateActorAvatarFile (
17 avatarPhysicalFile: Express.Multer.File, 17 avatarPhysicalFile: Express.Multer.File,
18 accountOrChannel: MAccountActorDefault | MChannelActorDefault 18 accountOrChannel: MAccountDefault | MChannelDefault
19) { 19) {
20 const extension = extname(avatarPhysicalFile.filename) 20 const extension = extname(avatarPhysicalFile.filename)
21 const avatarName = uuidv4() + extension 21 const avatarName = uuidv4() + extension
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts
index fe57a3e4c..a888b7a72 100644
--- a/server/lib/emailer.ts
+++ b/server/lib/emailer.ts
@@ -2,14 +2,12 @@ import { createTransport, Transporter } from 'nodemailer'
2import { isTestInstance } from '../helpers/core-utils' 2import { isTestInstance } from '../helpers/core-utils'
3import { bunyanLogger, logger } from '../helpers/logger' 3import { bunyanLogger, logger } from '../helpers/logger'
4import { CONFIG } from '../initializers/config' 4import { CONFIG } from '../initializers/config'
5import { UserModel } from '../models/account/user'
6import { JobQueue } from './job-queue' 5import { JobQueue } from './job-queue'
7import { EmailPayload } from './job-queue/handlers/email' 6import { EmailPayload } from './job-queue/handlers/email'
8import { readFileSync } from 'fs-extra' 7import { readFileSync } from 'fs-extra'
9import { VideoBlacklistModel } from '../models/video/video-blacklist'
10import { WEBSERVER } from '../initializers/constants' 8import { WEBSERVER } from '../initializers/constants'
11import { MCommentOwnerVideo, MVideo, MVideoAbuseVideo, MVideoAccountLight, MVideoBlacklistVideo } from '../typings/models/video' 9import { MCommentOwnerVideo, MVideo, MVideoAbuseVideo, MVideoAccountLight, MVideoBlacklistVideo } from '../typings/models/video'
12import { MActorFollowActors, MActorFollowFull, MUser } from '../typings/models' 10import { MActorFollowActors, MActorFollowFollowingFullFollowerAccount, MUser } from '../typings/models'
13import { MVideoImport, MVideoImportVideo } from '@server/typings/models/video/video-import' 11import { MVideoImport, MVideoImportVideo } from '@server/typings/models/video/video-import'
14 12
15type SendEmailOptions = { 13type SendEmailOptions = {
@@ -109,7 +107,7 @@ class Emailer {
109 return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload }) 107 return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload })
110 } 108 }
111 109
112 addNewFollowNotification (to: string[], actorFollow: MActorFollowFull, followType: 'account' | 'channel') { 110 addNewFollowNotification (to: string[], actorFollow: MActorFollowFollowingFullFollowerAccount, followType: 'account' | 'channel') {
113 const followerName = actorFollow.ActorFollower.Account.getDisplayName() 111 const followerName = actorFollow.ActorFollower.Account.getDisplayName()
114 const followingName = (actorFollow.ActorFollowing.VideoChannel || actorFollow.ActorFollowing.Account).getDisplayName() 112 const followingName = (actorFollow.ActorFollowing.VideoChannel || actorFollow.ActorFollowing.Account).getDisplayName()
115 113
diff --git a/server/lib/job-queue/handlers/activitypub-follow.ts b/server/lib/job-queue/handlers/activitypub-follow.ts
index 741b1ffde..5cb55cad6 100644
--- a/server/lib/job-queue/handlers/activitypub-follow.ts
+++ b/server/lib/job-queue/handlers/activitypub-follow.ts
@@ -10,7 +10,7 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
10import { ActorModel } from '../../../models/activitypub/actor' 10import { ActorModel } from '../../../models/activitypub/actor'
11import { Notifier } from '../../notifier' 11import { Notifier } from '../../notifier'
12import { sequelizeTypescript } from '../../../initializers/database' 12import { sequelizeTypescript } from '../../../initializers/database'
13import { MActorFollowFull, MActorFull } from '../../../typings/models' 13import { MAccount, MActor, MActorFollowActors, MActorFollowFull, MActorFull } from '../../../typings/models'
14 14
15export type ActivitypubFollowPayload = { 15export type ActivitypubFollowPayload = {
16 followerActorId: number 16 followerActorId: number
@@ -45,7 +45,7 @@ export {
45 45
46// --------------------------------------------------------------------------- 46// ---------------------------------------------------------------------------
47 47
48async function follow (fromActor: MActorFull, targetActor: MActorFull) { 48async function follow (fromActor: MActor, targetActor: MActorFull) {
49 if (fromActor.id === targetActor.id) { 49 if (fromActor.id === targetActor.id) {
50 throw new Error('Follower is the same than target actor.') 50 throw new Error('Follower is the same than target actor.')
51 } 51 }
@@ -54,7 +54,7 @@ async function follow (fromActor: MActorFull, targetActor: MActorFull) {
54 const state = !fromActor.serverId && !targetActor.serverId ? 'accepted' : 'pending' 54 const state = !fromActor.serverId && !targetActor.serverId ? 'accepted' : 'pending'
55 55
56 const actorFollow = await sequelizeTypescript.transaction(async t => { 56 const actorFollow = await sequelizeTypescript.transaction(async t => {
57 const [ actorFollow ] = await ActorFollowModel.findOrCreate<MActorFollowFull>({ 57 const [ actorFollow ] = await ActorFollowModel.findOrCreate<MActorFollowActors>({
58 where: { 58 where: {
59 actorId: fromActor.id, 59 actorId: fromActor.id,
60 targetActorId: targetActor.id 60 targetActorId: targetActor.id
@@ -75,5 +75,14 @@ async function follow (fromActor: MActorFull, targetActor: MActorFull) {
75 return actorFollow 75 return actorFollow
76 }) 76 })
77 77
78 if (actorFollow.state === 'accepted') Notifier.Instance.notifyOfNewUserFollow(actorFollow) 78 if (actorFollow.state === 'accepted') {
79 const followerFull = Object.assign(fromActor, { Account: await actorFollow.ActorFollower.$get('Account') as MAccount })
80
81 const actorFollowFull = Object.assign(actorFollow, {
82 ActorFollowing: targetActor,
83 ActorFollower: followerFull
84 })
85
86 Notifier.Instance.notifyOfNewUserFollow(actorFollowFull)
87 }
79} 88}
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts
index f9dda79f8..ff8c93328 100644
--- a/server/lib/job-queue/handlers/video-import.ts
+++ b/server/lib/job-queue/handlers/video-import.ts
@@ -111,13 +111,11 @@ type ProcessFileOptions = {
111 generateThumbnail: boolean 111 generateThumbnail: boolean
112 generatePreview: boolean 112 generatePreview: boolean
113} 113}
114async function processFile (downloader: () => Promise<string>, videoImportArg: MVideoImportDefault, options: ProcessFileOptions) { 114async function processFile (downloader: () => Promise<string>, videoImport: MVideoImportDefault, options: ProcessFileOptions) {
115 let tempVideoPath: string 115 let tempVideoPath: string
116 let videoDestFile: string 116 let videoDestFile: string
117 let videoFile: VideoFileModel 117 let videoFile: VideoFileModel
118 118
119 const videoImport = videoImportArg as MVideoImportDefaultFiles
120
121 try { 119 try {
122 // Download video from youtubeDL 120 // Download video from youtubeDL
123 tempVideoPath = await downloader() 121 tempVideoPath = await downloader()
@@ -142,35 +140,37 @@ async function processFile (downloader: () => Promise<string>, videoImportArg: M
142 videoId: videoImport.videoId 140 videoId: videoImport.videoId
143 } 141 }
144 videoFile = new VideoFileModel(videoFileData) 142 videoFile = new VideoFileModel(videoFileData)
143
144 const videoWithFiles = Object.assign(videoImport.Video, { VideoFiles: [ videoFile ] })
145 // To clean files if the import fails 145 // To clean files if the import fails
146 videoImport.Video.VideoFiles = [ videoFile ] 146 const videoImportWithFiles: MVideoImportDefaultFiles = Object.assign(videoImport, { Video: videoWithFiles })
147 147
148 // Move file 148 // Move file
149 videoDestFile = join(CONFIG.STORAGE.VIDEOS_DIR, videoImport.Video.getVideoFilename(videoFile)) 149 videoDestFile = join(CONFIG.STORAGE.VIDEOS_DIR, videoImportWithFiles.Video.getVideoFilename(videoFile))
150 await move(tempVideoPath, videoDestFile) 150 await move(tempVideoPath, videoDestFile)
151 tempVideoPath = null // This path is not used anymore 151 tempVideoPath = null // This path is not used anymore
152 152
153 // Process thumbnail 153 // Process thumbnail
154 let thumbnailModel: MThumbnail 154 let thumbnailModel: MThumbnail
155 if (options.downloadThumbnail && options.thumbnailUrl) { 155 if (options.downloadThumbnail && options.thumbnailUrl) {
156 thumbnailModel = await createVideoMiniatureFromUrl(options.thumbnailUrl, videoImport.Video, ThumbnailType.MINIATURE) 156 thumbnailModel = await createVideoMiniatureFromUrl(options.thumbnailUrl, videoImportWithFiles.Video, ThumbnailType.MINIATURE)
157 } else if (options.generateThumbnail || options.downloadThumbnail) { 157 } else if (options.generateThumbnail || options.downloadThumbnail) {
158 thumbnailModel = await generateVideoMiniature(videoImport.Video, videoFile, ThumbnailType.MINIATURE) 158 thumbnailModel = await generateVideoMiniature(videoImportWithFiles.Video, videoFile, ThumbnailType.MINIATURE)
159 } 159 }
160 160
161 // Process preview 161 // Process preview
162 let previewModel: MThumbnail 162 let previewModel: MThumbnail
163 if (options.downloadPreview && options.thumbnailUrl) { 163 if (options.downloadPreview && options.thumbnailUrl) {
164 previewModel = await createVideoMiniatureFromUrl(options.thumbnailUrl, videoImport.Video, ThumbnailType.PREVIEW) 164 previewModel = await createVideoMiniatureFromUrl(options.thumbnailUrl, videoImportWithFiles.Video, ThumbnailType.PREVIEW)
165 } else if (options.generatePreview || options.downloadPreview) { 165 } else if (options.generatePreview || options.downloadPreview) {
166 previewModel = await generateVideoMiniature(videoImport.Video, videoFile, ThumbnailType.PREVIEW) 166 previewModel = await generateVideoMiniature(videoImportWithFiles.Video, videoFile, ThumbnailType.PREVIEW)
167 } 167 }
168 168
169 // Create torrent 169 // Create torrent
170 await videoImport.Video.createTorrentAndSetInfoHash(videoFile) 170 await videoImportWithFiles.Video.createTorrentAndSetInfoHash(videoFile)
171 171
172 const { videoImportUpdated, video } = await sequelizeTypescript.transaction(async t => { 172 const { videoImportUpdated, video } = await sequelizeTypescript.transaction(async t => {
173 const videoImportToUpdate = videoImport as MVideoImportVideo 173 const videoImportToUpdate = videoImportWithFiles as MVideoImportVideo
174 174
175 // Refresh video 175 // Refresh video
176 const video = await VideoModel.load(videoImportToUpdate.videoId, t) 176 const video = await VideoModel.load(videoImportToUpdate.videoId, t)
diff --git a/server/lib/notifier.ts b/server/lib/notifier.ts
index f01101b8e..23f76a21a 100644
--- a/server/lib/notifier.ts
+++ b/server/lib/notifier.ts
@@ -21,7 +21,7 @@ import {
21 MVideoFullLight 21 MVideoFullLight
22} from '../typings/models/video' 22} from '../typings/models/video'
23import { MUser, MUserAccount, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/typings/models/user' 23import { MUser, MUserAccount, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/typings/models/user'
24import { MActorFollowActors, MActorFollowFull } from '../typings/models' 24import { MActorFollowActors, MActorFollowFull, MActorFollowFollowingFullFollowerAccount } from '../typings/models'
25import { ActorFollowModel } from '../models/activitypub/actor-follow' 25import { ActorFollowModel } from '../models/activitypub/actor-follow'
26import { MVideoImportVideo } from '@server/typings/models/video/video-import' 26import { MVideoImportVideo } from '@server/typings/models/video/video-import'
27import { AccountModel } from '@server/models/account/account' 27import { AccountModel } from '@server/models/account/account'
@@ -102,7 +102,7 @@ class Notifier {
102 .catch(err => logger.error('Cannot notify moderators of new user registration (%s).', user.username, { err })) 102 .catch(err => logger.error('Cannot notify moderators of new user registration (%s).', user.username, { err }))
103 } 103 }
104 104
105 notifyOfNewUserFollow (actorFollow: MActorFollowFull): void { 105 notifyOfNewUserFollow (actorFollow: MActorFollowFollowingFullFollowerAccount): void {
106 this.notifyUserOfNewActorFollow(actorFollow) 106 this.notifyUserOfNewActorFollow(actorFollow)
107 .catch(err => { 107 .catch(err => {
108 logger.error( 108 logger.error(
@@ -231,7 +231,7 @@ class Notifier {
231 return this.notify({ users, settingGetter, notificationCreator, emailSender }) 231 return this.notify({ users, settingGetter, notificationCreator, emailSender })
232 } 232 }
233 233
234 private async notifyUserOfNewActorFollow (actorFollow: MActorFollowFull) { 234 private async notifyUserOfNewActorFollow (actorFollow: MActorFollowFollowingFullFollowerAccount) {
235 if (actorFollow.ActorFollowing.isOwned() === false) return 235 if (actorFollow.ActorFollowing.isOwned() === false) return
236 236
237 // Account follows one of our account? 237 // Account follows one of our account?
diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts
index de8fc075b..d9018e606 100644
--- a/server/lib/schedulers/videos-redundancy-scheduler.ts
+++ b/server/lib/schedulers/videos-redundancy-scheduler.ts
@@ -32,7 +32,9 @@ type CandidateToDuplicate = {
32 streamingPlaylists: MStreamingPlaylist[] 32 streamingPlaylists: MStreamingPlaylist[]
33} 33}
34 34
35function isMVideoRedundancyFileVideo (o: MVideoRedundancyVideo): o is MVideoRedundancyFileVideo { 35function isMVideoRedundancyFileVideo (
36 o: MVideoRedundancyFileVideo | MVideoRedundancyStreamingPlaylistVideo
37): o is MVideoRedundancyFileVideo {
36 return !!(o as MVideoRedundancyFileVideo).VideoFile 38 return !!(o as MVideoRedundancyFileVideo).VideoFile
37} 39}
38 40