]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/initializers/constants.ts
Change how we handle resolution
[github/Chocobozzz/PeerTube.git] / server / initializers / constants.ts
index 314a05ab7a0241a021db3c75ed51414259ba6a2d..b11575b346ebbb15c845403ba15c4980ed0951db 100644 (file)
@@ -15,7 +15,7 @@ import {
 
 // ---------------------------------------------------------------------------
 
-const LAST_MIGRATION_VERSION = 55
+const LAST_MIGRATION_VERSION = 75
 
 // ---------------------------------------------------------------------------
 
@@ -34,7 +34,8 @@ const SEARCHABLE_COLUMNS = {
 const SORTABLE_COLUMNS = {
   USERS: [ 'id', 'username', 'createdAt' ],
   VIDEO_ABUSES: [ 'id', 'createdAt' ],
-  VIDEOS: [ 'name', 'duration', 'createdAt', 'views', 'likes' ]
+  VIDEOS: [ 'name', 'duration', 'createdAt', 'views', 'likes' ],
+  BLACKLISTS: [ 'id', 'name', 'duration', 'views', 'likes', 'dislikes', 'uuid', 'createdAt' ]
 }
 
 const OAUTH_LIFETIME = {
@@ -79,9 +80,19 @@ const CONFIG = {
     ENABLED: config.get<boolean>('signup.enabled'),
     LIMIT: config.get<number>('signup.limit')
   },
+  USER: {
+    VIDEO_QUOTA: config.get<number>('user.video_quota')
+  },
   TRANSCODING: {
     ENABLED: config.get<boolean>('transcoding.enabled'),
-    THREADS: config.get<number>('transcoding.threads')
+    THREADS: config.get<number>('transcoding.threads'),
+    RESOLUTIONS: {
+      '240' : config.get<boolean>('transcoding.resolutions.240p'),
+      '360': config.get<boolean>('transcoding.resolutions.360p'),
+      '480': config.get<boolean>('transcoding.resolutions.480p'),
+      '720': config.get<boolean>('transcoding.resolutions.720p'),
+      '1080': config.get<boolean>('transcoding.resolutions.1080p')
+    }
   },
   CACHE: {
     PREVIEWS: {
@@ -97,7 +108,8 @@ CONFIG.WEBSERVER.HOST = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT
 const CONSTRAINTS_FIELDS = {
   USERS: {
     USERNAME: { min: 3, max: 20 }, // Length
-    PASSWORD: { min: 6, max: 255 } // Length
+    PASSWORD: { min: 6, max: 255 }, // Length
+    VIDEO_QUOTA: { min: -1 }
   },
   VIDEO_ABUSES: {
     REASON: { min: 2, max: 300 } // Length
@@ -106,7 +118,7 @@ const CONSTRAINTS_FIELDS = {
     NAME: { min: 3, max: 50 }, // Length
     DESCRIPTION: { min: 3, max: 250 }, // Length
     EXTNAME: [ '.mp4', '.ogv', '.webm' ],
-    INFO_HASH: { min: 40, max: 40 }, // Length, infohash is 20 bytes length but we represent it in hexa so 20 * 2
+    INFO_HASH: { min: 40, max: 40 }, // Length, info hash is 20 bytes length but we represent it in hexadecimal so 20 * 2
     DURATION: { min: 1, max: 7200 }, // Number
     TAGS: { min: 0, max: 3 }, // Number of total tags
     TAG: { min: 2, max: 10 }, // Length
@@ -114,7 +126,8 @@ const CONSTRAINTS_FIELDS = {
     THUMBNAIL_DATA: { min: 0, max: 20000 }, // Bytes
     VIEWS: { min: 0 },
     LIKES: { min: 0 },
-    DISLIKES: { min: 0 }
+    DISLIKES: { min: 0 },
+    FILE_SIZE: { min: 10, max: 1024 * 1024 * 1024 * 3 /* 3Go */ }
   },
   VIDEO_EVENTS: {
     COUNT: { min: 0 }
@@ -138,7 +151,7 @@ const VIDEO_CATEGORIES = {
   9: 'Comedy',
   10: 'Entertainment',
   11: 'News',
-  12: 'Howto',
+  12: 'How To',
   13: 'Education',
   14: 'Activism',
   15: 'Science & Technology',
@@ -173,7 +186,7 @@ const VIDEO_LANGUAGES = {
   11: 'German',
   12: 'Korean',
   13: 'French',
-  14: 'Italien'
+  14: 'Italian'
 }
 
 // ---------------------------------------------------------------------------
@@ -188,7 +201,7 @@ const FRIEND_SCORE = {
 
 // Number of points we add/remove from a friend after a successful/bad request
 const PODS_SCORE = {
-  MALUS: -10,
+  PENALTY: -10,
   BONUS: 10
 }
 
@@ -285,7 +298,7 @@ let STATIC_MAX_AGE = '30d'
 const THUMBNAILS_SIZE = '200x110'
 const PREVIEWS_SIZE = '640x480'
 
-// Subfolders of cache directory
+// Sub folders of cache directory
 const CACHE = {
   DIRECTORIES: {
     PREVIEWS: join(CONFIG.STORAGE.CACHE_DIR, 'previews')
@@ -301,7 +314,7 @@ const USER_ROLES: { [ id: string ]: UserRole } = {
 
 // ---------------------------------------------------------------------------
 
-const OPENGRAPH_COMMENT = '<!-- opengraph tags -->'
+const OPENGRAPH_COMMENT = '<!-- open graph tags -->'
 
 // ---------------------------------------------------------------------------