]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/initializers/constants.js
Add check for the thumbnail in base64 (requests inter pods)
[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
f0f5567b 7let FRIEND_BASE_SCORE = 100
9f10b292
C
8
9// Time to wait between requests to the friends
f0f5567b 10let INTERVAL = 60000
9f10b292 11
a996fc4a
C
12// Max length of the author username
13const MAXIMUM_AUTHOR_LENGTH = 20
67100f1f
C
14// 2 hours maximum for the duration of a video (in seconds)
15let MAXIMUM_VIDEO_DURATION = 7200
16
3fe81fa7
C
17// Number of results by default for the pagination
18const PAGINATION_COUNT_DEFAULT = 15
19
9f10b292 20// Number of points we add/remove from a friend after a successful/bad request
f0f5567b 21const PODS_SCORE = {
9f10b292
C
22 MALUS: -10,
23 BONUS: 10
24}
25
26// Number of retries we make for the make retry requests (to friends...)
f0f5567b 27let REQUEST_RETRIES = 10
9f10b292 28
cbe2f7c3
C
29// Videos thumbnail size
30const THUMBNAILS_SIZE = '200x110'
31
32// Path for access to thumbnails with express router
33const THUMBNAILS_STATIC_PATH = '/static/thumbnails'
34
9f10b292
C
35// Special constants for a test instance
36if (isTestInstance() === true) {
37 FRIEND_BASE_SCORE = 20
38 INTERVAL = 10000
67100f1f 39 MAXIMUM_VIDEO_DURATION = 14
9f10b292
C
40 REQUEST_RETRIES = 2
41}
42
43// ---------------------------------------------------------------------------
44
45module.exports = {
46 API_VERSION: API_VERSION,
47 FRIEND_BASE_SCORE: FRIEND_BASE_SCORE,
48 INTERVAL: INTERVAL,
a996fc4a 49 MAXIMUM_AUTHOR_LENGTH: MAXIMUM_AUTHOR_LENGTH,
67100f1f 50 MAXIMUM_VIDEO_DURATION: MAXIMUM_VIDEO_DURATION,
3fe81fa7 51 PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT,
9f10b292 52 PODS_SCORE: PODS_SCORE,
cbe2f7c3
C
53 REQUEST_RETRIES: REQUEST_RETRIES,
54 THUMBNAILS_SIZE: THUMBNAILS_SIZE,
55 THUMBNAILS_STATIC_PATH: THUMBNAILS_STATIC_PATH
9f10b292
C
56}
57
58// ---------------------------------------------------------------------------
59
60function isTestInstance () {
61 return (process.env.NODE_ENV === 'test')
62}