diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-20 11:21:08 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-20 11:21:08 +0100 |
commit | de94ac86a211dec657332d964693857ec235ce40 (patch) | |
tree | 3bff96a40e7c862d83561a26249992b07331b0a2 /server/lib/schedulers/videos-redundancy-scheduler.ts | |
parent | 3fba4b6bce69247b1d37f923894d8f44818a891c (diff) | |
download | PeerTube-de94ac86a211dec657332d964693857ec235ce40.tar.gz PeerTube-de94ac86a211dec657332d964693857ec235ce40.tar.zst PeerTube-de94ac86a211dec657332d964693857ec235ce40.zip |
Fix incorrect IDs in AP federation
Diffstat (limited to 'server/lib/schedulers/videos-redundancy-scheduler.ts')
-rw-r--r-- | server/lib/schedulers/videos-redundancy-scheduler.ts | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts index 54d9a9894..82005a2c8 100644 --- a/server/lib/schedulers/videos-redundancy-scheduler.ts +++ b/server/lib/schedulers/videos-redundancy-scheduler.ts | |||
@@ -1,19 +1,10 @@ | |||
1 | import { AbstractScheduler } from './abstract-scheduler' | ||
2 | import { HLS_REDUNDANCY_DIRECTORY, REDUNDANCY, VIDEO_IMPORT_TIMEOUT, WEBSERVER } from '../../initializers/constants' | ||
3 | import { logger } from '../../helpers/logger' | ||
4 | import { VideosRedundancyStrategy } from '../../../shared/models/redundancy' | ||
5 | import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' | ||
6 | import { downloadWebTorrentVideo, generateMagnetUri } from '../../helpers/webtorrent' | ||
7 | import { join } from 'path' | ||
8 | import { move } from 'fs-extra' | 1 | import { move } from 'fs-extra' |
9 | import { sendCreateCacheFile, sendUpdateCacheFile } from '../activitypub/send' | 2 | import { join } from 'path' |
10 | import { getVideoCacheFileActivityPubUrl, getVideoCacheStreamingPlaylistActivityPubUrl } from '../activitypub/url' | 3 | import { getServerActor } from '@server/models/application/application' |
11 | import { removeVideoRedundancy } from '../redundancy' | 4 | import { VideoModel } from '@server/models/video/video' |
12 | import { getOrCreateVideoAndAccountAndChannel } from '../activitypub/videos' | ||
13 | import { downloadPlaylistSegments } from '../hls' | ||
14 | import { CONFIG } from '../../initializers/config' | ||
15 | import { | 5 | import { |
16 | MStreamingPlaylist, MStreamingPlaylistFiles, | 6 | MStreamingPlaylist, |
7 | MStreamingPlaylistFiles, | ||
17 | MStreamingPlaylistVideo, | 8 | MStreamingPlaylistVideo, |
18 | MVideoAccountLight, | 9 | MVideoAccountLight, |
19 | MVideoFile, | 10 | MVideoFile, |
@@ -23,9 +14,19 @@ import { | |||
23 | MVideoRedundancyVideo, | 14 | MVideoRedundancyVideo, |
24 | MVideoWithAllFiles | 15 | MVideoWithAllFiles |
25 | } from '@server/types/models' | 16 | } from '@server/types/models' |
17 | import { VideosRedundancyStrategy } from '../../../shared/models/redundancy' | ||
18 | import { logger } from '../../helpers/logger' | ||
19 | import { downloadWebTorrentVideo, generateMagnetUri } from '../../helpers/webtorrent' | ||
20 | import { CONFIG } from '../../initializers/config' | ||
21 | import { HLS_REDUNDANCY_DIRECTORY, REDUNDANCY, VIDEO_IMPORT_TIMEOUT, WEBSERVER } from '../../initializers/constants' | ||
22 | import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' | ||
23 | import { sendCreateCacheFile, sendUpdateCacheFile } from '../activitypub/send' | ||
24 | import { getLocalVideoCacheFileActivityPubUrl, getLocalVideoCacheStreamingPlaylistActivityPubUrl } from '../activitypub/url' | ||
25 | import { getOrCreateVideoAndAccountAndChannel } from '../activitypub/videos' | ||
26 | import { downloadPlaylistSegments } from '../hls' | ||
27 | import { removeVideoRedundancy } from '../redundancy' | ||
26 | import { getVideoFilename } from '../video-paths' | 28 | import { getVideoFilename } from '../video-paths' |
27 | import { VideoModel } from '@server/models/video/video' | 29 | import { AbstractScheduler } from './abstract-scheduler' |
28 | import { getServerActor } from '@server/models/application/application' | ||
29 | 30 | ||
30 | type CandidateToDuplicate = { | 31 | type CandidateToDuplicate = { |
31 | redundancy: VideosRedundancyStrategy | 32 | redundancy: VideosRedundancyStrategy |
@@ -230,7 +231,7 @@ export class VideosRedundancyScheduler extends AbstractScheduler { | |||
230 | 231 | ||
231 | const createdModel: MVideoRedundancyFileVideo = await VideoRedundancyModel.create({ | 232 | const createdModel: MVideoRedundancyFileVideo = await VideoRedundancyModel.create({ |
232 | expiresOn, | 233 | expiresOn, |
233 | url: getVideoCacheFileActivityPubUrl(file), | 234 | url: getLocalVideoCacheFileActivityPubUrl(file), |
234 | fileUrl: video.getVideoRedundancyUrl(file, WEBSERVER.URL), | 235 | fileUrl: video.getVideoRedundancyUrl(file, WEBSERVER.URL), |
235 | strategy, | 236 | strategy, |
236 | videoFileId: file.id, | 237 | videoFileId: file.id, |
@@ -269,7 +270,7 @@ export class VideosRedundancyScheduler extends AbstractScheduler { | |||
269 | 270 | ||
270 | const createdModel: MVideoRedundancyStreamingPlaylistVideo = await VideoRedundancyModel.create({ | 271 | const createdModel: MVideoRedundancyStreamingPlaylistVideo = await VideoRedundancyModel.create({ |
271 | expiresOn, | 272 | expiresOn, |
272 | url: getVideoCacheStreamingPlaylistActivityPubUrl(video, playlist), | 273 | url: getLocalVideoCacheStreamingPlaylistActivityPubUrl(video, playlist), |
273 | fileUrl: playlist.getVideoRedundancyUrl(WEBSERVER.URL), | 274 | fileUrl: playlist.getVideoRedundancyUrl(WEBSERVER.URL), |
274 | strategy, | 275 | strategy, |
275 | videoStreamingPlaylistId: playlist.id, | 276 | videoStreamingPlaylistId: playlist.id, |