Open .torrent files support

This commit is contained in:
Diego Rodríguez 2015-12-07 11:53:57 -05:00
parent 9d9ef890b5
commit 631afc5008
5 changed files with 9 additions and 25 deletions

View file

@ -6,7 +6,7 @@
### Features ### Features
- [x] Informative GUI with easy sharing options - [x] Informative GUI with easy sharing options
- [x] Downloading from an info hash or magnet URI - [x] Downloading from an info hash or magnet URI
- [ ] Downloading from a .torrent file (Coming Soon) - [x] Downloading from a .torrent file (Coming Soon)
- [x] Seeding files (Single file only for the moment) - [x] Seeding files (Single file only for the moment)
- [ ] Seeding CORS-enabled remote files (Coming Soon) - [ ] Seeding CORS-enabled remote files (Coming Soon)
- [x] Download/Upload speed per torrent - [x] Download/Upload speed per torrent

View file

@ -83,13 +83,7 @@ app.controller 'bTorrentCtrl', ['$scope','$http','$log','$location', 'uiGridCons
if file? if file?
dbg 'Adding ' + file.name dbg 'Adding ' + file.name
$scope.client.processing = true $scope.client.processing = true
url = URL.createObjectURL file $scope.client.add file, opts, $scope.onTorrent
$http.get(url).then((response) ->
dbg 'Success' + response.data
, (response) ->
dbg 'ERROR'
)
$scope.client.add url, opts, $scope.onTorrent
$scope.addMagnet = -> $scope.addMagnet = ->
if $scope.torrentInput != '' if $scope.torrentInput != ''

View file

@ -122,17 +122,10 @@
} }
}; };
$scope.openTorrentFile = function(file) { $scope.openTorrentFile = function(file) {
var url;
if (file != null) { if (file != null) {
dbg('Adding ' + file.name); dbg('Adding ' + file.name);
$scope.client.processing = true; $scope.client.processing = true;
url = URL.createObjectURL(file); return $scope.client.add(file, opts, $scope.onTorrent);
$http.get(url).then(function(response) {
return dbg('Success' + response.data);
}, function(response) {
return dbg('ERROR');
});
return $scope.client.add(url, opts, $scope.onTorrent);
} }
}; };
$scope.addMagnet = function() { $scope.addMagnet = function() {

View file

@ -8,7 +8,7 @@
<meta name="keywords" content="βTorrent, btorrent, client, webtorrent, browser, torrent, stream, bittorrent"> <meta name="keywords" content="βTorrent, btorrent, client, webtorrent, browser, torrent, stream, bittorrent">
<meta name="author" content="Diego Rodríguez Baquero - DiegoRBaquero"> <meta name="author" content="Diego Rodríguez Baquero - DiegoRBaquero">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.jsdelivr.net/g/webtorrent@0.63.2,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0"></script> <script src="https://cdn.jsdelivr.net/g/webtorrent@0.63.3,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/danialfarid-angular-file-upload/10.1.8/ng-file-upload.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/danialfarid-angular-file-upload/10.1.8/ng-file-upload.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/g/normalize@3.0,skeleton@2.0"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/g/normalize@3.0,skeleton@2.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/fontawesome/4.5/css/font-awesome.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/fontawesome/4.5/css/font-awesome.min.css">
@ -17,7 +17,7 @@
</head> </head>
<body ng-controller="bTorrentCtrl" ng-cloak=""> <body ng-controller="bTorrentCtrl" ng-cloak="">
<header> <header>
<h1>βTorrent<span class="version"> v0.6.2</span></h1> <h1>βTorrent<span class="version"> v0.6.3</span></h1>
</header> </header>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
@ -28,10 +28,7 @@
<button ng-click="addMagnet()" class="button-primary"><i class="fa fa-download"></i> Download</button> <button ng-click="addMagnet()" class="button-primary"><i class="fa fa-download"></i> Download</button>
</div> </div>
<div class="three columns"> <div class="three columns">
<!--button.button-primary(type='file', ngf-select='openTorrentFile($file)') <button type="file" ngf-select="openTorrentFile($file)" class="button-primary"><i class="fa fa-folder-open"></i> Open torrent file</button>
i.fa.fa-folder-open
| Open torrent file
-->
</div> </div>
<div class="three columns u-pull-right"> <div class="three columns u-pull-right">
<button type="file" ngf-select="seedFile($file)" class="u-pull-right button-primary"><i class="fa fa-upload"></i> Seed a file</button> <button type="file" ngf-select="seedFile($file)" class="u-pull-right button-primary"><i class="fa fa-upload"></i> Seed a file</button>

View file

@ -8,7 +8,7 @@ html(ng-app='bTorrent', lang='en')
meta(name='keywords', content='βTorrent, btorrent, client, webtorrent, browser, torrent, stream, bittorrent') meta(name='keywords', content='βTorrent, btorrent, client, webtorrent, browser, torrent, stream, bittorrent')
meta(name='author', content='Diego Rodríguez Baquero - DiegoRBaquero') meta(name='author', content='Diego Rodríguez Baquero - DiegoRBaquero')
meta(name='viewport', content='width=device-width, initial-scale=1') meta(name='viewport', content='width=device-width, initial-scale=1')
script(src='https://cdn.jsdelivr.net/g/webtorrent@0.63.2,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0') script(src='https://cdn.jsdelivr.net/g/webtorrent@0.63.3,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0')
script(src='https://cdnjs.cloudflare.com/ajax/libs/danialfarid-angular-file-upload/10.1.8/ng-file-upload.min.js') script(src='https://cdnjs.cloudflare.com/ajax/libs/danialfarid-angular-file-upload/10.1.8/ng-file-upload.min.js')
link(rel='stylesheet', href='https://cdn.jsdelivr.net/g/normalize@3.0,skeleton@2.0') link(rel='stylesheet', href='https://cdn.jsdelivr.net/g/normalize@3.0,skeleton@2.0')
link(rel='stylesheet', href='https://cdn.jsdelivr.net/fontawesome/4.5/css/font-awesome.min.css') link(rel='stylesheet', href='https://cdn.jsdelivr.net/fontawesome/4.5/css/font-awesome.min.css')
@ -18,7 +18,7 @@ html(ng-app='bTorrent', lang='en')
header header
h1 h1
| βTorrent | βTorrent
span.version v0.6.2 span.version v0.6.3
.container .container
.row .row
@ -29,7 +29,7 @@ html(ng-app='bTorrent', lang='en')
i.fa.fa-download i.fa.fa-download
| Download | Download
.three.columns .three.columns
//button.button-primary(type='file', ngf-select='openTorrentFile($file)') button.button-primary(type='file', ngf-select='openTorrentFile($file)')
i.fa.fa-folder-open i.fa.fa-folder-open
| Open torrent file | Open torrent file
.three.columns.u-pull-right .three.columns.u-pull-right