From: Chocobozzz Date: Sun, 2 Oct 2016 10:19:02 +0000 (+0200) Subject: Server: remove useless hash affectations X-Git-Tag: v0.0.1-alpha~700 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c4403b29ad4db097af528a7f04eea07e0ed320d0;p=oweals%2Fpeertube.git Server: remove useless hash affectations --- diff --git a/server/helpers/custom-validators/misc.js b/server/helpers/custom-validators/misc.js index 782ae3dee..052726241 100644 --- a/server/helpers/custom-validators/misc.js +++ b/server/helpers/custom-validators/misc.js @@ -1,8 +1,8 @@ 'use strict' const miscValidators = { - exists: exists, - isArray: isArray + exists, + isArray } function exists (value) { diff --git a/server/helpers/custom-validators/pods.js b/server/helpers/custom-validators/pods.js index 28d04a05d..40f8b5d0b 100644 --- a/server/helpers/custom-validators/pods.js +++ b/server/helpers/custom-validators/pods.js @@ -5,7 +5,7 @@ const validator = require('express-validator').validator const miscValidators = require('./misc') const podsValidators = { - isEachUniqueUrlValid: isEachUniqueUrlValid + isEachUniqueUrlValid } function isEachUniqueUrlValid (urls) { diff --git a/server/helpers/custom-validators/users.js b/server/helpers/custom-validators/users.js index 0e92989e5..88fa1592e 100644 --- a/server/helpers/custom-validators/users.js +++ b/server/helpers/custom-validators/users.js @@ -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) { diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js index ebe927208..a507ff686 100644 --- a/server/helpers/custom-validators/videos.js +++ b/server/helpers/custom-validators/videos.js @@ -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) { diff --git a/server/helpers/peertube-crypto.js b/server/helpers/peertube-crypto.js index 4783e9965..1ff638b04 100644 --- a/server/helpers/peertube-crypto.js +++ b/server/helpers/peertube-crypto.js @@ -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) { diff --git a/server/helpers/requests.js b/server/helpers/requests.js index f76ff3473..95775c981 100644 --- a/server/helpers/requests.js +++ b/server/helpers/requests.js @@ -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) { diff --git a/server/helpers/utils.js b/server/helpers/utils.js index a77116e08..9c2d402e3 100644 --- a/server/helpers/utils.js +++ b/server/helpers/utils.js @@ -5,8 +5,8 @@ const crypto = require('crypto') const logger = require('./logger') const utils = { - cleanForExit: cleanForExit, - generateRandomString: generateRandomString + cleanForExit, + generateRandomString } function generateRandomString (size, callback) { diff --git a/server/initializers/checker.js b/server/initializers/checker.js index 2a33009b4..91fbcfaf9 100644 --- a/server/initializers/checker.js +++ b/server/initializers/checker.js @@ -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 diff --git a/server/initializers/installer.js b/server/initializers/installer.js index 8c3148e79..1df300ba8 100644 --- a/server/initializers/installer.js +++ b/server/initializers/installer.js @@ -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) { diff --git a/server/lib/friends.js b/server/lib/friends.js index 6c4383d8e..556d2e773 100644 --- a/server/lib/friends.js +++ b/server/lib/friends.js @@ -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) { diff --git a/server/lib/oauth-model.js b/server/lib/oauth-model.js index 6dab02fca..45f796796 100644 --- a/server/lib/oauth-model.js +++ b/server/lib/oauth-model.js @@ -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 } // --------------------------------------------------------------------------- diff --git a/server/middlewares/admin.js b/server/middlewares/admin.js index bcb60ab95..e6d9dc887 100644 --- a/server/middlewares/admin.js +++ b/server/middlewares/admin.js @@ -4,7 +4,7 @@ const constants = require('../initializers/constants') const logger = require('../helpers/logger') const adminMiddleware = { - ensureIsAdmin: ensureIsAdmin + ensureIsAdmin } function ensureIsAdmin (req, res, next) { diff --git a/server/middlewares/oauth.js b/server/middlewares/oauth.js index 08584c41c..3a02b9b48 100644 --- a/server/middlewares/oauth.js +++ b/server/middlewares/oauth.js @@ -12,8 +12,8 @@ const oAuthServer = new OAuthServer({ }) const oAuth = { - authenticate: authenticate, - token: token + authenticate, + token } function authenticate (req, res, next) { diff --git a/server/middlewares/pagination.js b/server/middlewares/pagination.js index a571e51f6..a90f60aab 100644 --- a/server/middlewares/pagination.js +++ b/server/middlewares/pagination.js @@ -3,7 +3,7 @@ const constants = require('../initializers/constants') const paginationMiddleware = { - setPagination: setPagination + setPagination } function setPagination (req, res, next) { diff --git a/server/middlewares/pods.js b/server/middlewares/pods.js index 116b02b3c..6e0874a76 100644 --- a/server/middlewares/pods.js +++ b/server/middlewares/pods.js @@ -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) { diff --git a/server/middlewares/search.js b/server/middlewares/search.js index 89302a564..bb88faf54 100644 --- a/server/middlewares/search.js +++ b/server/middlewares/search.js @@ -1,7 +1,7 @@ 'use strict' const searchMiddleware = { - setVideosSearch: setVideosSearch + setVideosSearch } function setVideosSearch (req, res, next) { diff --git a/server/middlewares/secure.js b/server/middlewares/secure.js index 33a52e8d9..58f824d14 100644 --- a/server/middlewares/secure.js +++ b/server/middlewares/secure.js @@ -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) { diff --git a/server/middlewares/sort.js b/server/middlewares/sort.js index 8ed157805..f0b7274eb 100644 --- a/server/middlewares/sort.js +++ b/server/middlewares/sort.js @@ -1,8 +1,8 @@ 'use strict' const sortMiddleware = { - setUsersSort: setUsersSort, - setVideosSort: setVideosSort + setUsersSort, + setVideosSort } function setUsersSort (req, res, next) { diff --git a/server/middlewares/validators/pagination.js b/server/middlewares/validators/pagination.js index 8e9a01053..16682696e 100644 --- a/server/middlewares/validators/pagination.js +++ b/server/middlewares/validators/pagination.js @@ -4,7 +4,7 @@ const checkErrors = require('./utils').checkErrors const logger = require('../../helpers/logger') const validatorsPagination = { - pagination: pagination + pagination } function pagination (req, res, next) { diff --git a/server/middlewares/validators/pods.js b/server/middlewares/validators/pods.js index 3c605c45e..fd3d1e2f2 100644 --- a/server/middlewares/validators/pods.js +++ b/server/middlewares/validators/pods.js @@ -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) { diff --git a/server/middlewares/validators/remote.js b/server/middlewares/validators/remote.js index 87dc524a2..8c29ef8ca 100644 --- a/server/middlewares/validators/remote.js +++ b/server/middlewares/validators/remote.js @@ -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) { diff --git a/server/middlewares/validators/sort.js b/server/middlewares/validators/sort.js index 37b34ef52..431d3fffd 100644 --- a/server/middlewares/validators/sort.js +++ b/server/middlewares/validators/sort.js @@ -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) { diff --git a/server/middlewares/validators/users.js b/server/middlewares/validators/users.js index 5defdf4e3..d541e9124 100644 --- a/server/middlewares/validators/users.js +++ b/server/middlewares/validators/users.js @@ -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) { diff --git a/server/middlewares/validators/utils.js b/server/middlewares/validators/utils.js index f6e5b2b38..3741b84c6 100644 --- a/server/middlewares/validators/utils.js +++ b/server/middlewares/validators/utils.js @@ -5,7 +5,7 @@ const util = require('util') const logger = require('../../helpers/logger') const validatorsUtils = { - checkErrors: checkErrors + checkErrors } function checkErrors (req, res, next, statusCode) { diff --git a/server/middlewares/validators/videos.js b/server/middlewares/validators/videos.js index e51087d5a..76e943e77 100644 --- a/server/middlewares/validators/videos.js +++ b/server/middlewares/validators/videos.js @@ -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) { diff --git a/server/models/application.js b/server/models/application.js index 8185f0915..452ac4283 100644 --- a/server/models/application.js +++ b/server/models/application.js @@ -10,8 +10,8 @@ const ApplicationSchema = mongoose.Schema({ }) ApplicationSchema.statics = { - loadMongoSchemaVersion: loadMongoSchemaVersion, - updateMongoSchemaVersion: updateMongoSchemaVersion + loadMongoSchemaVersion, + updateMongoSchemaVersion } mongoose.model('Application', ApplicationSchema) diff --git a/server/models/oauth-client.js b/server/models/oauth-client.js index 45834c5a5..a1aefa985 100644 --- a/server/models/oauth-client.js +++ b/server/models/oauth-client.js @@ -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) diff --git a/server/models/oauth-token.js b/server/models/oauth-token.js index d53fdcf31..5beb47bed 100644 --- a/server/models/oauth-token.js +++ b/server/models/oauth-token.js @@ -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) diff --git a/server/models/pods.js b/server/models/pods.js index 59de2d60c..4020a9603 100644 --- a/server/models/pods.js +++ b/server/models/pods.js @@ -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) { diff --git a/server/models/user.js b/server/models/user.js index 91e8aeae1..a19de7072 100644 --- a/server/models/user.js +++ b/server/models/user.js @@ -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) { diff --git a/server/models/utils.js b/server/models/utils.js index a961e8c5b..e798aabe6 100644 --- a/server/models/utils.js +++ b/server/models/utils.js @@ -3,7 +3,7 @@ const parallel = require('async/parallel') const utils = { - listForApiWithCount: listForApiWithCount + listForApiWithCount } function listForApiWithCount (query, start, count, sort, callback) { diff --git a/server/models/video.js b/server/models/video.js index 0f60b6cd4..b9999c8f6 100644 --- a/server/models/video.js +++ b/server/models/video.js @@ -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) { diff --git a/server/tests/utils/login.js b/server/tests/utils/login.js index 1a5d75bc4..465564e14 100644 --- a/server/tests/utils/login.js +++ b/server/tests/utils/login.js @@ -3,8 +3,8 @@ const request = require('supertest') const loginUtils = { - login: login, - loginAndGetAccessToken: loginAndGetAccessToken + login, + loginAndGetAccessToken } // ---------------------- Export functions -------------------- diff --git a/server/tests/utils/miscs.js b/server/tests/utils/miscs.js index 5414cd561..4ceff65df 100644 --- a/server/tests/utils/miscs.js +++ b/server/tests/utils/miscs.js @@ -1,7 +1,7 @@ 'use strict' const miscsUtils = { - dateIsValid: dateIsValid + dateIsValid } // ---------------------- Export functions -------------------- diff --git a/server/tests/utils/pods.js b/server/tests/utils/pods.js index 9a9148856..a8551a49d 100644 --- a/server/tests/utils/pods.js +++ b/server/tests/utils/pods.js @@ -3,9 +3,9 @@ const request = require('supertest') const podsUtils = { - getFriendsList: getFriendsList, - makeFriends: makeFriends, - quitFriends: quitFriends + getFriendsList, + makeFriends, + quitFriends } // ---------------------- Export functions -------------------- diff --git a/server/tests/utils/requests.js b/server/tests/utils/requests.js index 410e42c77..b1470814d 100644 --- a/server/tests/utils/requests.js +++ b/server/tests/utils/requests.js @@ -3,9 +3,9 @@ const request = require('supertest') const requestsUtils = { - makePostUploadRequest: makePostUploadRequest, - makePostBodyRequest: makePostBodyRequest, - makePutBodyRequest: makePutBodyRequest + makePostUploadRequest, + makePostBodyRequest, + makePutBodyRequest } // ---------------------- Export functions -------------------- diff --git a/server/tests/utils/servers.js b/server/tests/utils/servers.js index ee7cd8c0a..d62838bc7 100644 --- a/server/tests/utils/servers.js +++ b/server/tests/utils/servers.js @@ -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 -------------------- diff --git a/server/tests/utils/users.js b/server/tests/utils/users.js index 0cf4e4adb..2bf9c6e3e 100644 --- a/server/tests/utils/users.js +++ b/server/tests/utils/users.js @@ -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 -------------------- diff --git a/server/tests/utils/videos.js b/server/tests/utils/videos.js index 90ee9621e..536093db1 100644 --- a/server/tests/utils/videos.js +++ b/server/tests/utils/videos.js @@ -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 --------------------