+// Sortable columns per schema
+const SEARCHABLE_COLUMNS = {
+ VIDEOS: [ 'name', 'magnetUri', 'host', 'author', 'tags' ]
+}
+
+// Sortable columns per schema
+const SORTABLE_COLUMNS = {
+ USERS: [ 'username', '-username', 'createdAt', '-createdAt' ],
+ VIDEO_ABUSES: [ 'createdAt', '-createdAt' ],
+ VIDEOS: [ 'name', '-name', 'duration', '-duration', 'createdAt', '-createdAt' ]
+}
+
+const OAUTH_LIFETIME = {
+ ACCESS_TOKEN: 3600 * 4, // 4 hours
+ REFRESH_TOKEN: 1209600 // 2 weeks
+}
+
+// ---------------------------------------------------------------------------
+
+const CONFIG = {
+ LISTEN: {
+ PORT: config.get('listen.port')
+ },
+ DATABASE: {
+ DBNAME: 'peertube' + config.get('database.suffix'),
+ HOSTNAME: config.get('database.hostname'),
+ PORT: config.get('database.port'),
+ USERNAME: config.get('database.username'),
+ PASSWORD: config.get('database.password')
+ },
+ STORAGE: {
+ CERT_DIR: path.join(__dirname, '..', '..', config.get('storage.certs')),
+ LOG_DIR: path.join(__dirname, '..', '..', config.get('storage.logs')),
+ VIDEOS_DIR: path.join(__dirname, '..', '..', config.get('storage.videos')),
+ THUMBNAILS_DIR: path.join(__dirname, '..', '..', config.get('storage.thumbnails')),
+ PREVIEWS_DIR: path.join(__dirname, '..', '..', config.get('storage.previews')),
+ TORRENTS_DIR: path.join(__dirname, '..', '..', config.get('storage.torrents'))
+ },
+ WEBSERVER: {
+ SCHEME: config.get('webserver.https') === true ? 'https' : 'http',
+ WS: config.get('webserver.https') === true ? 'wss' : 'ws',
+ HOSTNAME: config.get('webserver.hostname'),
+ PORT: config.get('webserver.port')
+ }
+}
+CONFIG.WEBSERVER.URL = CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT
+CONFIG.WEBSERVER.HOST = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT
+
+// ---------------------------------------------------------------------------
+
+const CONSTRAINTS_FIELDS = {
+ USERS: {
+ USERNAME: { min: 3, max: 20 }, // Length
+ PASSWORD: { min: 6, max: 255 } // Length
+ },
+ VIDEO_ABUSES: {
+ REASON: { min: 2, max: 300 } // Length
+ },
+ VIDEOS: {
+ NAME: { min: 3, max: 50 }, // Length
+ DESCRIPTION: { min: 3, max: 250 }, // Length
+ EXTNAME: [ '.mp4', '.ogv', '.webm' ],
+ INFO_HASH: { min: 40, max: 40 }, // Length, infohash is 20 bytes length but we represent it in hexa so 20 * 2
+ DURATION: { min: 1, max: 7200 }, // Number
+ TAGS: { min: 1, max: 3 }, // Number of total tags
+ TAG: { min: 2, max: 10 }, // Length
+ THUMBNAIL: { min: 2, max: 30 },
+ THUMBNAIL_DATA: { min: 0, max: 20000 } // Bytes
+ }
+}
+
+// ---------------------------------------------------------------------------
+
+// Score a pod has when we create it as a friend
+const FRIEND_SCORE = {
+ BASE: 100,
+ MAX: 1000
+}
+
+// ---------------------------------------------------------------------------
+
+const LAST_MIGRATION_VERSION = 0
+
+// ---------------------------------------------------------------------------
+