3 // API version of our pod
4 const API_VERSION
= 'v1'
6 // Score a pod has when we create it as a friend
12 // Time to wait between requests to the friends (10 min)
15 // Number of results by default for the pagination
16 const PAGINATION_COUNT_DEFAULT
= 15
18 // Number of points we add/remove from a friend after a successful/bad request
24 // Number of requests in parallel we can make
25 const REQUESTS_IN_PARALLEL
= 10
27 // Number of requests to retry for replay requests module
28 const RETRY_REQUESTS
= 5
30 // Sortable columns per schema
31 const SEARCHABLE_COLUMNS
= {
32 VIDEOS: [ 'name', 'magnetUri', 'podUrl', 'author', 'tags' ]
35 // Sortable columns per schema
36 const SORTABLE_COLUMNS
= {
37 VIDEOS: [ 'name', '-name', 'duration', '-duration', 'createdDate', '-createdDate' ]
40 // Videos thumbnail size
41 const THUMBNAILS_SIZE
= '200x110'
43 // Path for access to thumbnails with express router
44 const THUMBNAILS_STATIC_PATH
= '/static/thumbnails'
46 const VIDEOS_CONSTRAINTS_FIELDS
= {
47 NAME: { min: 3, max: 50 }, // Length
48 DESCRIPTION: { min: 3, max: 250 }, // Length
49 MAGNET_URI: { min: 10 }, // Length
50 DURATION: { min: 1, max: 7200 }, // Number
51 AUTHOR: { min: 3, max: 20 }, // Length
52 TAGS: { min: 1, max: 3 }, // Number of total tags
53 TAG: { min: 2, max: 10 }, // Length
54 THUMBNAIL: { min: 2, max: 30 },
55 THUMBNAIL64: { min: 0, max: 20000 } // Bytes
58 // Special constants for a test instance
59 if (isTestInstance() === true) {
60 FRIEND_SCORE
.BASE
= 20
62 VIDEOS_CONSTRAINTS_FIELDS
.DURATION
.max
= 14
65 // ---------------------------------------------------------------------------
68 API_VERSION: API_VERSION
,
69 FRIEND_SCORE: FRIEND_SCORE
,
71 PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT
,
72 PODS_SCORE: PODS_SCORE
,
73 REQUESTS_IN_PARALLEL: REQUESTS_IN_PARALLEL
,
74 RETRY_REQUESTS: RETRY_REQUESTS
,
75 SEARCHABLE_COLUMNS: SEARCHABLE_COLUMNS
,
76 SORTABLE_COLUMNS: SORTABLE_COLUMNS
,
77 THUMBNAILS_SIZE: THUMBNAILS_SIZE
,
78 THUMBNAILS_STATIC_PATH: THUMBNAILS_STATIC_PATH
,
79 VIDEOS_CONSTRAINTS_FIELDS: VIDEOS_CONSTRAINTS_FIELDS
82 // ---------------------------------------------------------------------------
84 function isTestInstance () {
85 return (process
.env
.NODE_ENV
=== 'test')