aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/video-privacy.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/video-privacy.ts')
-rw-r--r--server/lib/video-privacy.ts16
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'
4import { DIRECTORIES } from '@server/initializers/constants' 4import { DIRECTORIES } from '@server/initializers/constants'
5import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' 5import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
6import { VideoPrivacy, VideoStorage } from '@shared/models' 6import { VideoPrivacy, VideoStorage } from '@shared/models'
7import { updateHLSFilesACL, updateWebTorrentFileACL } from './object-storage' 7import { updateHLSFilesACL, updateWebVideoFileACL } from './object-storage'
8 8
9const validPrivacySet = new Set([ 9const 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
87async function moveWebTorrentFileOnFS (type: MoveType, video: MVideo, file: MVideoFile) { 87async 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
102function getWebTorrentDirectories (moveType: MoveType) { 102function 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 }