aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/schedulers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-20 11:21:08 +0100
committerChocobozzz <me@florianbigard.com>2020-11-20 11:21:08 +0100
commitde94ac86a211dec657332d964693857ec235ce40 (patch)
tree3bff96a40e7c862d83561a26249992b07331b0a2 /server/lib/schedulers
parent3fba4b6bce69247b1d37f923894d8f44818a891c (diff)
downloadPeerTube-de94ac86a211dec657332d964693857ec235ce40.tar.gz
PeerTube-de94ac86a211dec657332d964693857ec235ce40.tar.zst
PeerTube-de94ac86a211dec657332d964693857ec235ce40.zip
Fix incorrect IDs in AP federation
Diffstat (limited to 'server/lib/schedulers')
-rw-r--r--server/lib/schedulers/videos-redundancy-scheduler.ts37
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 @@
1import { AbstractScheduler } from './abstract-scheduler'
2import { HLS_REDUNDANCY_DIRECTORY, REDUNDANCY, VIDEO_IMPORT_TIMEOUT, WEBSERVER } from '../../initializers/constants'
3import { logger } from '../../helpers/logger'
4import { VideosRedundancyStrategy } from '../../../shared/models/redundancy'
5import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
6import { downloadWebTorrentVideo, generateMagnetUri } from '../../helpers/webtorrent'
7import { join } from 'path'
8import { move } from 'fs-extra' 1import { move } from 'fs-extra'
9import { sendCreateCacheFile, sendUpdateCacheFile } from '../activitypub/send' 2import { join } from 'path'
10import { getVideoCacheFileActivityPubUrl, getVideoCacheStreamingPlaylistActivityPubUrl } from '../activitypub/url' 3import { getServerActor } from '@server/models/application/application'
11import { removeVideoRedundancy } from '../redundancy' 4import { VideoModel } from '@server/models/video/video'
12import { getOrCreateVideoAndAccountAndChannel } from '../activitypub/videos'
13import { downloadPlaylistSegments } from '../hls'
14import { CONFIG } from '../../initializers/config'
15import { 5import {
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'
17import { VideosRedundancyStrategy } from '../../../shared/models/redundancy'
18import { logger } from '../../helpers/logger'
19import { downloadWebTorrentVideo, generateMagnetUri } from '../../helpers/webtorrent'
20import { CONFIG } from '../../initializers/config'
21import { HLS_REDUNDANCY_DIRECTORY, REDUNDANCY, VIDEO_IMPORT_TIMEOUT, WEBSERVER } from '../../initializers/constants'
22import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
23import { sendCreateCacheFile, sendUpdateCacheFile } from '../activitypub/send'
24import { getLocalVideoCacheFileActivityPubUrl, getLocalVideoCacheStreamingPlaylistActivityPubUrl } from '../activitypub/url'
25import { getOrCreateVideoAndAccountAndChannel } from '../activitypub/videos'
26import { downloadPlaylistSegments } from '../hls'
27import { removeVideoRedundancy } from '../redundancy'
26import { getVideoFilename } from '../video-paths' 28import { getVideoFilename } from '../video-paths'
27import { VideoModel } from '@server/models/video/video' 29import { AbstractScheduler } from './abstract-scheduler'
28import { getServerActor } from '@server/models/application/application'
29 30
30type CandidateToDuplicate = { 31type 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,