diff options
Diffstat (limited to 'server/lib/video-privacy.ts')
-rw-r--r-- | server/lib/video-privacy.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/server/lib/video-privacy.ts b/server/lib/video-privacy.ts index 39430ef1e..5dd4d9781 100644 --- a/server/lib/video-privacy.ts +++ b/server/lib/video-privacy.ts | |||
@@ -4,7 +4,7 @@ import { logger } from '@server/helpers/logger' | |||
4 | import { DIRECTORIES } from '@server/initializers/constants' | 4 | import { DIRECTORIES } from '@server/initializers/constants' |
5 | import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' | 5 | import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' |
6 | import { VideoPrivacy, VideoStorage } from '@shared/models' | 6 | import { VideoPrivacy, VideoStorage } from '@shared/models' |
7 | import { updateHLSFilesACL, updateWebTorrentFileACL } from './object-storage' | 7 | import { updateHLSFilesACL, updateWebVideoFileACL } from './object-storage' |
8 | 8 | ||
9 | const validPrivacySet = new Set([ | 9 | const validPrivacySet = new Set([ |
10 | VideoPrivacy.PRIVATE, | 10 | VideoPrivacy.PRIVATE, |
@@ -67,9 +67,9 @@ async function moveFiles (options: { | |||
67 | 67 | ||
68 | for (const file of video.VideoFiles) { | 68 | for (const file of video.VideoFiles) { |
69 | if (file.storage === VideoStorage.FILE_SYSTEM) { | 69 | if (file.storage === VideoStorage.FILE_SYSTEM) { |
70 | await moveWebTorrentFileOnFS(type, video, file) | 70 | await moveWebVideoFileOnFS(type, video, file) |
71 | } else { | 71 | } else { |
72 | await updateWebTorrentFileACL(video, file) | 72 | await updateWebVideoFileACL(video, file) |
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
@@ -84,22 +84,22 @@ async function moveFiles (options: { | |||
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | async function moveWebTorrentFileOnFS (type: MoveType, video: MVideo, file: MVideoFile) { | 87 | async function moveWebVideoFileOnFS (type: MoveType, video: MVideo, file: MVideoFile) { |
88 | const directories = getWebTorrentDirectories(type) | 88 | const directories = getWebVideoDirectories(type) |
89 | 89 | ||
90 | const source = join(directories.old, file.filename) | 90 | const source = join(directories.old, file.filename) |
91 | const destination = join(directories.new, file.filename) | 91 | const destination = join(directories.new, file.filename) |
92 | 92 | ||
93 | try { | 93 | try { |
94 | logger.info('Moving WebTorrent files of %s after privacy change (%s -> %s).', video.uuid, source, destination) | 94 | logger.info('Moving web video files of %s after privacy change (%s -> %s).', video.uuid, source, destination) |
95 | 95 | ||
96 | await move(source, destination) | 96 | await move(source, destination) |
97 | } catch (err) { | 97 | } catch (err) { |
98 | logger.error('Cannot move webtorrent file %s to %s after privacy change', source, destination, { err }) | 98 | logger.error('Cannot move web video file %s to %s after privacy change', source, destination, { err }) |
99 | } | 99 | } |
100 | } | 100 | } |
101 | 101 | ||
102 | function getWebTorrentDirectories (moveType: MoveType) { | 102 | function getWebVideoDirectories (moveType: MoveType) { |
103 | if (moveType === 'private-to-public') { | 103 | if (moveType === 'private-to-public') { |
104 | return { old: DIRECTORIES.VIDEOS.PRIVATE, new: DIRECTORIES.VIDEOS.PUBLIC } | 104 | return { old: DIRECTORIES.VIDEOS.PRIVATE, new: DIRECTORIES.VIDEOS.PUBLIC } |
105 | } | 105 | } |