aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-10-12 16:09:02 +0200
committerChocobozzz <chocobozzz@cpy.re>2022-10-24 14:48:24 +0200
commit3545e72c686ff1725bbdfd8d16d693e2f4aa75a3 (patch)
treee7f1d12ef5dae1e1142c3a8d0b681c1dbbb0de10 /server/initializers
parent38a3ccc7f8ad0ea94362b58c732af7c387ab46be (diff)
downloadPeerTube-3545e72c686ff1725bbdfd8d16d693e2f4aa75a3.tar.gz
PeerTube-3545e72c686ff1725bbdfd8d16d693e2f4aa75a3.tar.zst
PeerTube-3545e72c686ff1725bbdfd8d16d693e2f4aa75a3.zip
Put private videos under a specific subdirectory
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.ts37
-rw-r--r--server/initializers/installer.ts10
2 files changed, 36 insertions, 11 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index cab61948a..88bdd07fe 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -662,10 +662,15 @@ const NSFW_POLICY_TYPES: { [ id: string ]: NSFWPolicyType } = {
662// Express static paths (router) 662// Express static paths (router)
663const STATIC_PATHS = { 663const STATIC_PATHS = {
664 THUMBNAILS: '/static/thumbnails/', 664 THUMBNAILS: '/static/thumbnails/',
665
665 WEBSEED: '/static/webseed/', 666 WEBSEED: '/static/webseed/',
667 PRIVATE_WEBSEED: '/static/webseed/private/',
668
666 REDUNDANCY: '/static/redundancy/', 669 REDUNDANCY: '/static/redundancy/',
670
667 STREAMING_PLAYLISTS: { 671 STREAMING_PLAYLISTS: {
668 HLS: '/static/streaming-playlists/hls' 672 HLS: '/static/streaming-playlists/hls',
673 PRIVATE_HLS: '/static/streaming-playlists/hls/private/'
669 } 674 }
670} 675}
671const STATIC_DOWNLOAD_PATHS = { 676const STATIC_DOWNLOAD_PATHS = {
@@ -745,12 +750,32 @@ const LRU_CACHE = {
745 }, 750 },
746 ACTOR_IMAGE_STATIC: { 751 ACTOR_IMAGE_STATIC: {
747 MAX_SIZE: 500 752 MAX_SIZE: 500
753 },
754 STATIC_VIDEO_FILES_RIGHTS_CHECK: {
755 MAX_SIZE: 5000,
756 TTL: parseDurationToMs('10 seconds')
757 },
758 VIDEO_TOKENS: {
759 MAX_SIZE: 100_000,
760 TTL: parseDurationToMs('8 hours')
748 } 761 }
749} 762}
750 763
751const RESUMABLE_UPLOAD_DIRECTORY = join(CONFIG.STORAGE.TMP_DIR, 'resumable-uploads') 764const DIRECTORIES = {
752const HLS_STREAMING_PLAYLIST_DIRECTORY = join(CONFIG.STORAGE.STREAMING_PLAYLISTS_DIR, 'hls') 765 RESUMABLE_UPLOAD: join(CONFIG.STORAGE.TMP_DIR, 'resumable-uploads'),
753const HLS_REDUNDANCY_DIRECTORY = join(CONFIG.STORAGE.REDUNDANCY_DIR, 'hls') 766
767 HLS_STREAMING_PLAYLIST: {
768 PUBLIC: join(CONFIG.STORAGE.STREAMING_PLAYLISTS_DIR, 'hls'),
769 PRIVATE: join(CONFIG.STORAGE.STREAMING_PLAYLISTS_DIR, 'hls', 'private')
770 },
771
772 VIDEOS: {
773 PUBLIC: CONFIG.STORAGE.VIDEOS_DIR,
774 PRIVATE: join(CONFIG.STORAGE.VIDEOS_DIR, 'private')
775 },
776
777 HLS_REDUNDANCY: join(CONFIG.STORAGE.REDUNDANCY_DIR, 'hls')
778}
754 779
755const RESUMABLE_UPLOAD_SESSION_LIFETIME = SCHEDULER_INTERVALS_MS.REMOVE_DANGLING_RESUMABLE_UPLOADS 780const RESUMABLE_UPLOAD_SESSION_LIFETIME = SCHEDULER_INTERVALS_MS.REMOVE_DANGLING_RESUMABLE_UPLOADS
756 781
@@ -971,9 +996,8 @@ export {
971 PEERTUBE_VERSION, 996 PEERTUBE_VERSION,
972 LAZY_STATIC_PATHS, 997 LAZY_STATIC_PATHS,
973 SEARCH_INDEX, 998 SEARCH_INDEX,
974 RESUMABLE_UPLOAD_DIRECTORY, 999 DIRECTORIES,
975 RESUMABLE_UPLOAD_SESSION_LIFETIME, 1000 RESUMABLE_UPLOAD_SESSION_LIFETIME,
976 HLS_REDUNDANCY_DIRECTORY,
977 P2P_MEDIA_LOADER_PEER_VERSION, 1001 P2P_MEDIA_LOADER_PEER_VERSION,
978 ACTOR_IMAGES_SIZE, 1002 ACTOR_IMAGES_SIZE,
979 ACCEPT_HEADERS, 1003 ACCEPT_HEADERS,
@@ -1007,7 +1031,6 @@ export {
1007 VIDEO_FILTERS, 1031 VIDEO_FILTERS,
1008 ROUTE_CACHE_LIFETIME, 1032 ROUTE_CACHE_LIFETIME,
1009 SORTABLE_COLUMNS, 1033 SORTABLE_COLUMNS,
1010 HLS_STREAMING_PLAYLIST_DIRECTORY,
1011 JOB_TTL, 1034 JOB_TTL,
1012 DEFAULT_THEME_NAME, 1035 DEFAULT_THEME_NAME,
1013 NSFW_POLICY_TYPES, 1036 NSFW_POLICY_TYPES,
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts
index b02be9567..f5d8eedf1 100644
--- a/server/initializers/installer.ts
+++ b/server/initializers/installer.ts
@@ -10,7 +10,7 @@ import { ApplicationModel } from '../models/application/application'
10import { OAuthClientModel } from '../models/oauth/oauth-client' 10import { OAuthClientModel } from '../models/oauth/oauth-client'
11import { applicationExist, clientsExist, usersExist } from './checker-after-init' 11import { applicationExist, clientsExist, usersExist } from './checker-after-init'
12import { CONFIG } from './config' 12import { CONFIG } from './config'
13import { FILES_CACHE, HLS_STREAMING_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION, RESUMABLE_UPLOAD_DIRECTORY } from './constants' 13import { DIRECTORIES, FILES_CACHE, LAST_MIGRATION_VERSION } from './constants'
14import { sequelizeTypescript } from './database' 14import { sequelizeTypescript } from './database'
15 15
16async function installApplication () { 16async function installApplication () {
@@ -92,11 +92,13 @@ function createDirectoriesIfNotExist () {
92 tasks.push(ensureDir(dir)) 92 tasks.push(ensureDir(dir))
93 } 93 }
94 94
95 // Playlist directories 95 tasks.push(ensureDir(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE))
96 tasks.push(ensureDir(HLS_STREAMING_PLAYLIST_DIRECTORY)) 96 tasks.push(ensureDir(DIRECTORIES.HLS_STREAMING_PLAYLIST.PUBLIC))
97 tasks.push(ensureDir(DIRECTORIES.VIDEOS.PUBLIC))
98 tasks.push(ensureDir(DIRECTORIES.VIDEOS.PRIVATE))
97 99
98 // Resumable upload directory 100 // Resumable upload directory
99 tasks.push(ensureDir(RESUMABLE_UPLOAD_DIRECTORY)) 101 tasks.push(ensureDir(DIRECTORIES.RESUMABLE_UPLOAD))
100 102
101 return Promise.all(tasks) 103 return Promise.all(tasks)
102} 104}