aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-01 18:47:57 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-01 18:47:57 +0100
commit4b08096b2c58f801e5aad19e38d24ec59dd3e14e (patch)
tree914bc9704c3f32e4366a518369be33b512b56256 /server/initializers
parentbf2fc85c834f5be016f119f59844e49fe3751e6a (diff)
downloadPeerTube-4b08096b2c58f801e5aad19e38d24ec59dd3e14e.tar.gz
PeerTube-4b08096b2c58f801e5aad19e38d24ec59dd3e14e.tar.zst
PeerTube-4b08096b2c58f801e5aad19e38d24ec59dd3e14e.zip
Server: add endpoint in requests
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.js12
-rw-r--r--server/initializers/migrations/0020-requests-endpoint.js15
2 files changed, 26 insertions, 1 deletions
diff --git a/server/initializers/constants.js b/server/initializers/constants.js
index 5ccd42773..0efbbb916 100644
--- a/server/initializers/constants.js
+++ b/server/initializers/constants.js
@@ -1,6 +1,7 @@
1'use strict' 1'use strict'
2 2
3const config = require('config') 3const config = require('config')
4const maxBy = require('lodash/maxBy')
4const path = require('path') 5const path = require('path')
5 6
6// --------------------------------------------------------------------------- 7// ---------------------------------------------------------------------------
@@ -92,9 +93,13 @@ const MONGO_MIGRATION_SCRIPTS = [
92 { 93 {
93 script: '0015-admin-role', 94 script: '0015-admin-role',
94 version: 15 95 version: 15
96 },
97 {
98 script: '0020-requests-endpoint',
99 version: 20
95 } 100 }
96] 101]
97const LAST_MONGO_SCHEMA_VERSION = 15 102const LAST_MONGO_SCHEMA_VERSION = (maxBy(MONGO_MIGRATION_SCRIPTS, 'version'))['version']
98 103
99// --------------------------------------------------------------------------- 104// ---------------------------------------------------------------------------
100 105
@@ -116,6 +121,10 @@ const REQUESTS_LIMIT = 10
116// Number of requests to retry for replay requests module 121// Number of requests to retry for replay requests module
117const RETRY_REQUESTS = 5 122const RETRY_REQUESTS = 5
118 123
124const REQUEST_ENDPOINTS = {
125 VIDEOS: 'videos'
126}
127
119// --------------------------------------------------------------------------- 128// ---------------------------------------------------------------------------
120 129
121// Password encryption 130// Password encryption
@@ -162,6 +171,7 @@ module.exports = {
162 OAUTH_LIFETIME, 171 OAUTH_LIFETIME,
163 PAGINATION_COUNT_DEFAULT, 172 PAGINATION_COUNT_DEFAULT,
164 PODS_SCORE, 173 PODS_SCORE,
174 REQUEST_ENDPOINTS,
165 REQUESTS_IN_PARALLEL, 175 REQUESTS_IN_PARALLEL,
166 REQUESTS_INTERVAL, 176 REQUESTS_INTERVAL,
167 REQUESTS_LIMIT, 177 REQUESTS_LIMIT,
diff --git a/server/initializers/migrations/0020-requests-endpoint.js b/server/initializers/migrations/0020-requests-endpoint.js
new file mode 100644
index 000000000..55feec571
--- /dev/null
+++ b/server/initializers/migrations/0020-requests-endpoint.js
@@ -0,0 +1,15 @@
1/*
2 Set the endpoint videos for requests.
3*/
4
5const mongoose = require('mongoose')
6
7const Request = mongoose.model('Request')
8
9exports.up = function (callback) {
10 Request.update({ }, { endpoint: 'videos' }, callback)
11}
12
13exports.down = function (callback) {
14 throw new Error('Not implemented.')
15}