]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/initializers/constants.js
Client: add webpack notifier
[github/Chocobozzz/PeerTube.git] / server / initializers / constants.js
CommitLineData
9f10b292
C
1'use strict'
2
3// API version of our pod
f0f5567b 4const API_VERSION = 'v1'
9f10b292
C
5
6// Score a pod has when we create it as a friend
a3ee6fa2
C
7const FRIEND_SCORE = {
8 BASE: 100,
9 MAX: 1000
10}
9f10b292 11
8483b221
C
12// Time to wait between requests to the friends (10 min)
13let INTERVAL = 600000
9f10b292 14
3fe81fa7
C
15// Number of results by default for the pagination
16const PAGINATION_COUNT_DEFAULT = 15
17
9f10b292 18// Number of points we add/remove from a friend after a successful/bad request
f0f5567b 19const PODS_SCORE = {
9f10b292
C
20 MALUS: -10,
21 BONUS: 10
22}
23
528a9efa
C
24// Number of requests in parallel we can make
25const REQUESTS_IN_PARALLEL = 10
9f10b292 26
b3595463
C
27// How many requests we put in request (request scheduler)
28const REQUESTS_LIMIT = 10
29
528a9efa
C
30// Number of requests to retry for replay requests module
31const RETRY_REQUESTS = 5
8c255eb5 32
46246b5f
C
33// Sortable columns per schema
34const SEARCHABLE_COLUMNS = {
8d199cb8 35 VIDEOS: [ 'name', 'magnetUri', 'podUrl', 'author', 'tags' ]
46246b5f
C
36}
37
a877d5ac
C
38// Sortable columns per schema
39const SORTABLE_COLUMNS = {
40 VIDEOS: [ 'name', '-name', 'duration', '-duration', 'createdDate', '-createdDate' ]
41}
42
cbe2f7c3
C
43// Videos thumbnail size
44const THUMBNAILS_SIZE = '200x110'
45
46// Path for access to thumbnails with express router
47const THUMBNAILS_STATIC_PATH = '/static/thumbnails'
48
be587647 49const VIDEOS_CONSTRAINTS_FIELDS = {
e822fdae
C
50 NAME: { min: 3, max: 50 }, // Length
51 DESCRIPTION: { min: 3, max: 250 }, // Length
be587647
C
52 MAGNET_URI: { min: 10 }, // Length
53 DURATION: { min: 1, max: 7200 }, // Number
54 AUTHOR: { min: 3, max: 20 }, // Length
55 TAGS: { min: 1, max: 3 }, // Number of total tags
56 TAG: { min: 2, max: 10 }, // Length
aaf61f38
C
57 THUMBNAIL: { min: 2, max: 30 },
58 THUMBNAIL64: { min: 0, max: 20000 } // Bytes
be587647
C
59}
60
9f10b292
C
61// Special constants for a test instance
62if (isTestInstance() === true) {
a3ee6fa2 63 FRIEND_SCORE.BASE = 20
9f10b292 64 INTERVAL = 10000
be587647 65 VIDEOS_CONSTRAINTS_FIELDS.DURATION.max = 14
9f10b292
C
66}
67
68// ---------------------------------------------------------------------------
69
70module.exports = {
71 API_VERSION: API_VERSION,
a3ee6fa2 72 FRIEND_SCORE: FRIEND_SCORE,
9f10b292 73 INTERVAL: INTERVAL,
3fe81fa7 74 PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT,
9f10b292 75 PODS_SCORE: PODS_SCORE,
528a9efa 76 REQUESTS_IN_PARALLEL: REQUESTS_IN_PARALLEL,
b3595463 77 REQUESTS_LIMIT: REQUESTS_LIMIT,
528a9efa 78 RETRY_REQUESTS: RETRY_REQUESTS,
46246b5f 79 SEARCHABLE_COLUMNS: SEARCHABLE_COLUMNS,
a877d5ac 80 SORTABLE_COLUMNS: SORTABLE_COLUMNS,
cbe2f7c3 81 THUMBNAILS_SIZE: THUMBNAILS_SIZE,
be587647
C
82 THUMBNAILS_STATIC_PATH: THUMBNAILS_STATIC_PATH,
83 VIDEOS_CONSTRAINTS_FIELDS: VIDEOS_CONSTRAINTS_FIELDS
9f10b292
C
84}
85
86// ---------------------------------------------------------------------------
87
88function isTestInstance () {
89 return (process.env.NODE_ENV === 'test')
90}