ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix tests
Chocobozzz77c2df95857b
diff --git a/src/videos.js b/src/videos.jsindex 605ce098f1..48ec19d4d5 100644--- a/src/videos.js+++ b/src/videos.js@@ -103,6 +103,7 @@VideosDB.findById(id, function (err, video) {if (err || !video) {+ if (!err) err = new Error('Cannot find this video.')logger.error('Cannot find this video.', { error: err })return callback(err)}diff --git a/src/webTorrentNode.js b/src/webTorrentNode.jsindex 03bff78038..ebe8d5d810 100644--- a/src/webTorrentNode.js+++ b/src/webTorrentNode.js@@ -8,16 +8,8 @@var logger = require('./logger')- var host- var port-- try {- host = config.get('webserver.host')- port = config.get('webserver.port')- } catch (e) {- host = 'client'- port = 1- }+ var host = config.get('webserver.host')+ var port = config.get('webserver.port')var nodeKey = 'webtorrentnode' + portvar processKey = 'webtorrent' + port@@ -33,7 +25,21 @@// Useful to kill itwebtorrentnode.app = null- webtorrentnode.create = function (callback) {+ webtorrentnode.create = function (options, callback) {+ if (typeof options === 'function') {+ callback = options+ options = {}+ }++ // Override options+ if (options.host) host = options.host+ if (options.port) {+ port = options.port+ nodeKey = 'webtorrentnode' + port+ processKey = 'webtorrent' + port+ ipc.config.id = nodeKey+ }+ipc.serve(function () {if (!webtorrentnode.silent) logger.info('IPC server ready.')diff --git a/test/api/multiplePods.js b/test/api/multiplePods.jsindex fff1790066..81d4b06b60 100644--- a/test/api/multiplePods.js+++ b/test/api/multiplePods.js@@ -61,7 +61,7 @@.end(function (err, res) {if (err) throw err- webtorrent.create(function () {+ webtorrent.create({ host: 'client', port: '1' }, function () {done()})})@@ -214,7 +214,7 @@describe('Should seed the uploaded video', function () {it('Should add the file 1 by asking pod 3', function (done) {// Yes, this could be long- this.timeout(60000)+ this.timeout(200000)getVideosList(urls[2], function (err, res) {if (err) throw err@@ -232,15 +232,13 @@it('Should add the file 2 by asking pod 1', function (done) {// Yes, this could be long- this.timeout(60000)+ this.timeout(200000)getVideosList(urls[0], function (err, res) {if (err) throw errvar video = res.body[1]- video_id = video._id-webtorrent.add(video.magnetUri, function (torrent) {expect(torrent.files).to.existexpect(torrent.files.length).to.equal(1)@@ -253,12 +251,13 @@it('Should add the file 3 by asking pod 2', function (done) {// Yes, this could be long- this.timeout(60000)+ this.timeout(200000)getVideosList(urls[1], function (err, res) {if (err) throw errvar video = res.body[2]+ video_id = res.body[1]._idwebtorrent.add(video.magnetUri, function (torrent) {expect(torrent.files).to.existdiff --git a/test/api/singlePod.js b/test/api/singlePod.jsindex 59a6179709..149c10b9e1 100644--- a/test/api/singlePod.js+++ b/test/api/singlePod.js@@ -23,7 +23,7 @@app = app1url = url1- webtorrent.create(function () {+ webtorrent.create({ host: 'client', port: '1' }, function () {done()})})