]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Server: move requests lib in their own directory
authorChocobozzz <florian.bigard@gmail.com>
Fri, 5 May 2017 15:35:58 +0000 (17:35 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Fri, 5 May 2017 15:35:58 +0000 (17:35 +0200)
server/helpers/requests.js
server/lib/friends.js
server/lib/request/base-request-scheduler.js [moved from server/lib/base-request-scheduler.js with 94% similarity]
server/lib/request/request-scheduler.js [moved from server/lib/request-scheduler.js with 93% similarity]
server/lib/request/request-video-event-scheduler.js [moved from server/lib/request-video-event-scheduler.js with 96% similarity]
server/lib/request/request-video-qadu-scheduler.js [moved from server/lib/request-video-qadu-scheduler.js with 95% similarity]
server/middlewares/secure.js

index 42786411725ce8980bd3d017497567eb1f10ccb9..efe0569379a0c22617bbb12248d0d7ed62a160f3 100644 (file)
@@ -40,7 +40,7 @@ function makeSecureRequest (params, callback) {
 
     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
index 1c756752701400180665996b138c84a0fd7d44b2..6dd32406cb1c2491d8e589f9282cde6d79c16f61 100644 (file)
@@ -13,9 +13,9 @@ const logger = require('../helpers/logger')
 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]
 
similarity index 94%
rename from server/lib/base-request-scheduler.js
rename to server/lib/request/base-request-scheduler.js
index 7378971c8192e6315ed2f22118fda5be33c2648c..782448340cea95030aa97b055b96de290c209017 100644 (file)
@@ -2,10 +2,10 @@
 
 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) {
similarity index 93%
rename from server/lib/request-scheduler.js
rename to server/lib/request/request-scheduler.js
index f6020e746c53494b35f62633661778d8841f2728..555ec3e54b4130b7e8a0999f74752c0364af9f09 100644 (file)
@@ -1,9 +1,9 @@
 '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 () {
similarity index 96%
rename from server/lib/request-video-event-scheduler.js
rename to server/lib/request/request-video-event-scheduler.js
index c7631253ab0ca3dc1d3f919fea10cd19cc3df2db..e54d34f4a5aab8134adf11a2063cdca197b7a429 100644 (file)
@@ -1,8 +1,8 @@
 '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 () {
similarity index 95%
rename from server/lib/request-video-qadu-scheduler.js
rename to server/lib/request/request-video-qadu-scheduler.js
index a85d35160a7a36ab75a3426900881f6b98c0f3d1..17402b556945137d4208455bb671c466e3d21479 100644 (file)
@@ -1,9 +1,9 @@
 '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 () {
index b6e6d818b91995561b98f06df70459a6315e3360..7c5c72508d051dbc785521513cf17be2e83d103a 100644 (file)
@@ -24,6 +24,8 @@ function checkSignature (req, res, next) {
     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 {