1
0
Fork 0

Rename "videos" config to "web-videos"

This commit is contained in:
Chocobozzz 2023-07-11 11:23:51 +02:00
parent 76824f522a
commit d732ec7b46
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
32 changed files with 69 additions and 68 deletions

1
.gitignore vendored
View File

@ -23,6 +23,7 @@ yarn-error.log
/ffmpeg-4/
/thumbnails/
/torrents/
/web-videos/
/videos/
/previews/
/logs/

View File

@ -130,7 +130,7 @@ storage:
tmp_persistent: 'storage/tmp-persistent/' # As tmp but the directory is not cleaned up between PeerTube restarts
bin: 'storage/bin/'
avatars: 'storage/avatars/'
videos: 'storage/videos/'
web_videos: 'storage/web-videos/'
streaming_playlists: 'storage/streaming-playlists/'
redundancy: 'storage/redundancy/'
logs: 'storage/logs/'
@ -202,8 +202,8 @@ object_storage:
base_url: '' # Example: 'https://mirror.example.com'
# Same settings but for web videos
videos:
bucket_name: 'videos'
web_videos:
bucket_name: 'web-videos'
prefix: ''
base_url: ''

View File

@ -128,7 +128,7 @@ storage:
tmp_persistent: '/var/www/peertube/storage/tmp-persistent/' # As tmp but the directory is not cleaned up between PeerTube restarts
bin: '/var/www/peertube/storage/bin/'
avatars: '/var/www/peertube/storage/avatars/'
videos: '/var/www/peertube/storage/videos/'
web_videos: '/var/www/peertube/storage/web-videos/'
streaming_playlists: '/var/www/peertube/storage/streaming-playlists/'
redundancy: '/var/www/peertube/storage/redundancy/'
logs: '/var/www/peertube/storage/logs/'
@ -200,8 +200,8 @@ object_storage:
base_url: '' # Example: 'https://mirror.example.com'
# Same settings but for web videos
videos:
bucket_name: 'videos'
web_videos:
bucket_name: 'web-videos'
prefix: ''
base_url: ''

View File

@ -13,7 +13,7 @@ storage:
tmp_persistent: 'test1/tmp-persistent/'
bin: 'test1/bin/'
avatars: 'test1/avatars/'
videos: 'test1/videos/'
web_videos: 'test1/web-videos/'
streaming_playlists: 'test1/streaming-playlists/'
redundancy: 'test1/redundancy/'
logs: 'test1/logs/'

View File

@ -13,7 +13,7 @@ storage:
tmp_persistent: 'test2/tmp-persistent/'
bin: 'test2/bin/'
avatars: 'test2/avatars/'
videos: 'test2/videos/'
web_videos: 'test2/web-videos/'
streaming_playlists: 'test2/streaming-playlists/'
redundancy: 'test2/redundancy/'
logs: 'test2/logs/'

View File

@ -13,7 +13,7 @@ storage:
tmp_persistent: 'test3/tmp-persistent/'
bin: 'test3/bin/'
avatars: 'test3/avatars/'
videos: 'test3/videos/'
web_videos: 'test3/web-videos/'
streaming_playlists: 'test3/streaming-playlists/'
redundancy: 'test3/redundancy/'
logs: 'test3/logs/'

View File

@ -13,7 +13,7 @@ storage:
tmp_persistent: 'test4/tmp-persistent/'
bin: 'test4/bin/'
avatars: 'test4/avatars/'
videos: 'test4/videos/'
web_videos: 'test4/web-videos/'
streaming_playlists: 'test4/streaming-playlists/'
redundancy: 'test4/redundancy/'
logs: 'test4/logs/'

View File

@ -13,7 +13,7 @@ storage:
tmp_persistent: 'test5/tmp-persistent/'
bin: 'test5/bin/'
avatars: 'test5/avatars/'
videos: 'test5/videos/'
web_videos: 'test5/web-videos/'
streaming_playlists: 'test5/streaming-playlists/'
redundancy: 'test5/redundancy/'
logs: 'test5/logs/'

View File

