ActivityPub-federated video streaming platform using P2P directly in your web browser
Move the count of results for the pagination in constants module
Chocobozzz3fe81fa75eef
diff --git a/server/initializers/constants.js b/server/initializers/constants.jsindex bb141456ab..48e660fe26 100644--- a/server/initializers/constants.js+++ b/server/initializers/constants.js@@ -9,6 +9,9 @@ let FRIEND_BASE_SCORE = 100// Time to wait between requests to the friendslet INTERVAL = 60000+// Number of results by default for the pagination+const PAGINATION_COUNT_DEFAULT = 15+// Number of points we add/remove from a friend after a successful/bad requestconst PODS_SCORE = {MALUS: -10,@@ -37,6 +40,7 @@ module.exports = {API_VERSION: API_VERSION,FRIEND_BASE_SCORE: FRIEND_BASE_SCORE,INTERVAL: INTERVAL,+ PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT,PODS_SCORE: PODS_SCORE,REQUEST_RETRIES: REQUEST_RETRIES,THUMBNAILS_SIZE: THUMBNAILS_SIZE,diff --git a/server/middlewares/pagination.js b/server/middlewares/pagination.jsindex 2a426ec282..9fa43f008a 100644--- a/server/middlewares/pagination.js+++ b/server/middlewares/pagination.js@@ -1,5 +1,7 @@'use strict'+const constants = require('../initializers/constants')+const paginationMiddleware = {setPagination: setPagination}@@ -7,7 +9,7 @@ const paginationMiddleware = {function setPagination (req, res, next) {if (!req.query.start) req.query.start = 0else req.query.start = parseInt(req.query.start)- if (!req.query.count) req.query.count = 15+ if (!req.query.count) req.query.count = constants.PAGINATION_COUNT_DEFAULTelse req.query.count = parseInt(req.query.count)return next()