Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seed: allow announce field with trackers disabled #928

Merged
merged 1 commit into from Sep 27, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -303,7 +303,6 @@ WebTorrent.prototype.seed = function (input, opts, onseed) {
// When seeding from fs path, initialize store from that path to avoid a copy
if (typeof input === 'string') opts.path = path.dirname(input)
if (!opts.createdBy) opts.createdBy = 'WebTorrent/' + VERSION_STR
if (!self.tracker) opts.announce = []

var torrent = self.add(null, opts, onTorrent)
var streams
@@ -14,7 +14,8 @@ test('client.seed: torrent file (Buffer)', function (t) {
client.on('warning', function (err) { t.fail(err) })

client.seed(fixtures.leaves.content, {
name: 'Leaves of Grass by Walt Whitman.epub'
name: 'Leaves of Grass by Walt Whitman.epub',
announce: []
}, function (torrent) {
t.equal(client.torrents.length, 1)
t.equal(torrent.infoHash, fixtures.leaves.parsedTorrent.infoHash)
@@ -38,7 +39,7 @@ test('client.seed: torrent file (Buffer), set name on buffer', function (t) {
var buf = Buffer.from(fixtures.leaves.content)
buf.name = 'Leaves of Grass by Walt Whitman.epub'

client.seed(buf, function (torrent) {
client.seed(buf, {announce: []}, function (torrent) {
t.equal(client.torrents.length, 1)
t.equal(torrent.infoHash, fixtures.leaves.parsedTorrent.infoHash)
t.equal(torrent.magnetURI, fixtures.leaves.magnetURI)
@@ -61,7 +62,8 @@ test('client.seed: torrent file (Blob)', function (t) {
client.on('warning', function (err) { t.fail(err) })

client.seed(new Blob([ fixtures.leaves.content ]), {
name: 'Leaves of Grass by Walt Whitman.epub'
name: 'Leaves of Grass by Walt Whitman.epub',
announce: []
}, function (torrent) {
t.equal(client.torrents.length, 1)
t.equal(torrent.infoHash, fixtures.leaves.parsedTorrent.infoHash)
@@ -77,7 +77,8 @@ test('client.seed: filesystem path to file, string', function (t) {
client.on('warning', function (err) { t.fail(err) })

client.seed(fixtures.leaves.contentPath, {
name: 'Leaves of Grass by Walt Whitman.epub'
name: 'Leaves of Grass by Walt Whitman.epub',
announce: []
}, function (torrent) {
t.equal(client.torrents.length, 1)
t.equal(torrent.infoHash, fixtures.leaves.parsedTorrent.infoHash)
@@ -98,7 +99,7 @@ test('client.seed: filesystem path to folder with one file, string', function (t
client.on('error', function (err) { t.fail(err) })
client.on('warning', function (err) { t.fail(err) })

client.seed(fixtures.folder.contentPath, function (torrent) {
client.seed(fixtures.folder.contentPath, {announce: false}, function (torrent) {

This comment has been minimized.

Copy link
@feross

feross Sep 27, 2016

Member

Why are you using false and [] inconsistently?

t.equal(client.torrents.length, 1)
t.equal(torrent.infoHash, fixtures.folder.parsedTorrent.infoHash)
t.equal(torrent.magnetURI, fixtures.folder.magnetURI)
@@ -118,7 +119,7 @@ test('client.seed: filesystem path to folder with multiple files, string', funct
client.on('error', function (err) { t.fail(err) })
client.on('warning', function (err) { t.fail(err) })

client.seed(fixtures.numbers.contentPath, function (torrent) {
client.seed(fixtures.numbers.contentPath, {announce: false}, function (torrent) {
t.equal(client.torrents.length, 1)
t.equal(torrent.infoHash, fixtures.numbers.parsedTorrent.infoHash)
t.equal(torrent.magnetURI, fixtures.numbers.magnetURI)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.