Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-07-17 07:47:15 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-07-17 07:47:15 +0300
commitacbe34563f73d89442ab4ad111246fd28de593bb (patch)
tree7fba10632807a7d9d5eeb4aceba0ac00876de469
parent2012084d1389b5ea03ae53a966f04c322312d045 (diff)
cmd: fix seeding UI
-rwxr-xr-xbin/cmd.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/bin/cmd.js b/bin/cmd.js
index ca25f1b..5d2d34d 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -222,10 +222,7 @@ function runCreate (input) {
})
}
-var client
-var href
-var playerName
-var serving
+var client, href, playerName, server, serving
function runDownload (torrentId) {
client = new WebTorrent({
@@ -280,13 +277,15 @@ function runDownload (torrentId) {
})
// Start http server
- var server = torrent.createServer()
+ server = torrent.createServer()
server.listen(argv.port, function () {
if (torrent.ready) onReady()
else torrent.once('ready', onReady)
- }).once('connection', function () {
+ })
+ server.once('connection', function () {
serving = true
})
+
function onReady () {
// if no index specified, use largest file
var index = (typeof argv.index === 'number')
@@ -471,8 +470,10 @@ function drawTorrent (torrent) {
linesRemaining -= 1
}
- clivas.line('{green:server running at} {bold:' + href + '}')
- linesRemaining -= 1
+ if (server) {
+ clivas.line('{green:server running at} {bold:' + href + '}')
+ linesRemaining -= 1
+ }
if (argv.out) {
clivas.line('{green:downloading to} {bold:' + argv.out + '}')
@@ -481,7 +482,7 @@ function drawTorrent (torrent) {
var seeding = torrent.storage.done
- clivas.line('')
+ if (!seeding) clivas.line('')
clivas.line(
'{green:' + (seeding ? 'seeding' : 'downloading') + ':} ' +
'{bold:' + torrent.name + '}'