Server: move requests lib in their own directory
This commit is contained in:
parent
4e284e97b9
commit
5a976a8c35
|
@ -40,7 +40,7 @@ function makeSecureRequest (params, callback) {
|
||||||
|
|
||||||
let dataToSign
|
let dataToSign
|
||||||
if (params.data) {
|
if (params.data) {
|
||||||
dataToSign = dataToSign = params.data
|
dataToSign = params.data
|
||||||
} else {
|
} else {
|
||||||
// We do not have data to sign so we just take our host
|
// We do not have data to sign so we just take our host
|
||||||
// It is not ideal but the connection should be in HTTPS
|
// It is not ideal but the connection should be in HTTPS
|
||||||
|
|
|
@ -13,9 +13,9 @@ const logger = require('../helpers/logger')
|
||||||
const peertubeCrypto = require('../helpers/peertube-crypto')
|
const peertubeCrypto = require('../helpers/peertube-crypto')
|
||||||
const requests = require('../helpers/requests')
|
const requests = require('../helpers/requests')
|
||||||
const utils = require('../helpers/utils')
|
const utils = require('../helpers/utils')
|
||||||
const RequestScheduler = require('./request-scheduler')
|
const RequestScheduler = require('./request/request-scheduler')
|
||||||
const RequestVideoQaduScheduler = require('./request-video-qadu-scheduler')
|
const RequestVideoQaduScheduler = require('./request/request-video-qadu-scheduler')
|
||||||
const RequestVideoEventScheduler = require('./request-video-event-scheduler')
|
const RequestVideoEventScheduler = require('./request/request-video-event-scheduler')
|
||||||
|
|
||||||
const ENDPOINT_ACTIONS = constants.REQUEST_ENDPOINT_ACTIONS[constants.REQUEST_ENDPOINTS.VIDEOS]
|
const ENDPOINT_ACTIONS = constants.REQUEST_ENDPOINT_ACTIONS[constants.REQUEST_ENDPOINTS.VIDEOS]
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const eachLimit = require('async/eachLimit')
|
const eachLimit = require('async/eachLimit')
|
||||||
|
|
||||||
const constants = require('../initializers/constants')
|
const constants = require('../../initializers/constants')
|
||||||
const db = require('../initializers/database')
|
const db = require('../../initializers/database')
|
||||||
const logger = require('../helpers/logger')
|
const logger = require('../../helpers/logger')
|
||||||
const requests = require('../helpers/requests')
|
const requests = require('../../helpers/requests')
|
||||||
|
|
||||||
module.exports = class BaseRequestScheduler {
|
module.exports = class BaseRequestScheduler {
|
||||||
constructor (options) {
|
constructor (options) {
|
|
@ -1,9 +1,9 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const constants = require('../initializers/constants')
|
const constants = require('../../initializers/constants')
|
||||||
const BaseRequestScheduler = require('./base-request-scheduler')
|
const BaseRequestScheduler = require('./base-request-scheduler')
|
||||||
const db = require('../initializers/database')
|
const db = require('../../initializers/database')
|
||||||
const logger = require('../helpers/logger')
|
const logger = require('../../helpers/logger')
|
||||||
|
|
||||||
module.exports = class RequestScheduler extends BaseRequestScheduler {
|
module.exports = class RequestScheduler extends BaseRequestScheduler {
|
||||||
constructor () {
|
constructor () {
|
|
@ -1,8 +1,8 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const BaseRequestScheduler = require('./base-request-scheduler')
|
const BaseRequestScheduler = require('./base-request-scheduler')
|
||||||
const constants = require('../initializers/constants')
|
const constants = require('../../initializers/constants')
|
||||||
const db = require('../initializers/database')
|
const db = require('../../initializers/database')
|
||||||
|
|
||||||
module.exports = class RequestVideoEventScheduler extends BaseRequestScheduler {
|
module.exports = class RequestVideoEventScheduler extends BaseRequestScheduler {
|
||||||
constructor () {
|
constructor () {
|
|
@ -1,9 +1,9 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const BaseRequestScheduler = require('./base-request-scheduler')
|
const BaseRequestScheduler = require('./base-request-scheduler')
|
||||||
const constants = require('../initializers/constants')
|
const constants = require('../../initializers/constants')
|
||||||
const db = require('../initializers/database')
|
const db = require('../../initializers/database')
|
||||||
const logger = require('../helpers/logger')
|
const logger = require('../../helpers/logger')
|
||||||
|
|
||||||
module.exports = class RequestVideoQaduScheduler extends BaseRequestScheduler {
|
module.exports = class RequestVideoQaduScheduler extends BaseRequestScheduler {
|
||||||
constructor () {
|
constructor () {
|
|
@ -24,6 +24,8 @@ function checkSignature (req, res, next) {
|
||||||
logger.debug('Checking signature from %s.', host)
|
logger.debug('Checking signature from %s.', host)
|
||||||
|
|
||||||
let signatureShouldBe
|
let signatureShouldBe
|
||||||
|
// If there is data in the body the sender used it for its signature
|
||||||
|
// If there is no data we just use its host as signature
|
||||||
if (req.body.data) {
|
if (req.body.data) {
|
||||||
signatureShouldBe = req.body.data
|
signatureShouldBe = req.body.data
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue