]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/initializers/constants.js
Update node for travis
[github/Chocobozzz/PeerTube.git] / server / initializers / constants.js
1 'use strict'
2
3 // API version of our pod
4 const API_VERSION = 'v1'
5
6 // Score a pod has when we create it as a friend
7 let FRIEND_BASE_SCORE = 100
8
9 // Time to wait between requests to the friends
10 let INTERVAL = 60000
11
12 // Max length of the author username
13 const MAXIMUM_AUTHOR_LENGTH = 20
14 // 2 hours maximum for the duration of a video (in seconds)
15 let MAXIMUM_VIDEO_DURATION = 7200
16
17 // Number of results by default for the pagination
18 const PAGINATION_COUNT_DEFAULT = 15
19
20 // Number of points we add/remove from a friend after a successful/bad request
21 const PODS_SCORE = {
22 MALUS: -10,
23 BONUS: 10
24 }
25
26 // Number of retries we make for the make retry requests (to friends...)
27 let REQUEST_RETRIES = 10
28
29 // Sortable columns per schema
30 const SORTABLE_COLUMNS = {
31 VIDEOS: [ 'name', '-name', 'duration', '-duration', 'createdDate', '-createdDate' ]
32 }
33
34 // Videos thumbnail size
35 const THUMBNAILS_SIZE = '200x110'
36
37 // Path for access to thumbnails with express router
38 const THUMBNAILS_STATIC_PATH = '/static/thumbnails'
39
40 // Special constants for a test instance
41 if (isTestInstance() === true) {
42 FRIEND_BASE_SCORE = 20
43 INTERVAL = 10000
44 MAXIMUM_VIDEO_DURATION = 14
45 REQUEST_RETRIES = 2
46 }
47
48 // ---------------------------------------------------------------------------
49
50 module.exports = {
51 API_VERSION: API_VERSION,
52 FRIEND_BASE_SCORE: FRIEND_BASE_SCORE,
53 INTERVAL: INTERVAL,
54 MAXIMUM_AUTHOR_LENGTH: MAXIMUM_AUTHOR_LENGTH,
55 MAXIMUM_VIDEO_DURATION: MAXIMUM_VIDEO_DURATION,
56 PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT,
57 PODS_SCORE: PODS_SCORE,
58 REQUEST_RETRIES: REQUEST_RETRIES,
59 SORTABLE_COLUMNS: SORTABLE_COLUMNS,
60 THUMBNAILS_SIZE: THUMBNAILS_SIZE,
61 THUMBNAILS_STATIC_PATH: THUMBNAILS_STATIC_PATH
62 }
63
64 // ---------------------------------------------------------------------------
65
66 function isTestInstance () {
67 return (process.env.NODE_ENV === 'test')
68 }