aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/friends.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/friends.js')
-rw-r--r--server/lib/friends.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/server/lib/friends.js b/server/lib/friends.js
index 1e8037c37..2ea837c99 100644
--- a/server/lib/friends.js
+++ b/server/lib/friends.js
@@ -3,13 +3,13 @@
3const each = require('async/each') 3const each = require('async/each')
4const eachLimit = require('async/eachLimit') 4const eachLimit = require('async/eachLimit')
5const eachSeries = require('async/eachSeries') 5const eachSeries = require('async/eachSeries')
6const fs = require('fs')
7const request = require('request') 6const request = require('request')
8const waterfall = require('async/waterfall') 7const waterfall = require('async/waterfall')
9 8
10const constants = require('../initializers/constants') 9const constants = require('../initializers/constants')
11const db = require('../initializers/database') 10const db = require('../initializers/database')
12const logger = require('../helpers/logger') 11const logger = require('../helpers/logger')
12const peertubeCrypto = require('../helpers/peertube-crypto')
13const requests = require('../helpers/requests') 13const requests = require('../helpers/requests')
14 14
15const ENDPOINT_ACTIONS = constants.REQUEST_ENDPOINT_ACTIONS[constants.REQUEST_ENDPOINTS.VIDEOS] 15const ENDPOINT_ACTIONS = constants.REQUEST_ENDPOINT_ACTIONS[constants.REQUEST_ENDPOINTS.VIDEOS]
@@ -19,7 +19,6 @@ const friends = {
19 updateVideoToFriends, 19 updateVideoToFriends,
20 reportAbuseVideoToFriend, 20 reportAbuseVideoToFriend,
21 hasFriends, 21 hasFriends,
22 getMyCertificate,
23 makeFriends, 22 makeFriends,
24 quitFriends, 23 quitFriends,
25 removeVideoToFriends, 24 removeVideoToFriends,
@@ -74,15 +73,11 @@ function hasFriends (callback) {
74 }) 73 })
75} 74}
76 75
77function getMyCertificate (callback) {
78 fs.readFile(constants.CONFIG.STORAGE.CERT_DIR + 'peertube.pub', 'utf8', callback)
79}
80
81function makeFriends (hosts, callback) { 76function makeFriends (hosts, callback) {
82 const podsScore = {} 77 const podsScore = {}
83 78
84 logger.info('Make friends!') 79 logger.info('Make friends!')
85 getMyCertificate(function (err, cert) { 80 peertubeCrypto.getMyPublicCert(function (err, cert) {
86 if (err) { 81 if (err) {
87 logger.error('Cannot read public cert.') 82 logger.error('Cannot read public cert.')
88 return callback(err) 83 return callback(err)