diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-04-16 14:25:37 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-04-16 14:25:37 +0200 |
commit | 0dd079da272df8d532f0086d7c91597b43e7a143 (patch) | |
tree | 93fb2a1a063f7e70ad233117efbc52812858ad05 /server/helpers/peertube-crypto.js | |
parent | 3758da9489b636997a3a4fad7fc1a6081737bbe0 (diff) | |
download | PeerTube-0dd079da272df8d532f0086d7c91597b43e7a143.tar.gz PeerTube-0dd079da272df8d532f0086d7c91597b43e7a143.tar.zst PeerTube-0dd079da272df8d532f0086d7c91597b43e7a143.zip |
Update standard -> 10
Diffstat (limited to 'server/helpers/peertube-crypto.js')
-rw-r--r-- | server/helpers/peertube-crypto.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/server/helpers/peertube-crypto.js b/server/helpers/peertube-crypto.js index ef6808d5c..55ae6fab3 100644 --- a/server/helpers/peertube-crypto.js +++ b/server/helpers/peertube-crypto.js | |||
@@ -74,7 +74,9 @@ function comparePassword (plainPassword, hashPassword, callback) { | |||
74 | } | 74 | } |
75 | 75 | ||
76 | function createCertsIfNotExist (callback) { | 76 | function createCertsIfNotExist (callback) { |
77 | certsExist(function (exist) { | 77 | certsExist(function (err, exist) { |
78 | if (err) return callback(err) | ||
79 | |||
78 | if (exist === true) { | 80 | if (exist === true) { |
79 | return callback(null) | 81 | return callback(null) |
80 | } | 82 | } |
@@ -113,13 +115,17 @@ module.exports = peertubeCrypto | |||
113 | 115 | ||
114 | function certsExist (callback) { | 116 | function certsExist (callback) { |
115 | const certPath = pathUtils.join(constants.CONFIG.STORAGE.CERT_DIR, constants.PRIVATE_CERT_NAME) | 117 | const certPath = pathUtils.join(constants.CONFIG.STORAGE.CERT_DIR, constants.PRIVATE_CERT_NAME) |
116 | fs.exists(certPath, function (exists) { | 118 | fs.access(certPath, function (err) { |
117 | return callback(exists) | 119 | // If there is an error the certificates do not exist |
120 | const exists = !err | ||
121 | return callback(null, exists) | ||
118 | }) | 122 | }) |
119 | } | 123 | } |
120 | 124 | ||
121 | function createCerts (callback) { | 125 | function createCerts (callback) { |
122 | certsExist(function (exist) { | 126 | certsExist(function (err, exist) { |
127 | if (err) return callback(err) | ||
128 | |||
123 | if (exist === true) { | 129 | if (exist === true) { |
124 | const string = 'Certs already exist.' | 130 | const string = 'Certs already exist.' |
125 | logger.warning(string) | 131 | logger.warning(string) |