X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Fconstants.js;h=f9247e9450cab909e9b85669e83ccc2df54c69ea;hb=86e83939869976e9b4dfa6dc9d3785a284bd598c;hp=ad7cf4f4da9e3efb7d198af0e594899fdd3ae104;hpb=28798b5d949826551740fc893d06e6424b77aa6a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/constants.js b/server/initializers/constants.js index ad7cf4f4d..f9247e945 100644 --- a/server/initializers/constants.js +++ b/server/initializers/constants.js @@ -5,6 +5,10 @@ const path = require('path') // --------------------------------------------------------------------------- +const LAST_MIGRATION_VERSION = 25 + +// --------------------------------------------------------------------------- + // API version const API_VERSION = 'v1' @@ -18,9 +22,9 @@ const SEARCHABLE_COLUMNS = { // Sortable columns per schema const SORTABLE_COLUMNS = { - USERS: [ 'id', '-id', 'username', '-username', 'createdAt', '-createdAt' ], - VIDEO_ABUSES: [ 'id', '-id', 'createdAt', '-createdAt' ], - VIDEOS: [ 'name', '-name', 'duration', '-duration', 'createdAt', '-createdAt' ] + USERS: [ 'id', 'username', 'createdAt' ], + VIDEO_ABUSES: [ 'id', 'createdAt' ], + VIDEOS: [ 'name', 'duration', 'createdAt', 'views', 'likes' ] } const OAUTH_LIFETIME = { @@ -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 @@ -78,10 +85,21 @@ const CONSTRAINTS_FIELDS = { TAGS: { min: 1, max: 3 }, // Number of total tags TAG: { min: 2, max: 10 }, // Length THUMBNAIL: { min: 2, max: 30 }, - THUMBNAIL_DATA: { min: 0, max: 20000 } // Bytes + THUMBNAIL_DATA: { min: 0, max: 20000 }, // Bytes + VIEWS: { min: 0 }, + LIKES: { min: 0 }, + DISLIKES: { min: 0 } + }, + VIDEO_EVENTS: { + COUNT: { min: 0 } } } +const VIDEO_RATE_TYPES = { + LIKE: 'like', + DISLIKE: 'dislike' +} + // --------------------------------------------------------------------------- // Score a pod has when we create it as a friend @@ -92,10 +110,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, @@ -113,12 +127,21 @@ const REQUESTS_LIMIT_PODS = 10 // How many requests we send to a pod per interval const REQUESTS_LIMIT_PER_POD = 5 +const REQUESTS_VIDEO_QADU_LIMIT_PODS = 10 +// The QADU requests are not big +const REQUESTS_VIDEO_QADU_LIMIT_PER_POD = 50 + +const REQUESTS_VIDEO_EVENT_LIMIT_PODS = 10 +// The EVENTS requests are not big +const REQUESTS_VIDEO_EVENT_LIMIT_PER_POD = 50 + // Number of requests to retry for replay requests module const RETRY_REQUESTS = 5 const REQUEST_ENDPOINTS = { VIDEOS: 'videos' } + const REQUEST_ENDPOINT_ACTIONS = {} REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] = { ADD: 'add', @@ -127,6 +150,21 @@ REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] = { REPORT_ABUSE: 'report-abuse' } +const REQUEST_VIDEO_QADU_ENDPOINT = 'videos/qadu' +const REQUEST_VIDEO_EVENT_ENDPOINT = 'videos/events' + +const REQUEST_VIDEO_QADU_TYPES = { + LIKES: 'likes', + DISLIKES: 'dislikes', + VIEWS: 'views' +} + +const REQUEST_VIDEO_EVENT_TYPES = { + LIKES: 'likes', + DISLIKES: 'dislikes', + VIEWS: 'views' +} + const REMOTE_SCHEME = { HTTP: 'https', WS: 'wss' @@ -196,10 +234,18 @@ module.exports = { REMOTE_SCHEME, REQUEST_ENDPOINT_ACTIONS, REQUEST_ENDPOINTS, + REQUEST_VIDEO_EVENT_ENDPOINT, + REQUEST_VIDEO_EVENT_TYPES, + REQUEST_VIDEO_QADU_ENDPOINT, + REQUEST_VIDEO_QADU_TYPES, REQUESTS_IN_PARALLEL, REQUESTS_INTERVAL, REQUESTS_LIMIT_PER_POD, REQUESTS_LIMIT_PODS, + REQUESTS_VIDEO_EVENT_LIMIT_PER_POD, + REQUESTS_VIDEO_EVENT_LIMIT_PODS, + REQUESTS_VIDEO_QADU_LIMIT_PER_POD, + REQUESTS_VIDEO_QADU_LIMIT_PODS, RETRY_REQUESTS, SEARCHABLE_COLUMNS, SIGNATURE_ALGORITHM, @@ -208,7 +254,8 @@ module.exports = { STATIC_MAX_AGE, STATIC_PATHS, THUMBNAILS_SIZE, - USER_ROLES + USER_ROLES, + VIDEO_RATE_TYPES } // ---------------------------------------------------------------------------