aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/requests.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/requests.js')
-rw-r--r--server/helpers/requests.js11
1 files changed, 2 insertions, 9 deletions
diff --git a/server/helpers/requests.js b/server/helpers/requests.js
index 547230adc..f76ff3473 100644
--- a/server/helpers/requests.js
+++ b/server/helpers/requests.js
@@ -1,16 +1,11 @@
1'use strict' 1'use strict'
2 2
3const config = require('config')
4const replay = require('request-replay') 3const replay = require('request-replay')
5const request = require('request') 4const request = require('request')
6 5
7const constants = require('../initializers/constants') 6const constants = require('../initializers/constants')
8const peertubeCrypto = require('./peertube-crypto') 7const peertubeCrypto = require('./peertube-crypto')
9 8
10const http = config.get('webserver.https') ? 'https' : 'http'
11const host = config.get('webserver.host')
12const port = config.get('webserver.port')
13
14const requests = { 9const requests = {
15 makeRetryRequest: makeRetryRequest, 10 makeRetryRequest: makeRetryRequest,
16 makeSecureRequest: makeSecureRequest 11 makeSecureRequest: makeSecureRequest
@@ -29,8 +24,6 @@ function makeRetryRequest (params, callback) {
29} 24}
30 25
31function makeSecureRequest (params, callback) { 26function 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