@ -13,7 +13,7 @@ storage:
tmp_persistent: 'test6/tmp-persistent/'
bin: 'test6/bin/'
avatars: 'test6/avatars/'
videos: 'test6/videos/'
web_videos: 'test6/web-videos/'
streaming_playlists: 'test6/streaming-playlists/'
redundancy: 'test6/redundancy/'
logs: 'test6/logs/'

View File

@ -78,7 +78,7 @@ async function fillAvatarSizeIfNeeded (accountOrChannel: MAccountDefault | MChan
console.log('Filling size of avatars of %s.', accountOrChannel.name)
const { width, height } = await getImageSize(join(CONFIG.STORAGE.ACTOR_IMAGES, avatar.filename))
const { width, height } = await getImageSize(join(CONFIG.STORAGE.ACTOR_IMAGES_DIR, avatar.filename))
avatar.width = width
avatar.height = height
@ -107,8 +107,8 @@ async function generateSmallerAvatar (actor: MActorDefault) {
const sourceFilename = bigAvatar.filename
const newImageName = buildUUID() + getLowercaseExtension(sourceFilename)
const source = join(CONFIG.STORAGE.ACTOR_IMAGES, sourceFilename)
const destination = join(CONFIG.STORAGE.ACTOR_IMAGES, newImageName)
const source = join(CONFIG.STORAGE.ACTOR_IMAGES_DIR, sourceFilename)
const destination = join(CONFIG.STORAGE.ACTOR_IMAGES_DIR, newImageName)
await processImage({ path: source, destination, newSize: imageSize, keepOriginal: true })

View File

@ -50,7 +50,7 @@ async function run () {
await pruneDirectory(CONFIG.STORAGE.PREVIEWS_DIR, doesThumbnailExist(true, ThumbnailType.PREVIEW)),
await pruneDirectory(CONFIG.STORAGE.THUMBNAILS_DIR, doesThumbnailExist(false, ThumbnailType.MINIATURE)),
await pruneDirectory(CONFIG.STORAGE.ACTOR_IMAGES, doesActorImageExist)
await pruneDirectory(CONFIG.STORAGE.ACTOR_IMAGES_DIR, doesActorImageExist)
)
const tmpFiles = await readdir(CONFIG.STORAGE.TMP_DIR)

View File

@ -217,7 +217,7 @@ function checkStorageConfig () {
}
}
if (CONFIG.STORAGE.VIDEOS_DIR === CONFIG.STORAGE.REDUNDANCY_DIR) {
if (CONFIG.STORAGE.WEB_VIDEOS_DIR === CONFIG.STORAGE.REDUNDANCY_DIR) {
logger.warn('Redundancy directory should be different than the videos folder.')
}
}
@ -290,7 +290,7 @@ function checkLiveConfig () {
function checkObjectStorageConfig () {
if (CONFIG.OBJECT_STORAGE.ENABLED === true) {
if (!CONFIG.OBJECT_STORAGE.VIDEOS.BUCKET_NAME) {
if (!CONFIG.OBJECT_STORAGE.WEB_VIDEOS.BUCKET_NAME) {
throw new Error('videos_bucket should be set when object storage support is enabled.')
}
@ -299,10 +299,10 @@ function checkObjectStorageConfig () {
}
if (
CONFIG.OBJECT_STORAGE.VIDEOS.BUCKET_NAME === CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS.BUCKET_NAME &&
CONFIG.OBJECT_STORAGE.VIDEOS.PREFIX === CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS.PREFIX
CONFIG.OBJECT_STORAGE.WEB_VIDEOS.BUCKET_NAME === CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS.BUCKET_NAME &&
CONFIG.OBJECT_STORAGE.WEB_VIDEOS.PREFIX === CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS.PREFIX
) {
if (CONFIG.OBJECT_STORAGE.VIDEOS.PREFIX === '') {
if (CONFIG.OBJECT_STORAGE.WEB_VIDEOS.PREFIX === '') {
throw new Error('Object storage bucket prefixes should be set when the same bucket is used for both types of video.')
}

View File

@ -18,7 +18,7 @@ function checkMissedConfig () {
'database.hostname', 'database.port', 'database.username', 'database.password', 'database.pool.max',
'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address',
'email.body.signature', 'email.subject.prefix',
'storage.avatars', 'storage.videos', 'storage.logs', 'storage.previews', 'storage.thumbnails', 'storage.torrents', 'storage.cache',
'storage.avatars', 'storage.web_videos', 'storage.logs', 'storage.previews', 'storage.thumbnails', 'storage.torrents', 'storage.cache',
'storage.redundancy', 'storage.tmp', 'storage.streaming_playlists', 'storage.plugins', 'storage.well_known',
'log.level', 'log.rotation.enabled', 'log.rotation.max_file_size', 'log.rotation.max_files', 'log.anonymize_ip',
'log.log_ping_requests', 'log.log_tracker_unknown_infohash', 'log.prettify_sql', 'log.accept_client_log',
@ -60,8 +60,8 @@ function checkMissedConfig () {
'object_storage.enabled', 'object_storage.endpoint', 'object_storage.region', 'object_storage.upload_acl.public',
'object_storage.upload_acl.private', 'object_storage.proxy.proxify_private_files', 'object_storage.credentials.access_key_id',
'object_storage.credentials.secret_access_key', 'object_storage.max_upload_part', 'object_storage.streaming_playlists.bucket_name',
'object_storage.streaming_playlists.prefix', 'object_storage.streaming_playlists.base_url', 'object_storage.videos.bucket_name',
'object_storage.videos.prefix', 'object_storage.videos.base_url',
'object_storage.streaming_playlists.prefix', 'object_storage.streaming_playlists.base_url', 'object_storage.web_videos.bucket_name',
'object_storage.web_videos.prefix', 'object_storage.web_videos.base_url',
'theme.default',
'feeds.videos.count', 'feeds.comments.count',
'geo_ip.enabled', 'geo_ip.country.database_url',

View File

@ -106,9 +106,9 @@ const CONFIG = {
TMP_DIR: buildPath(config.get<string>('storage.tmp')),
TMP_PERSISTENT_DIR: buildPath(config.get<string>('storage.tmp_persistent')),
BIN_DIR: buildPath(config.get<string>('storage.bin')),
ACTOR_IMAGES: buildPath(config.get<string>('storage.avatars')),
ACTOR_IMAGES_DIR: buildPath(config.get<string>('storage.avatars')),
LOG_DIR: buildPath(config.get<string>('storage.logs')),
VIDEOS_DIR: buildPath(config.get<string>('storage.videos')),
WEB_VIDEOS_DIR: buildPath(config.get<string>('storage.web_videos')),
STREAMING_PLAYLISTS_DIR: buildPath(config.get<string>('storage.streaming_playlists')),
REDUNDANCY_DIR: buildPath(config.get<string>('storage.redundancy')),
THUMBNAILS_DIR: buildPath(config.get<string>('storage.thumbnails')),
@ -140,10 +140,10 @@ const CONFIG = {
PROXY: {
PROXIFY_PRIVATE_FILES: config.get<boolean>('object_storage.proxy.proxify_private_files')
},
VIDEOS: {
BUCKET_NAME: config.get<string>('object_storage.videos.bucket_name'),
PREFIX: config.get<string>('object_storage.videos.prefix'),
BASE_URL: config.get<string>('object_storage.videos.base_url')
WEB_VIDEOS: {
BUCKET_NAME: config.get<string>('object_storage.web_videos.bucket_name'),
PREFIX: config.get<string>('object_storage.web_videos.prefix'),
BASE_URL: config.get<string>('object_storage.web_videos.base_url')
},
STREAMING_PLAYLISTS: {
BUCKET_NAME: config.get<string>('object_storage.streaming_playlists.bucket_name'),

View File

@ -881,8 +881,8 @@ const DIRECTORIES = {
},
VIDEOS: {
PUBLIC: CONFIG.STORAGE.VIDEOS_DIR,
PRIVATE: join(CONFIG.STORAGE.VIDEOS_DIR, 'private')
PUBLIC: CONFIG.STORAGE.WEB_VIDEOS_DIR,
PRIVATE: join(CONFIG.STORAGE.WEB_VIDEOS_DIR, 'private')
},
HLS_REDUNDANCY: join(CONFIG.STORAGE.REDUNDANCY_DIR, 'hls')

View File

@ -7,7 +7,7 @@ import { AbstractPermanentFileCache } from './shared'
export class AvatarPermanentFileCache extends AbstractPermanentFileCache<MActorImage> {
constructor () {
super(CONFIG.STORAGE.ACTOR_IMAGES)
super(CONFIG.STORAGE.ACTOR_IMAGES_DIR)
}
protected loadModel (filename: string) {

View File

@ -40,7 +40,7 @@ export async function updateLocalActorImageFiles (
const extension = getLowercaseExtension(imagePhysicalFile.filename)
const imageName = buildUUID() + extension
const destination = join(CONFIG.STORAGE.ACTOR_IMAGES, imageName)
const destination = join(CONFIG.STORAGE.ACTOR_IMAGES_DIR, imageName)
await processImageFromWorker({ path: imagePhysicalFile.path, destination, newSize: imageSize, keepOriginal: true })
return {

View File

@ -15,8 +15,8 @@ export async function generateWebVideoPresignedUrl (options: {
const key = generateWebVideoObjectStorageKey(file.filename)
const command = new GetObjectCommand({
Bucket: CONFIG.OBJECT_STORAGE.VIDEOS.BUCKET_NAME,
Key: buildKey(key, CONFIG.OBJECT_STORAGE.VIDEOS),
Bucket: CONFIG.OBJECT_STORAGE.WEB_VIDEOS.BUCKET_NAME,
Key: buildKey(key, CONFIG.OBJECT_STORAGE.WEB_VIDEOS),
ResponseContentDisposition: `attachment; filename=${downloadFilename}`
})

View File

@ -10,7 +10,7 @@ function getInternalUrl (config: BucketInfo, keyWithoutPrefix: string) {
// ---------------------------------------------------------------------------
function getWebVideoPublicFileUrl (fileUrl: string) {
const baseUrl = CONFIG.OBJECT_STORAGE.VIDEOS.BASE_URL
const baseUrl = CONFIG.OBJECT_STORAGE.WEB_VIDEOS.BASE_URL
if (!baseUrl) return fileUrl
return replaceByBaseUrl(fileUrl, baseUrl)

View File

@ -59,7 +59,7 @@ function storeWebVideoFile (video: MVideo, file: MVideoFile) {
return storeObject({
inputPath: VideoPathManager.Instance.getFSVideoFileOutputPath(video, file),
objectStorageKey: generateWebVideoObjectStorageKey(file.filename),
bucketInfo: CONFIG.OBJECT_STORAGE.VIDEOS,
bucketInfo: CONFIG.OBJECT_STORAGE.WEB_VIDEOS,
isPrivate: video.hasPrivateStaticPath()
})
}
@ -69,7 +69,7 @@ function storeWebVideoFile (video: MVideo, file: MVideoFile) {
async function updateWebVideoFileACL (video: MVideo, file: MVideoFile) {
await updateObjectACL({
objectStorageKey: generateWebVideoObjectStorageKey(file.filename),
bucketInfo: CONFIG.OBJECT_STORAGE.VIDEOS,
bucketInfo: CONFIG.OBJECT_STORAGE.WEB_VIDEOS,
isPrivate: video.hasPrivateStaticPath()
})
}
@ -103,7 +103,7 @@ function removeHLSFileObjectStorageByFullKey (key: string) {
// ---------------------------------------------------------------------------
function removeWebVideoObjectStorage (videoFile: MVideoFile) {
return removeObject(generateWebVideoObjectStorageKey(videoFile.filename), CONFIG.OBJECT_STORAGE.VIDEOS)
return removeObject(generateWebVideoObjectStorageKey(videoFile.filename), CONFIG.OBJECT_STORAGE.WEB_VIDEOS)
}
// ---------------------------------------------------------------------------
@ -130,7 +130,7 @@ async function makeWebVideoFileAvailable (filename: string, destination: string)
await makeAvailable({
key,
destination,
bucketInfo: CONFIG.OBJECT_STORAGE.VIDEOS
bucketInfo: CONFIG.OBJECT_STORAGE.WEB_VIDEOS
})
return destination
@ -148,7 +148,7 @@ function getWebVideoFileReadStream (options: {
return createObjectReadStream({
key,
bucketInfo: CONFIG.OBJECT_STORAGE.VIDEOS,
bucketInfo: CONFIG.OBJECT_STORAGE.WEB_VIDEOS,
rangeHeader
})
}

View File

@ -157,11 +157,11 @@ export class ActorImageModel extends Model<Partial<AttributesOnly<ActorImageMode
}
getPath () {
return join(CONFIG.STORAGE.ACTOR_IMAGES, this.filename)
return join(CONFIG.STORAGE.ACTOR_IMAGES_DIR, this.filename)
}
removeImage () {
const imagePath = join(CONFIG.STORAGE.ACTOR_IMAGES, this.filename)
const imagePath = join(CONFIG.STORAGE.ACTOR_IMAGES_DIR, this.filename)
return remove(imagePath)
}

View File

@ -181,7 +181,7 @@ function runTestSuite (options: {
: undefined
},
videos: {
web_videos: {
bucket_name: options.webVideoBucket,
prefix: options.webVideoPrefix,
base_url: baseMockUrl
@ -308,7 +308,7 @@ describe('Object storage for videos', function () {
bucket_name: 'aaa'
},
videos: {
web_videos: {
bucket_name: 'aaa'
}
}
@ -386,7 +386,7 @@ describe('Object storage for videos', function () {
describe('Test simple object storage', function () {
runTestSuite({
playlistBucket: objectStorage.getMockBucketName('streaming-playlists'),
webVideoBucket: objectStorage.getMockBucketName('videos')
webVideoBucket: objectStorage.getMockBucketName('web-videos')
})
})
@ -431,7 +431,7 @@ describe('Object storage for videos', function () {
runTestSuite({
maxUploadPart,
playlistBucket: objectStorage.getMockBucketName('streaming-playlists'),
webVideoBucket: objectStorage.getMockBucketName('videos'),
webVideoBucket: objectStorage.getMockBucketName('web-videos'),
fixture
})
})

View File

@ -160,7 +160,7 @@ async function check2Webseeds (videoUUID?: string) {
const directories = [
servers[0].getDirectoryPath('redundancy'),
servers[1].getDirectoryPath('videos')
servers[1].getDirectoryPath('web-videos')
]
for (const directory of directories) {

View File

@ -75,8 +75,8 @@ describe('Test HLS videos', function () {
it('Should have the playlists/segment deleted from the disk', async function () {
for (const server of servers) {
await checkDirectoryIsEmpty(server, 'videos', [ 'private' ])
await checkDirectoryIsEmpty(server, join('videos', 'private'))
await checkDirectoryIsEmpty(server, 'web-videos', [ 'private' ])
await checkDirectoryIsEmpty(server, join('web-videos', 'private'))
await checkDirectoryIsEmpty(server, join('streaming-playlists', 'hls'), [ 'private' ])
await checkDirectoryIsEmpty(server, join('streaming-playlists', 'hls', 'private'))

View File

@ -586,7 +586,7 @@ describe('Test video transcoding', function () {
'1440p': true,
'2160p': true
},
web_videos: { enabled: true },
webVideos: { enabled: true },
hls: { enabled: true }
}
}

View File

@ -109,8 +109,8 @@ describe('Test create move video storage job', function () {
})
it('Should not have files on disk anymore', async function () {
await checkDirectoryIsEmpty(servers[0], 'videos', [ 'private' ])
await checkDirectoryIsEmpty(servers[0], join('videos', 'private'))
await checkDirectoryIsEmpty(servers[0], 'web-videos', [ 'private' ])
await checkDirectoryIsEmpty(servers[0], join('web-videos', 'private'))
await checkDirectoryIsEmpty(servers[0], join('streaming-playlists', 'hls'), [ 'private' ])
await checkDirectoryIsEmpty(servers[0], join('streaming-playlists', 'hls', 'private'))

View File

@ -35,10 +35,10 @@ async function assertNotExists (server: PeerTubeServer, directory: string, subst
async function assertCountAreOkay (servers: PeerTubeServer[]) {
for (const server of servers) {
const videosCount = await countFiles(server, 'videos')
const videosCount = await countFiles(server, 'web-videos')
expect(videosCount).to.equal(9) // 2 videos with 4 resolutions + private directory
const privateVideosCount = await countFiles(server, 'videos/private')
const privateVideosCount = await countFiles(server, 'web-videos/private')
expect(privateVideosCount).to.equal(4)
const torrentsCount = await countFiles(server, 'torrents')
@ -131,8 +131,8 @@ describe('Test prune storage scripts', function () {
it('Should create some dirty files', async function () {
for (let i = 0; i < 2; i++) {
{
const basePublic = servers[0].servers.buildDirectory('videos')
const basePrivate = servers[0].servers.buildDirectory(join('videos', 'private'))
const basePublic = servers[0].servers.buildDirectory('web-videos')
const basePrivate = servers[0].servers.buildDirectory(join('web-videos', 'private'))
const n1 = buildUUID() + '.mp4'
const n2 = buildUUID() + '.webm'

View File

@ -42,7 +42,7 @@ export class ObjectStorageCommand {
bucket_name: this.getMockStreamingPlaylistsBucketName()
},
videos: {
web_videos: {
bucket_name: this.getMockWebVideosBucketName()
}
}
@ -136,9 +136,9 @@ export class ObjectStorageCommand {
prefix: `test:server-${serverNumber}-streaming-playlists:`
},
videos: {
web_videos: {
bucket_name: this.DEFAULT_SCALEWAY_BUCKET,
prefix: `test:server-${serverNumber}-videos:`
prefix: `test:server-${serverNumber}-web-videos:`
}
}
}

View File

@ -370,7 +370,7 @@ export class PeerTubeServer {
tmp_persistent: this.getDirectoryPath('tmp-persistent') + '/',
bin: this.getDirectoryPath('bin') + '/',
avatars: this.getDirectoryPath('avatars') + '/',
videos: this.getDirectoryPath('videos') + '/',
web_videos: this.getDirectoryPath('web-videos') + '/',
streaming_playlists: this.getDirectoryPath('streaming-playlists') + '/',
redundancy: this.getDirectoryPath('redundancy') + '/',
logs: this.getDirectoryPath('logs') + '/',

View File

@ -78,7 +78,7 @@ export class ServersCommand extends AbstractCommand {
}
buildWebVideoFilePath (fileUrl: string) {
return this.buildDirectory(join('videos', basename(fileUrl)))
return this.buildDirectory(join('web-videos', basename(fileUrl)))
}
buildFragmentedFilePath (videoUUID: string, fileUrl: string) {

View File

@ -86,10 +86,10 @@ object_storage:
base_url: "PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_BASE_URL"
upload_acl: "PEERTUBE_OBJECT_STORAGE_UPLOAD_ACL"
videos:
bucket_name: "PEERTUBE_OBJECT_STORAGE_VIDEOS_BUCKET_NAME"
prefix: "PEERTUBE_OBJECT_STORAGE_VIDEOS_PREFIX"
base_url: "PEERTUBE_OBJECT_STORAGE_VIDEOS_BASE_URL"
web_videos:
bucket_name: "PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_BUCKET_NAME"
prefix: "PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_PREFIX"
base_url: "PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_BASE_URL"
webadmin:
configuration:

View File

@ -47,7 +47,7 @@ storage:
tmp_persistent: '../data/tmp-persistent/' # As tmp but the directory is not cleaned up between PeerTube restarts
bin: '../data/bin/'
avatars: '../data/avatars/'
videos: '../data/videos/'
web_videos: '../data/web-videos/'
streaming_playlists: '../data/streaming-playlists'
redundancy: '../data/redundancy/'
logs: '../data/logs/'