]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/initializers/constants.js
Update roadmap
[github/Chocobozzz/PeerTube.git] / server / initializers / constants.js
index 6f39b65da11413f2a809feb3d0184c8f0f8ec4db..8215808931aa19fba67bf14e6b41b903145e464d 100644 (file)
@@ -1,11 +1,14 @@
 'use strict'
 
 const config = require('config')
-const maxBy = require('lodash/maxBy')
 const path = require('path')
 
 // ---------------------------------------------------------------------------
 
+const LAST_MIGRATION_VERSION = 10
+
+// ---------------------------------------------------------------------------
+
 // API version
 const API_VERSION = 'v1'
 
@@ -19,7 +22,8 @@ const SEARCHABLE_COLUMNS = {
 
 // Sortable columns per schema
 const SORTABLE_COLUMNS = {
-  USERS: [ 'username', '-username', 'createdAt', '-createdAt' ],
+  USERS: [ 'id', '-id', 'username', '-username', 'createdAt', '-createdAt' ],
+  VIDEO_ABUSES: [ 'id', '-id', 'createdAt', '-createdAt' ],
   VIDEOS: [ 'name', '-name', 'duration', '-duration', 'createdAt', '-createdAt' ]
 }
 
@@ -54,6 +58,9 @@ const CONFIG = {
     WS: config.get('webserver.https') === true ? 'wss' : 'ws',
     HOSTNAME: config.get('webserver.hostname'),
     PORT: config.get('webserver.port')
+  },
+  ADMIN: {
+    EMAIL: config.get('admin.email')
   }
 }
 CONFIG.WEBSERVER.URL = CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT
@@ -66,16 +73,19 @@ const CONSTRAINTS_FIELDS = {
     USERNAME: { min: 3, max: 20 }, // Length
     PASSWORD: { min: 6, max: 255 } // Length
   },
+  VIDEO_ABUSES: {
+    REASON: { min: 2, max: 300 } // Length
+  },
   VIDEOS: {
     NAME: { min: 3, max: 50 }, // Length
     DESCRIPTION: { min: 3, max: 250 }, // Length
     EXTNAME: [ '.mp4', '.ogv', '.webm' ],
-    INFO_HASH: { min: 10, max: 50 }, // Length
+    INFO_HASH: { min: 40, max: 40 }, // Length, infohash is 20 bytes length but we represent it in hexa so 20 * 2
     DURATION: { min: 1, max: 7200 }, // Number
     TAGS: { min: 1, max: 3 }, // Number of total tags
     TAG: { min: 2, max: 10 }, // Length
     THUMBNAIL: { min: 2, max: 30 },
-    THUMBNAIL64: { min: 0, max: 20000 } // Bytes
+    THUMBNAIL_DATA: { min: 0, max: 20000 } // Bytes
   }
 }
 
@@ -89,10 +99,6 @@ const FRIEND_SCORE = {
 
 // ---------------------------------------------------------------------------
 
-const LAST_MIGRATION_VERSION = 0
-
-// ---------------------------------------------------------------------------
-
 // Number of points we add/remove from a friend after a successful/bad request
 const PODS_SCORE = {
   MALUS: -10,
@@ -105,8 +111,10 @@ let REQUESTS_INTERVAL = 600000
 // Number of requests in parallel we can make
 const REQUESTS_IN_PARALLEL = 10
 
-// How many requests we put in request
-const REQUESTS_LIMIT = 10
+// To how many pods we send requests
+const REQUESTS_LIMIT_PODS = 10
+// How many requests we send to a pod per interval
+const REQUESTS_LIMIT_PER_POD = 5
 
 // Number of requests to retry for replay requests module
 const RETRY_REQUESTS = 5
@@ -114,17 +122,31 @@ const RETRY_REQUESTS = 5
 const REQUEST_ENDPOINTS = {
   VIDEOS: 'videos'
 }
-
-// ---------------------------------------------------------------------------
+const REQUEST_ENDPOINT_ACTIONS = {}
+REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] = {
+  ADD: 'add',
+  UPDATE: 'update',
+  REMOVE: 'remove',
+  REPORT_ABUSE: 'report-abuse'
+}
 
 const REMOTE_SCHEME = {
   HTTP: 'https',
   WS: 'wss'
 }
 
+// ---------------------------------------------------------------------------
+
+const PRIVATE_CERT_NAME = 'peertube.key.pem'
+const PUBLIC_CERT_NAME = 'peertube.pub'
+const SIGNATURE_ALGORITHM = 'RSA-SHA256'
+const SIGNATURE_ENCODING = 'hex'
+
 // Password encryption
 const BCRYPT_SALT_SIZE = 10
 
+// ---------------------------------------------------------------------------
+
 // Express static paths (router)
 const STATIC_PATHS = {
   PREVIEWS: '/static/previews/',
@@ -140,6 +162,8 @@ let STATIC_MAX_AGE = '30d'
 const THUMBNAILS_SIZE = '200x110'
 const PREVIEWS_SIZE = '640x480'
 
+// ---------------------------------------------------------------------------
+
 const USER_ROLES = {
   ADMIN: 'admin',
   USER: 'user'
@@ -170,13 +194,19 @@ module.exports = {
   PAGINATION_COUNT_DEFAULT,
   PODS_SCORE,
   PREVIEWS_SIZE,
+  PRIVATE_CERT_NAME,
+  PUBLIC_CERT_NAME,
   REMOTE_SCHEME,
+  REQUEST_ENDPOINT_ACTIONS,
   REQUEST_ENDPOINTS,
   REQUESTS_IN_PARALLEL,
   REQUESTS_INTERVAL,
-  REQUESTS_LIMIT,
+  REQUESTS_LIMIT_PER_POD,
+  REQUESTS_LIMIT_PODS,
   RETRY_REQUESTS,
   SEARCHABLE_COLUMNS,
+  SIGNATURE_ALGORITHM,
+  SIGNATURE_ENCODING,
   SORTABLE_COLUMNS,
   STATIC_MAX_AGE,
   STATIC_PATHS,