diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-05-05 17:35:58 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-05-05 17:35:58 +0200 |
commit | 5a976a8c351d2a9e23ceee1e193fca2893b7f12d (patch) | |
tree | 9e22c1cf835b68082bc3a12adf6a0a7b40e6ce7f | |
parent | 4e284e97b95d1fe93378b90061272e3abc875078 (diff) | |
download | PeerTube-5a976a8c351d2a9e23ceee1e193fca2893b7f12d.tar.gz PeerTube-5a976a8c351d2a9e23ceee1e193fca2893b7f12d.tar.zst PeerTube-5a976a8c351d2a9e23ceee1e193fca2893b7f12d.zip |
Server: move requests lib in their own directory
-rw-r--r-- | server/helpers/requests.js | 2 | ||||
-rw-r--r-- | server/lib/friends.js | 6 | ||||
-rw-r--r-- | server/lib/request/base-request-scheduler.js (renamed from server/lib/base-request-scheduler.js) | 8 | ||||
-rw-r--r-- | server/lib/request/request-scheduler.js (renamed from server/lib/request-scheduler.js) | 6 | ||||
-rw-r--r-- | server/lib/request/request-video-event-scheduler.js (renamed from server/lib/request-video-event-scheduler.js) | 4 | ||||
-rw-r--r-- | server/lib/request/request-video-qadu-scheduler.js (renamed from server/lib/request-video-qadu-scheduler.js) | 6 | ||||
-rw-r--r-- | server/middlewares/secure.js | 2 |
7 files changed, 18 insertions, 16 deletions
diff --git a/server/helpers/requests.js b/server/helpers/requests.js index 427864117..efe056937 100644 --- a/server/helpers/requests.js +++ b/server/helpers/requests.js | |||
@@ -40,7 +40,7 @@ function makeSecureRequest (params, callback) { | |||
40 | 40 | ||
41 | let dataToSign | 41 | let dataToSign |
42 | if (params.data) { | 42 | if (params.data) { |
43 | dataToSign = dataToSign = params.data | 43 | dataToSign = params.data |
44 | } else { | 44 | } else { |
45 | // We do not have data to sign so we just take our host | 45 | // We do not have data to sign so we just take our host |
46 | // It is not ideal but the connection should be in HTTPS | 46 | // It is not ideal but the connection should be in HTTPS |
diff --git a/server/lib/friends.js b/server/lib/friends.js index 1c7567527..6dd32406c 100644 --- a/server/lib/friends.js +++ b/server/lib/friends.js | |||
@@ -13,9 +13,9 @@ const logger = require('../helpers/logger') | |||
13 | const peertubeCrypto = require('../helpers/peertube-crypto') | 13 | const peertubeCrypto = require('../helpers/peertube-crypto') |
14 | const requests = require('../helpers/requests') | 14 | const requests = require('../helpers/requests') |
15 | const utils = require('../helpers/utils') | 15 | const utils = require('../helpers/utils') |
16 | const RequestScheduler = require('./request-scheduler') | 16 | const RequestScheduler = require('./request/request-scheduler') |
17 | const RequestVideoQaduScheduler = require('./request-video-qadu-scheduler') | 17 | const RequestVideoQaduScheduler = require('./request/request-video-qadu-scheduler') |
18 | const RequestVideoEventScheduler = require('./request-video-event-scheduler') | 18 | const RequestVideoEventScheduler = require('./request/request-video-event-scheduler') |
19 | 19 | ||
20 | const ENDPOINT_ACTIONS = constants.REQUEST_ENDPOINT_ACTIONS[constants.REQUEST_ENDPOINTS.VIDEOS] | 20 | const ENDPOINT_ACTIONS = constants.REQUEST_ENDPOINT_ACTIONS[constants.REQUEST_ENDPOINTS.VIDEOS] |
21 | 21 | ||
diff --git a/server/lib/base-request-scheduler.js b/server/lib/request/base-request-scheduler.js index 7378971c8..782448340 100644 --- a/server/lib/base-request-scheduler.js +++ b/server/lib/request/base-request-scheduler.js | |||
@@ -2,10 +2,10 @@ | |||
2 | 2 | ||
3 | const eachLimit = require('async/eachLimit') | 3 | const eachLimit = require('async/eachLimit') |
4 | 4 | ||
5 | const constants = require('../initializers/constants') | 5 | const constants = require('../../initializers/constants') |
6 | const db = require('../initializers/database') | 6 | const db = require('../../initializers/database') |
7 | const logger = require('../helpers/logger') | 7 | const logger = require('../../helpers/logger') |
8 | const requests = require('../helpers/requests') | 8 | const requests = require('../../helpers/requests') |
9 | 9 | ||
10 | module.exports = class BaseRequestScheduler { | 10 | module.exports = class BaseRequestScheduler { |
11 | constructor (options) { | 11 | constructor (options) { |
diff --git a/server/lib/request-scheduler.js b/server/lib/request/request-scheduler.js index f6020e746..555ec3e54 100644 --- a/server/lib/request-scheduler.js +++ b/server/lib/request/request-scheduler.js | |||
@@ -1,9 +1,9 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const constants = require('../initializers/constants') | 3 | const constants = require('../../initializers/constants') |
4 | const BaseRequestScheduler = require('./base-request-scheduler') | 4 | const BaseRequestScheduler = require('./base-request-scheduler') |
5 | const db = require('../initializers/database') | 5 | const db = require('../../initializers/database') |
6 | const logger = require('../helpers/logger') | 6 | const logger = require('../../helpers/logger') |
7 | 7 | ||
8 | module.exports = class RequestScheduler extends BaseRequestScheduler { | 8 | module.exports = class RequestScheduler extends BaseRequestScheduler { |
9 | constructor () { | 9 | constructor () { |
diff --git a/server/lib/request-video-event-scheduler.js b/server/lib/request/request-video-event-scheduler.js index c7631253a..e54d34f4a 100644 --- a/server/lib/request-video-event-scheduler.js +++ b/server/lib/request/request-video-event-scheduler.js | |||
@@ -1,8 +1,8 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const BaseRequestScheduler = require('./base-request-scheduler') | 3 | const BaseRequestScheduler = require('./base-request-scheduler') |
4 | const constants = require('../initializers/constants') | 4 | const constants = require('../../initializers/constants') |
5 | const db = require('../initializers/database') | 5 | const db = require('../../initializers/database') |
6 | 6 | ||
7 | module.exports = class RequestVideoEventScheduler extends BaseRequestScheduler { | 7 | module.exports = class RequestVideoEventScheduler extends BaseRequestScheduler { |
8 | constructor () { | 8 | constructor () { |
diff --git a/server/lib/request-video-qadu-scheduler.js b/server/lib/request/request-video-qadu-scheduler.js index a85d35160..17402b556 100644 --- a/server/lib/request-video-qadu-scheduler.js +++ b/server/lib/request/request-video-qadu-scheduler.js | |||
@@ -1,9 +1,9 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const BaseRequestScheduler = require('./base-request-scheduler') | 3 | const BaseRequestScheduler = require('./base-request-scheduler') |
4 | const constants = require('../initializers/constants') | 4 | const constants = require('../../initializers/constants') |
5 | const db = require('../initializers/database') | 5 | const db = require('../../initializers/database') |
6 | const logger = require('../helpers/logger') | 6 | const logger = require('../../helpers/logger') |
7 | 7 | ||
8 | module.exports = class RequestVideoQaduScheduler extends BaseRequestScheduler { | 8 | module.exports = class RequestVideoQaduScheduler extends BaseRequestScheduler { |
9 | constructor () { | 9 | constructor () { |
diff --git a/server/middlewares/secure.js b/server/middlewares/secure.js index b6e6d818b..7c5c72508 100644 --- a/server/middlewares/secure.js +++ b/server/middlewares/secure.js | |||
@@ -24,6 +24,8 @@ function checkSignature (req, res, next) { | |||
24 | logger.debug('Checking signature from %s.', host) | 24 | logger.debug('Checking signature from %s.', host) |
25 | 25 | ||
26 | let signatureShouldBe | 26 | let signatureShouldBe |
27 | // If there is data in the body the sender used it for its signature | ||
28 | // If there is no data we just use its host as signature | ||
27 | if (req.body.data) { | 29 | if (req.body.data) { |
28 | signatureShouldBe = req.body.data | 30 | signatureShouldBe = req.body.data |
29 | } else { | 31 | } else { |