aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2015-10-30 18:34:37 +0100
committerChocobozzz <florian.bigard@gmail.com>2015-10-30 18:34:37 +0100
commit77c2df95857b9fbc0a5935c51ffef073ffc277b7 (patch)
treeb18cc8e1cb2c39915d6b4335f3d2b406d7b72892 /src
parente63dc45fa368de478ba3b37eabbfb1c233988348 (diff)
downloadPeerTube-77c2df95857b9fbc0a5935c51ffef073ffc277b7.tar.gz
PeerTube-77c2df95857b9fbc0a5935c51ffef073ffc277b7.tar.zst
PeerTube-77c2df95857b9fbc0a5935c51ffef073ffc277b7.zip
Fix tests
Diffstat (limited to 'src')
-rw-r--r--src/videos.js1
-rw-r--r--src/webTorrentNode.js28
2 files changed, 18 insertions, 11 deletions
diff --git a/src/videos.js b/src/videos.js
index 605ce098f..48ec19d4d 100644
--- a/src/videos.js
+++ b/src/videos.js
@@ -103,6 +103,7 @@
103 103
104 VideosDB.findById(id, function (err, video) { 104 VideosDB.findById(id, function (err, video) {
105 if (err || !video) { 105 if (err || !video) {
106 if (!err) err = new Error('Cannot find this video.')
106 logger.error('Cannot find this video.', { error: err }) 107 logger.error('Cannot find this video.', { error: err })
107 return callback(err) 108 return callback(err)
108 } 109 }
diff --git a/src/webTorrentNode.js b/src/webTorrentNode.js
index 03bff7803..ebe8d5d81 100644
--- a/src/webTorrentNode.js
+++ b/src/webTorrentNode.js
@@ -8,16 +8,8 @@
8 8
9 var logger = require('./logger') 9 var logger = require('./logger')
10 10
11 var host 11 var host = config.get('webserver.host')
12 var port 12 var port = config.get('webserver.port')
13
14 try {
15 host = config.get('webserver.host')
16 port = config.get('webserver.port')
17 } catch (e) {
18 host = 'client'
19 port = 1
20 }
21 13
22 var nodeKey = 'webtorrentnode' + port 14 var nodeKey = 'webtorrentnode' + port
23 var processKey = 'webtorrent' + port 15 var processKey = 'webtorrent' + port
@@ -33,7 +25,21 @@
33 // Useful to kill it 25 // Useful to kill it
34 webtorrentnode.app = null 26 webtorrentnode.app = null
35 27
36 webtorrentnode.create = function (callback) { 28 webtorrentnode.create = function (options, callback) {
29 if (typeof options === 'function') {
30 callback = options
31 options = {}
32 }
33
34 // Override options
35 if (options.host) host = options.host
36 if (options.port) {
37 port = options.port
38 nodeKey = 'webtorrentnode' + port
39 processKey = 'webtorrent' + port
40 ipc.config.id = nodeKey
41 }
42
37 ipc.serve(function () { 43 ipc.serve(function () {
38 if (!webtorrentnode.silent) logger.info('IPC server ready.') 44 if (!webtorrentnode.silent) logger.info('IPC server ready.')
39 45