let dataToSign
if (params.data) {
- dataToSign = dataToSign = params.data
+ dataToSign = params.data
} else {
// We do not have data to sign so we just take our host
// It is not ideal but the connection should be in HTTPS
const peertubeCrypto = require('../helpers/peertube-crypto')
const requests = require('../helpers/requests')
const utils = require('../helpers/utils')
-const RequestScheduler = require('./request-scheduler')
-const RequestVideoQaduScheduler = require('./request-video-qadu-scheduler')
-const RequestVideoEventScheduler = require('./request-video-event-scheduler')
+const RequestScheduler = require('./request/request-scheduler')
+const RequestVideoQaduScheduler = require('./request/request-video-qadu-scheduler')
+const RequestVideoEventScheduler = require('./request/request-video-event-scheduler')
const ENDPOINT_ACTIONS = constants.REQUEST_ENDPOINT_ACTIONS[constants.REQUEST_ENDPOINTS.VIDEOS]
const eachLimit = require('async/eachLimit')
-const constants = require('../initializers/constants')
-const db = require('../initializers/database')
-const logger = require('../helpers/logger')
-const requests = require('../helpers/requests')
+const constants = require('../../initializers/constants')
+const db = require('../../initializers/database')
+const logger = require('../../helpers/logger')
+const requests = require('../../helpers/requests')
module.exports = class BaseRequestScheduler {
constructor (options) {
'use strict'
-const constants = require('../initializers/constants')
+const constants = require('../../initializers/constants')
const BaseRequestScheduler = require('./base-request-scheduler')
-const db = require('../initializers/database')
-const logger = require('../helpers/logger')
+const db = require('../../initializers/database')
+const logger = require('../../helpers/logger')
module.exports = class RequestScheduler extends BaseRequestScheduler {
constructor () {
'use strict'
const BaseRequestScheduler = require('./base-request-scheduler')
-const constants = require('../initializers/constants')
-const db = require('../initializers/database')
+const constants = require('../../initializers/constants')
+const db = require('../../initializers/database')
module.exports = class RequestVideoEventScheduler extends BaseRequestScheduler {
constructor () {
'use strict'
const BaseRequestScheduler = require('./base-request-scheduler')
-const constants = require('../initializers/constants')
-const db = require('../initializers/database')
-const logger = require('../helpers/logger')
+const constants = require('../../initializers/constants')
+const db = require('../../initializers/database')
+const logger = require('../../helpers/logger')
module.exports = class RequestVideoQaduScheduler extends BaseRequestScheduler {
constructor () {
logger.debug('Checking signature from %s.', host)
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) {
signatureShouldBe = req.body.data
} else {