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'
const miscValidators = {
exists: exists,
isArray: isArray
exists,
isArray
}
function exists (value) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -17,13 +17,13 @@ const Request = mongoose.model('Request')
const Video = mongoose.model('Video')
const friends = {
addVideoToFriends: addVideoToFriends,
hasFriends: hasFriends,
getMyCertificate: getMyCertificate,
makeFriends: makeFriends,
quitFriends: quitFriends,
removeVideoToFriends: removeVideoToFriends,
sendOwnedVideosToPod: sendOwnedVideosToPod
addVideoToFriends,
hasFriends,
getMyCertificate,
makeFriends,
quitFriends,
removeVideoToFriends,
sendOwnedVideosToPod
}
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
const OAuthModel = {
getAccessToken: getAccessToken,
getClient: getClient,
getRefreshToken: getRefreshToken,
getUser: getUser,
revokeToken: revokeToken,
saveToken: saveToken
getAccessToken,
getClient,
getRefreshToken,
getUser,
revokeToken,
saveToken
}
// ---------------------------------------------------------------------------

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -18,10 +18,10 @@ OAuthTokenSchema.path('client').required(true)
OAuthTokenSchema.path('user').required(true)
OAuthTokenSchema.statics = {
getByRefreshTokenAndPopulateClient: getByRefreshTokenAndPopulateClient,
getByTokenAndPopulateUser: getByTokenAndPopulateUser,
getByRefreshToken: getByRefreshToken,
removeByUserId: removeByUserId
getByRefreshTokenAndPopulateClient,
getByTokenAndPopulateUser,
getByRefreshToken,
removeByUserId
}
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.methods = {
toFormatedJSON: toFormatedJSON
toFormatedJSON
}
PodSchema.statics = {
countAll: countAll,
incrementScores: incrementScores,
list: list,
listAllIds: listAllIds,
listBadPods: listBadPods,
load: load,
loadByUrl: loadByUrl,
removeAll: removeAll
countAll,
incrementScores,
list,
listAllIds,
listBadPods,
load,
loadByUrl,
removeAll
}
PodSchema.pre('save', function (next) {

View file

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

View file

@ -3,7 +3,7 @@
const parallel = require('async/parallel')
const utils = {
listForApiWithCount: listForApiWithCount
listForApiWithCount
}
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.methods = {
isOwned: isOwned,
toFormatedJSON: toFormatedJSON,
toRemoteJSON: toRemoteJSON
isOwned,
toFormatedJSON,
toRemoteJSON
}
VideoSchema.statics = {
getDurationFromFile: getDurationFromFile,
listForApi: listForApi,
listByUrlAndMagnet: listByUrlAndMagnet,
listByUrls: listByUrls,
listOwned: listOwned,
listOwnedByAuthor: listOwnedByAuthor,
listRemotes: listRemotes,
load: load,
search: search,
seedAllExisting: seedAllExisting
getDurationFromFile,
listForApi,
listByUrlAndMagnet,
listByUrls,
listOwned,
listOwnedByAuthor,
listRemotes,
load,
search,
seedAllExisting
}
VideoSchema.pre('remove', function (next) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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