X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Fconstants.js;h=0af7aca3c39040cb0ed1d61411c0f6a3b0477739;hb=67bf9b96bbcd92b069fe86d9223fe0f8b9c6e677;hp=d8a13d066930adab55fd196ab7453995b0fa8246;hpb=49abbbbedca83b9031d3e2eb3ae9ad9b6a7d96ed;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/constants.js b/server/initializers/constants.js index d8a13d066..0af7aca3c 100644 --- a/server/initializers/constants.js +++ b/server/initializers/constants.js @@ -1,7 +1,6 @@ 'use strict' const config = require('config') -const maxBy = require('lodash/maxBy') const path = require('path') // --------------------------------------------------------------------------- @@ -14,13 +13,13 @@ const PAGINATION_COUNT_DEFAULT = 15 // Sortable columns per schema const SEARCHABLE_COLUMNS = { - VIDEOS: [ 'name', 'magnetUri', 'podHost', 'author', 'tags' ] + VIDEOS: [ 'name', 'magnetUri', 'host', 'author', 'tags' ] } // Sortable columns per schema const SORTABLE_COLUMNS = { - USERS: [ 'username', '-username', 'createdDate', '-createdDate' ], - VIDEOS: [ 'name', '-name', 'duration', '-duration', 'createdDate', '-createdDate' ] + USERS: [ 'username', '-username', 'createdAt', '-createdAt' ], + VIDEOS: [ 'name', '-name', 'duration', '-duration', 'createdAt', '-createdAt' ] } const OAUTH_LIFETIME = { @@ -37,7 +36,9 @@ const CONFIG = { DATABASE: { DBNAME: 'peertube' + config.get('database.suffix'), HOSTNAME: config.get('database.hostname'), - PORT: config.get('database.port') + 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')), @@ -67,9 +68,8 @@ const CONSTRAINTS_FIELDS = { VIDEOS: { NAME: { min: 3, max: 50 }, // Length DESCRIPTION: { min: 3, max: 250 }, // Length - MAGNET: { - INFO_HASH: { min: 10, max: 50 } // 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 @@ -88,25 +88,7 @@ const FRIEND_SCORE = { // --------------------------------------------------------------------------- -const MONGO_MIGRATION_SCRIPTS = [ - { - script: '0005-create-application', - version: 5 - }, - { - script: '0010-users-password', - version: 10 - }, - { - script: '0015-admin-role', - version: 15 - }, - { - script: '0020-requests-endpoint', - version: 20 - } -] -const LAST_MONGO_SCHEMA_VERSION = (maxBy(MONGO_MIGRATION_SCRIPTS, 'version'))['version'] +const LAST_MIGRATION_VERSION = 0 // --------------------------------------------------------------------------- @@ -136,7 +118,7 @@ const REQUEST_ENDPOINTS = { const REMOTE_SCHEME = { HTTP: 'https', - WS: 'WS' + WS: 'wss' } // Password encryption @@ -182,8 +164,7 @@ module.exports = { CONFIG, CONSTRAINTS_FIELDS, FRIEND_SCORE, - LAST_MONGO_SCHEMA_VERSION, - MONGO_MIGRATION_SCRIPTS, + LAST_MIGRATION_VERSION, OAUTH_LIFETIME, PAGINATION_COUNT_DEFAULT, PODS_SCORE, @@ -204,6 +185,7 @@ module.exports = { // --------------------------------------------------------------------------- +// This method exists in utils module but we want to let the constants module independent function isTestInstance () { return (process.env.NODE_ENV === 'test') }