diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-10-02 15:39:09 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-10-02 15:39:09 +0200 |
commit | a6375e69668ea42e19531c6bc68dcd37f3f7cbd7 (patch) | |
tree | 03204a408d56311692c3528bedcf95d2455e94f2 /server/helpers/requests.js | |
parent | 052937db8a8d282eccdbdf38d487ed8d85d3c0a7 (diff) | |
parent | c4403b29ad4db097af528a7f04eea07e0ed320d0 (diff) | |
download | PeerTube-a6375e69668ea42e19531c6bc68dcd37f3f7cbd7.tar.gz PeerTube-a6375e69668ea42e19531c6bc68dcd37f3f7cbd7.tar.zst PeerTube-a6375e69668ea42e19531c6bc68dcd37f3f7cbd7.zip |
Merge branch 'master' into webseed-merged
Diffstat (limited to 'server/helpers/requests.js')
-rw-r--r-- | server/helpers/requests.js | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/server/helpers/requests.js b/server/helpers/requests.js index 547230adc..95775c981 100644 --- a/server/helpers/requests.js +++ b/server/helpers/requests.js | |||
@@ -1,19 +1,14 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const config = require('config') | ||
4 | const replay = require('request-replay') | 3 | const replay = require('request-replay') |
5 | const request = require('request') | 4 | const request = require('request') |
6 | 5 | ||
7 | const constants = require('../initializers/constants') | 6 | const constants = require('../initializers/constants') |
8 | const peertubeCrypto = require('./peertube-crypto') | 7 | const peertubeCrypto = require('./peertube-crypto') |
9 | 8 | ||
10 | const http = config.get('webserver.https') ? 'https' : 'http' | ||
11 | const host = config.get('webserver.host') | ||
12 | const port = config.get('webserver.port') | ||
13 | |||
14 | const requests = { | 9 | const requests = { |
15 | makeRetryRequest: makeRetryRequest, | 10 | makeRetryRequest, |
16 | makeSecureRequest: makeSecureRequest | 11 | makeSecureRequest |
17 | } | 12 | } |
18 | 13 | ||
19 | function makeRetryRequest (params, callback) { | 14 | function makeRetryRequest (params, callback) { |
@@ -29,8 +24,6 @@ function makeRetryRequest (params, callback) { | |||
29 | } | 24 | } |
30 | 25 | ||
31 | function makeSecureRequest (params, callback) { | 26 | function makeSecureRequest (params, callback) { |
32 | const myUrl = http + '://' + host + ':' + port | ||
33 | |||
34 | const requestParams = { | 27 | const requestParams = { |
35 | url: params.toPod.url + params.path | 28 | url: params.toPod.url + params.path |
36 | } | 29 | } |
@@ -42,8 +35,8 @@ function makeSecureRequest (params, callback) { | |||
42 | // Add signature if it is specified in the params | 35 | // Add signature if it is specified in the params |
43 | if (params.sign === true) { | 36 | if (params.sign === true) { |
44 | requestParams.json.signature = { | 37 | requestParams.json.signature = { |
45 | url: myUrl, | 38 | url: constants.CONFIG.WEBSERVER.URL, |
46 | signature: peertubeCrypto.sign(myUrl) | 39 | signature: peertubeCrypto.sign(constants.CONFIG.WEBSERVER.URL) |
47 | } | 40 | } |
48 | } | 41 | } |
49 | 42 | ||