Added trackers back, stun server

This commit is contained in:
Diego Rodríguez 2016-03-25 21:28:17 -03:00
parent 25272d8bbe
commit 5ba824c057

View file

@ -1,5 +1,25 @@
VERSION = "0.15" VERSION = "0.15"
BUILD = "1" BUILD = "2"
trackers = [
'wss://tracker.btorrent.xyz'
'wss://tracker.webtorrent.io'
'wss://tracker.openwebtorrent.com'
'wss://tracker.fastcast.nz'
]
opts = {
announce: trackers
}
rtcConfig = {
"iceServers": [
{
"url": "stun:23.21.150.121"
"urls": "stun:23.21.150.121"
}
]
}
debug = window.localStorage.getItem('debug')? debug = window.localStorage.getItem('debug')?
@ -16,7 +36,7 @@ er = (err, item) ->
dbg "Starting... v#{VERSION}b#{BUILD}" dbg "Starting... v#{VERSION}b#{BUILD}"
client = new WebTorrent() client = new WebTorrent rtcConfig: rtcConfig
scope = null scope = null
app = angular.module 'BTorrent', ['ngRoute', 'ui.grid', 'ui.grid.resizeColumns', 'ui.grid.selection', 'ngFileUpload', 'ngNotify'], ['$compileProvider','$locationProvider', '$routeProvider', ($compileProvider, $locationProvider, $routeProvider) -> app = angular.module 'BTorrent', ['ngRoute', 'ui.grid', 'ui.grid.resizeColumns', 'ui.grid.selection', 'ngFileUpload', 'ngNotify'], ['$compileProvider','$locationProvider', '$routeProvider', ($compileProvider, $locationProvider, $routeProvider) ->
@ -60,7 +80,6 @@ app.controller 'BTorrentCtrl', ['$scope','$rootScope','$http','$log','$location'
$rootScope.seedFiles = (files) -> $rootScope.seedFiles = (files) ->
if files? && files.length > 0 if files? && files.length > 0
opts = {}
if files.length == 1 if files.length == 1
dbg 'Seeding file ' + files[0].name dbg 'Seeding file ' + files[0].name
else else
@ -69,12 +88,13 @@ app.controller 'BTorrentCtrl', ['$scope','$rootScope','$http','$log','$location'
opts.name = name opts.name = name
$rootScope.client.processing = true $rootScope.client.processing = true
$rootScope.client.seed files, opts, $rootScope.onSeed $rootScope.client.seed files, opts, $rootScope.onSeed
delete opts.name
$rootScope.openTorrentFile = (file) -> $rootScope.openTorrentFile = (file) ->
if file? if file?
dbg 'Adding torrent file ' + file.name dbg 'Adding torrent file ' + file.name
$rootScope.client.processing = true $rootScope.client.processing = true
$rootScope.client.add file, $rootScope.onTorrent $rootScope.client.add file, opts, $rootScope.onTorrent
$rootScope.client.on 'error', (err, torrent) -> $rootScope.client.on 'error', (err, torrent) ->
$rootScope.client.processing = false $rootScope.client.processing = false
@ -85,7 +105,7 @@ app.controller 'BTorrentCtrl', ['$scope','$rootScope','$http','$log','$location'
if magnet? && magnet.length > 0 if magnet? && magnet.length > 0
dbg 'Adding magnet/hash ' + magnet dbg 'Adding magnet/hash ' + magnet
$rootScope.client.processing = true $rootScope.client.processing = true
$rootScope.client.add magnet, onTorrent || $rootScope.onTorrent $rootScope.client.add magnet, opts, onTorrent || $rootScope.onTorrent
$rootScope.destroyedTorrent = (err) -> $rootScope.destroyedTorrent = (err) ->
if err if err
@ -151,7 +171,7 @@ app.controller 'FullCtrl', ['$scope','$rootScope','$http','$log','$location', 'n
html: true html: true
$scope.addMagnet = -> $scope.addMagnet = ->
$rootScope.addMagnet($scope.torrentInput) $rootScope.addMagnet $scope.torrentInput
$scope.torrentInput = '' $scope.torrentInput = ''
$scope.columns = [ $scope.columns = [
@ -188,7 +208,7 @@ app.controller 'FullCtrl', ['$scope','$rootScope','$http','$log','$location', 'n
$rootScope.client.processing = true $rootScope.client.processing = true
setTimeout -> setTimeout ->
dbg 'Adding ' + $location.hash() dbg 'Adding ' + $location.hash()
$rootScope.client.add $location.hash(), $rootScope.onTorrent $rootScope.addMagnet $location.hash()
, 0 , 0
] ]
@ -205,7 +225,7 @@ app.controller 'DownloadCtrl', ['$scope','$rootScope','$http','$log','$location'
$rootScope.client.processing = true $rootScope.client.processing = true
setTimeout -> setTimeout ->
dbg 'Adding ' + $location.hash() dbg 'Adding ' + $location.hash()
$rootScope.client.add $location.hash(), $rootScope.onTorrent $rootScope.addMagnet $location.hash()
, 0 , 0
] ]
@ -249,7 +269,7 @@ app.controller 'ViewCtrl', ['$scope','$rootScope','$http','$log','$location', 'n
$rootScope.client.processing = true $rootScope.client.processing = true
setTimeout -> setTimeout ->
dbg 'Adding ' + $location.hash() dbg 'Adding ' + $location.hash()
$rootScope.client.add $location.hash(), onTorrent $rootScope.addMagnet $location.hash(), onTorrent
, 0 , 0
] ]