1
0
Fork 0

Server: remove useless hash affectations

This commit is contained in:
Chocobozzz 2016-10-02 12:19:02 +02:00
parent 9f6bae3a9d
commit c4403b29ad
39 changed files with 144 additions and 144 deletions

View file

@ -1,8 +1,8 @@
'use strict' 'use strict'
const miscValidators = { const miscValidators = {
exists: exists, exists,
isArray: isArray isArray
} }
function exists (value) { function exists (value) {

View file

@ -5,7 +5,7 @@ const validator = require('express-validator').validator
const miscValidators = require('./misc') const miscValidators = require('./misc')
const podsValidators = { const podsValidators = {
isEachUniqueUrlValid: isEachUniqueUrlValid isEachUniqueUrlValid
} }
function isEachUniqueUrlValid (urls) { function isEachUniqueUrlValid (urls) {

View file

@ -7,9 +7,9 @@ const constants = require('../../initializers/constants')
const USERS_CONSTRAINTS_FIELDS = constants.CONSTRAINTS_FIELDS.USERS const USERS_CONSTRAINTS_FIELDS = constants.CONSTRAINTS_FIELDS.USERS
const usersValidators = { const usersValidators = {
isUserPasswordValid: isUserPasswordValid, isUserPasswordValid,
isUserRoleValid: isUserRoleValid, isUserRoleValid,
isUserUsernameValid: isUserUsernameValid isUserUsernameValid
} }
function isUserPasswordValid (value) { function isUserPasswordValid (value) {

View file

@ -8,17 +8,17 @@ const miscValidators = require('./misc')
const VIDEOS_CONSTRAINTS_FIELDS = constants.CONSTRAINTS_FIELDS.VIDEOS const VIDEOS_CONSTRAINTS_FIELDS = constants.CONSTRAINTS_FIELDS.VIDEOS
const videosValidators = { const videosValidators = {
isEachRemoteVideosValid: isEachRemoteVideosValid, isEachRemoteVideosValid,
isVideoAuthorValid: isVideoAuthorValid, isVideoAuthorValid,
isVideoDateValid: isVideoDateValid, isVideoDateValid,
isVideoDescriptionValid: isVideoDescriptionValid, isVideoDescriptionValid,
isVideoDurationValid: isVideoDurationValid, isVideoDurationValid,
isVideoMagnetUriValid: isVideoMagnetUriValid, isVideoMagnetUriValid,
isVideoNameValid: isVideoNameValid, isVideoNameValid,
isVideoPodUrlValid: isVideoPodUrlValid, isVideoPodUrlValid,
isVideoTagsValid: isVideoTagsValid, isVideoTagsValid,
isVideoThumbnailValid: isVideoThumbnailValid, isVideoThumbnailValid,
isVideoThumbnail64Valid: isVideoThumbnail64Valid isVideoThumbnail64Valid
} }
function isEachRemoteVideosValid (requests) { function isEachRemoteVideosValid (requests) {

View file

@ -12,13 +12,13 @@ const logger = require('./logger')
const algorithm = 'aes-256-ctr' const algorithm = 'aes-256-ctr'
const peertubeCrypto = { const peertubeCrypto = {
checkSignature: checkSignature, checkSignature,
comparePassword: comparePassword, comparePassword,
createCertsIfNotExist: createCertsIfNotExist, createCertsIfNotExist,
cryptPassword: cryptPassword, cryptPassword,
decrypt: decrypt, decrypt,
encrypt: encrypt, encrypt,
sign: sign sign
} }
function checkSignature (publicKey, rawData, hexSignature) { function checkSignature (publicKey, rawData, hexSignature) {

View file

@ -7,8 +7,8 @@ const constants = require('../initializers/constants')
const peertubeCrypto = require('./peertube-crypto') const peertubeCrypto = require('./peertube-crypto')
const requests = { const requests = {
makeRetryRequest: makeRetryRequest, makeRetryRequest,
makeSecureRequest: makeSecureRequest makeSecureRequest
} }
function makeRetryRequest (params, callback) { function makeRetryRequest (params, callback) {

View file

@ -5,8 +5,8 @@ const crypto = require('crypto')
const logger = require('./logger') const logger = require('./logger')
const utils = { const utils = {
cleanForExit: cleanForExit, cleanForExit,
generateRandomString: generateRandomString generateRandomString
} }
function generateRandomString (size, callback) { function generateRandomString (size, callback) {

View file

@ -7,9 +7,9 @@ const Client = mongoose.model('OAuthClient')
const User = mongoose.model('User') const User = mongoose.model('User')
const checker = { const checker = {
checkConfig: checkConfig, checkConfig,
clientsExist: clientsExist, clientsExist,
usersExist: usersExist usersExist
} }
// Check the config files // Check the config files

View file

@ -18,7 +18,7 @@ const Client = mongoose.model('OAuthClient')
const User = mongoose.model('User') const User = mongoose.model('User')
const installer = { const installer = {
installApplication: installApplication installApplication
} }
function installApplication (callback) { function installApplication (callback) {
@ -107,9 +107,9 @@ function createOAuthAdminIfNotExist (callback) {
} }
const user = new User({ const user = new User({
username: username, username,
password: password, password,
role: role role
}) })
user.save(function (err, createdUser) { user.save(function (err, createdUser) {

View file

@ -17,13 +17,13 @@ const Request = mongoose.model('Request')
const Video = mongoose.model('Video') const Video = mongoose.model('Video')
const friends = { const friends = {
addVideoToFriends: addVideoToFriends, addVideoToFriends,
hasFriends: hasFriends, hasFriends,
getMyCertificate: getMyCertificate, getMyCertificate,
makeFriends: makeFriends, makeFriends,
quitFriends: quitFriends, quitFriends,
removeVideoToFriends: removeVideoToFriends, removeVideoToFriends,
sendOwnedVideosToPod: sendOwnedVideosToPod sendOwnedVideosToPod
} }
function addVideoToFriends (video) { function addVideoToFriends (video) {

View file

@ -8,12 +8,12 @@ const User = mongoose.model('User')
// See https://github.com/oauthjs/node-oauth2-server/wiki/Model-specification for the model specifications // See https://github.com/oauthjs/node-oauth2-server/wiki/Model-specification for the model specifications
const OAuthModel = { const OAuthModel = {
getAccessToken: getAccessToken, getAccessToken,
getClient: getClient, getClient,
getRefreshToken: getRefreshToken, getRefreshToken,
getUser: getUser, getUser,
revokeToken: revokeToken, revokeToken,
saveToken: saveToken saveToken
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View file

@ -4,7 +4,7 @@ const constants = require('../initializers/constants')
const logger = require('../helpers/logger') const logger = require('../helpers/logger')
const adminMiddleware = { const adminMiddleware = {
ensureIsAdmin: ensureIsAdmin ensureIsAdmin
} }
function ensureIsAdmin (req, res, next) { function ensureIsAdmin (req, res, next) {

View file

@ -12,8 +12,8 @@ const oAuthServer = new OAuthServer({
}) })
const oAuth = { const oAuth = {
authenticate: authenticate, authenticate,
token: token token
} }
function authenticate (req, res, next) { function authenticate (req, res, next) {

View file

@ -3,7 +3,7 @@
const constants = require('../initializers/constants') const constants = require('../initializers/constants')
const paginationMiddleware = { const paginationMiddleware = {
setPagination: setPagination setPagination
} }
function setPagination (req, res, next) { function setPagination (req, res, next) {

View file

@ -5,8 +5,8 @@ const urlModule = require('url')
const logger = require('../helpers/logger') const logger = require('../helpers/logger')
const podsMiddleware = { const podsMiddleware = {
setBodyUrlsPort: setBodyUrlsPort, setBodyUrlsPort,
setBodyUrlPort: setBodyUrlPort setBodyUrlPort
} }
function setBodyUrlsPort (req, res, next) { function setBodyUrlsPort (req, res, next) {

View file

@ -1,7 +1,7 @@
'use strict' 'use strict'
const searchMiddleware = { const searchMiddleware = {
setVideosSearch: setVideosSearch setVideosSearch
} }
function setVideosSearch (req, res, next) { function setVideosSearch (req, res, next) {

View file

@ -7,8 +7,8 @@ const peertubeCrypto = require('../helpers/peertube-crypto')
const Pod = mongoose.model('Pod') const Pod = mongoose.model('Pod')
const secureMiddleware = { const secureMiddleware = {
checkSignature: checkSignature, checkSignature,
decryptBody: decryptBody decryptBody
} }
function checkSignature (req, res, next) { function checkSignature (req, res, next) {

View file

@ -1,8 +1,8 @@
'use strict' 'use strict'
const sortMiddleware = { const sortMiddleware = {
setUsersSort: setUsersSort, setUsersSort,
setVideosSort: setVideosSort setVideosSort
} }
function setUsersSort (req, res, next) { function setUsersSort (req, res, next) {

View file

@ -4,7 +4,7 @@ const checkErrors = require('./utils').checkErrors
const logger = require('../../helpers/logger') const logger = require('../../helpers/logger')
const validatorsPagination = { const validatorsPagination = {
pagination: pagination pagination
} }
function pagination (req, res, next) { function pagination (req, res, next) {

View file

@ -5,8 +5,8 @@ const friends = require('../../lib/friends')
const logger = require('../../helpers/logger') const logger = require('../../helpers/logger')
const validatorsPod = { const validatorsPod = {
makeFriends: makeFriends, makeFriends,
podsAdd: podsAdd podsAdd
} }
function makeFriends (req, res, next) { function makeFriends (req, res, next) {

View file

@ -4,9 +4,9 @@ const checkErrors = require('./utils').checkErrors
const logger = require('../../helpers/logger') const logger = require('../../helpers/logger')
const validatorsRemote = { const validatorsRemote = {
dataToDecrypt: dataToDecrypt, dataToDecrypt,
remoteVideos: remoteVideos, remoteVideos,
signature: signature signature
} }
function dataToDecrypt (req, res, next) { function dataToDecrypt (req, res, next) {

View file

@ -5,8 +5,8 @@ const constants = require('../../initializers/constants')
const logger = require('../../helpers/logger') const logger = require('../../helpers/logger')
const validatorsSort = { const validatorsSort = {
usersSort: usersSort, usersSort,
videosSort: videosSort videosSort
} }
function usersSort (req, res, next) { function usersSort (req, res, next) {

View file

@ -8,9 +8,9 @@ const logger = require('../../helpers/logger')
const User = mongoose.model('User') const User = mongoose.model('User')
const validatorsUsers = { const validatorsUsers = {
usersAdd: usersAdd, usersAdd,
usersRemove: usersRemove, usersRemove,
usersUpdate: usersUpdate usersUpdate
} }
function usersAdd (req, res, next) { function usersAdd (req, res, next) {

View file

@ -5,7 +5,7 @@ const util = require('util')
const logger = require('../../helpers/logger') const logger = require('../../helpers/logger')
const validatorsUtils = { const validatorsUtils = {
checkErrors: checkErrors checkErrors
} }
function checkErrors (req, res, next, statusCode) { function checkErrors (req, res, next, statusCode) {

View file

@ -10,10 +10,10 @@ const logger = require('../../helpers/logger')
const Video = mongoose.model('Video') const Video = mongoose.model('Video')
const validatorsVideos = { const validatorsVideos = {
videosAdd: videosAdd, videosAdd,
videosGet: videosGet, videosGet,
videosRemove: videosRemove, videosRemove,
videosSearch: videosSearch videosSearch
} }
function videosAdd (req, res, next) { function videosAdd (req, res, next) {

View file

@ -10,8 +10,8 @@ const ApplicationSchema = mongoose.Schema({
}) })
ApplicationSchema.statics = { ApplicationSchema.statics = {
loadMongoSchemaVersion: loadMongoSchemaVersion, loadMongoSchemaVersion,
updateMongoSchemaVersion: updateMongoSchemaVersion updateMongoSchemaVersion
} }
mongoose.model('Application', ApplicationSchema) mongoose.model('Application', ApplicationSchema)

View file

@ -11,9 +11,9 @@ const OAuthClientSchema = mongoose.Schema({
OAuthClientSchema.path('clientSecret').required(true) OAuthClientSchema.path('clientSecret').required(true)
OAuthClientSchema.statics = { OAuthClientSchema.statics = {
getByIdAndSecret: getByIdAndSecret, getByIdAndSecret,
list: list, list,
loadFirstClient: loadFirstClient loadFirstClient
} }
mongoose.model('OAuthClient', OAuthClientSchema) mongoose.model('OAuthClient', OAuthClientSchema)

View file

@ -18,10 +18,10 @@ OAuthTokenSchema.path('client').required(true)
OAuthTokenSchema.path('user').required(true) OAuthTokenSchema.path('user').required(true)
OAuthTokenSchema.statics = { OAuthTokenSchema.statics = {
getByRefreshTokenAndPopulateClient: getByRefreshTokenAndPopulateClient, getByRefreshTokenAndPopulateClient,
getByTokenAndPopulateUser: getByTokenAndPopulateUser, getByTokenAndPopulateUser,
getByRefreshToken: getByRefreshToken, getByRefreshToken,
removeByUserId: removeByUserId removeByUserId
} }
mongoose.model('OAuthToken', OAuthTokenSchema) mongoose.model('OAuthToken', OAuthTokenSchema)

View file

@ -24,18 +24,18 @@ PodSchema.path('publicKey').required(true)
PodSchema.path('score').validate(function (value) { return !isNaN(value) }) PodSchema.path('score').validate(function (value) { return !isNaN(value) })
PodSchema.methods = { PodSchema.methods = {
toFormatedJSON: toFormatedJSON toFormatedJSON
} }
PodSchema.statics = { PodSchema.statics = {
countAll: countAll, countAll,
incrementScores: incrementScores, incrementScores,
list: list, list,
listAllIds: listAllIds, listAllIds,
listBadPods: listBadPods, listBadPods,
load: load, load,
loadByUrl: loadByUrl, loadByUrl,
removeAll: removeAll removeAll
} }
PodSchema.pre('save', function (next) { PodSchema.pre('save', function (next) {

View file

@ -23,17 +23,17 @@ UserSchema.path('username').required(customUsersValidators.isUserUsernameValid)
UserSchema.path('role').validate(customUsersValidators.isUserRoleValid) UserSchema.path('role').validate(customUsersValidators.isUserRoleValid)
UserSchema.methods = { UserSchema.methods = {
isPasswordMatch: isPasswordMatch, isPasswordMatch,
toFormatedJSON: toFormatedJSON toFormatedJSON
} }
UserSchema.statics = { UserSchema.statics = {
countTotal: countTotal, countTotal,
getByUsername: getByUsername, getByUsername,
list: list, list,
listForApi: listForApi, listForApi,
loadById: loadById, loadById,
loadByUsername: loadByUsername loadByUsername
} }
UserSchema.pre('save', function (next) { UserSchema.pre('save', function (next) {

View file

@ -3,7 +3,7 @@
const parallel = require('async/parallel') const parallel = require('async/parallel')
const utils = { const utils = {
listForApiWithCount: listForApiWithCount listForApiWithCount
} }
function listForApiWithCount (query, start, count, sort, callback) { function listForApiWithCount (query, start, count, sort, callback) {

View file

@ -47,22 +47,22 @@ VideoSchema.path('thumbnail').validate(function (value) {
VideoSchema.path('tags').validate(customVideosValidators.isVideoTagsValid) VideoSchema.path('tags').validate(customVideosValidators.isVideoTagsValid)
VideoSchema.methods = { VideoSchema.methods = {
isOwned: isOwned, isOwned,
toFormatedJSON: toFormatedJSON, toFormatedJSON,
toRemoteJSON: toRemoteJSON toRemoteJSON
} }
VideoSchema.statics = { VideoSchema.statics = {
getDurationFromFile: getDurationFromFile, getDurationFromFile,
listForApi: listForApi, listForApi,
listByUrlAndMagnet: listByUrlAndMagnet, listByUrlAndMagnet,
listByUrls: listByUrls, listByUrls,
listOwned: listOwned, listOwned,
listOwnedByAuthor: listOwnedByAuthor, listOwnedByAuthor,
listRemotes: listRemotes, listRemotes,
load: load, load,
search: search, search,
seedAllExisting: seedAllExisting seedAllExisting
} }
VideoSchema.pre('remove', function (next) { VideoSchema.pre('remove', function (next) {

View file

@ -3,8 +3,8 @@
const request = require('supertest') const request = require('supertest')
const loginUtils = { const loginUtils = {
login: login, login,
loginAndGetAccessToken: loginAndGetAccessToken loginAndGetAccessToken
} }
// ---------------------- Export functions -------------------- // ---------------------- Export functions --------------------

View file

@ -1,7 +1,7 @@
'use strict' 'use strict'
const miscsUtils = { const miscsUtils = {
dateIsValid: dateIsValid dateIsValid
} }
// ---------------------- Export functions -------------------- // ---------------------- Export functions --------------------

View file

@ -3,9 +3,9 @@
const request = require('supertest') const request = require('supertest')
const podsUtils = { const podsUtils = {
getFriendsList: getFriendsList, getFriendsList,
makeFriends: makeFriends, makeFriends,
quitFriends: quitFriends quitFriends
} }
// ---------------------- Export functions -------------------- // ---------------------- Export functions --------------------

View file

@ -3,9 +3,9 @@
const request = require('supertest') const request = require('supertest')
const requestsUtils = { const requestsUtils = {
makePostUploadRequest: makePostUploadRequest, makePostUploadRequest,
makePostBodyRequest: makePostBodyRequest, makePostBodyRequest,
makePutBodyRequest: makePutBodyRequest makePutBodyRequest
} }
// ---------------------- Export functions -------------------- // ---------------------- Export functions --------------------

View file

@ -6,9 +6,9 @@ const fork = childProcess.fork
const pathUtils = require('path') const pathUtils = require('path')
const serversUtils = { const serversUtils = {
flushAndRunMultipleServers: flushAndRunMultipleServers, flushAndRunMultipleServers,
flushTests: flushTests, flushTests,
runServer: runServer runServer
} }
// ---------------------- Export functions -------------------- // ---------------------- Export functions --------------------

View file

@ -3,12 +3,12 @@
const request = require('supertest') const request = require('supertest')
const usersUtils = { const usersUtils = {
createUser: createUser, createUser,
getUserInformation: getUserInformation, getUserInformation,
getUsersList: getUsersList, getUsersList,
getUsersListPaginationAndSort: getUsersListPaginationAndSort, getUsersListPaginationAndSort,
removeUser: removeUser, removeUser,
updateUser: updateUser updateUser
} }
// ---------------------- Export functions -------------------- // ---------------------- Export functions --------------------

View file

@ -5,17 +5,17 @@ const pathUtils = require('path')
const request = require('supertest') const request = require('supertest')
const videosUtils = { const videosUtils = {
getAllVideosListBy: getAllVideosListBy, getAllVideosListBy,
getVideo: getVideo, getVideo,
getVideosList: getVideosList, getVideosList,
getVideosListPagination: getVideosListPagination, getVideosListPagination,
getVideosListSort: getVideosListSort, getVideosListSort,
removeVideo: removeVideo, removeVideo,
searchVideo: searchVideo, searchVideo,
searchVideoWithPagination: searchVideoWithPagination, searchVideoWithPagination,
searchVideoWithSort: searchVideoWithSort, searchVideoWithSort,
testVideoImage: testVideoImage, testVideoImage,
uploadVideo: uploadVideo uploadVideo
} }
// ---------------------- Export functions -------------------- // ---------------------- Export functions --------------------