]>
Commit | Line | Data |
---|---|---|
9f10b292 C |
1 | 'use strict' |
2 | ||
3 | // API version of our pod | |
f0f5567b | 4 | const API_VERSION = 'v1' |
9f10b292 C |
5 | |
6 | // Score a pod has when we create it as a friend | |
f0f5567b | 7 | let FRIEND_BASE_SCORE = 100 |
9f10b292 C |
8 | |
9 | // Time to wait between requests to the friends | |
f0f5567b | 10 | let INTERVAL = 60000 |
9f10b292 | 11 | |
a996fc4a C |
12 | // Max length of the author username |
13 | const MAXIMUM_AUTHOR_LENGTH = 20 | |
67100f1f C |
14 | // 2 hours maximum for the duration of a video (in seconds) |
15 | let MAXIMUM_VIDEO_DURATION = 7200 | |
16 | ||
3fe81fa7 C |
17 | // Number of results by default for the pagination |
18 | const PAGINATION_COUNT_DEFAULT = 15 | |
19 | ||
9f10b292 | 20 | // Number of points we add/remove from a friend after a successful/bad request |
f0f5567b | 21 | const 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 | 27 | let REQUEST_RETRIES = 10 |
9f10b292 | 28 | |
46246b5f C |
29 | // Sortable columns per schema |
30 | const SEARCHABLE_COLUMNS = { | |
31 | VIDEOS: [ 'name', 'magnetUri', 'podUrl', 'author' ] | |
32 | } | |
33 | ||
a877d5ac C |
34 | // Sortable columns per schema |
35 | const SORTABLE_COLUMNS = { | |
36 | VIDEOS: [ 'name', '-name', 'duration', '-duration', 'createdDate', '-createdDate' ] | |
37 | } | |
38 | ||
cbe2f7c3 C |
39 | // Videos thumbnail size |
40 | const THUMBNAILS_SIZE = '200x110' | |
41 | ||
42 | // Path for access to thumbnails with express router | |
43 | const THUMBNAILS_STATIC_PATH = '/static/thumbnails' | |
44 | ||
9f10b292 C |
45 | // Special constants for a test instance |
46 | if (isTestInstance() === true) { | |
47 | FRIEND_BASE_SCORE = 20 | |
48 | INTERVAL = 10000 | |
67100f1f | 49 | MAXIMUM_VIDEO_DURATION = 14 |
9f10b292 C |
50 | REQUEST_RETRIES = 2 |
51 | } | |
52 | ||
53 | // --------------------------------------------------------------------------- | |
54 | ||
55 | module.exports = { | |
56 | API_VERSION: API_VERSION, | |
57 | FRIEND_BASE_SCORE: FRIEND_BASE_SCORE, | |
58 | INTERVAL: INTERVAL, | |
a996fc4a | 59 | MAXIMUM_AUTHOR_LENGTH: MAXIMUM_AUTHOR_LENGTH, |
67100f1f | 60 | MAXIMUM_VIDEO_DURATION: MAXIMUM_VIDEO_DURATION, |
3fe81fa7 | 61 | PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT, |
9f10b292 | 62 | PODS_SCORE: PODS_SCORE, |
cbe2f7c3 | 63 | REQUEST_RETRIES: REQUEST_RETRIES, |
46246b5f | 64 | SEARCHABLE_COLUMNS: SEARCHABLE_COLUMNS, |
a877d5ac | 65 | SORTABLE_COLUMNS: SORTABLE_COLUMNS, |
cbe2f7c3 C |
66 | THUMBNAILS_SIZE: THUMBNAILS_SIZE, |
67 | THUMBNAILS_STATIC_PATH: THUMBNAILS_STATIC_PATH | |
9f10b292 C |
68 | } |
69 | ||
70 | // --------------------------------------------------------------------------- | |
71 | ||
72 | function isTestInstance () { | |
73 | return (process.env.NODE_ENV === 'test') | |
74 | } |