v0.9.0 & compiled
This commit is contained in:
parent
e07685a273
commit
7b4402b2d7
4 changed files with 75 additions and 17 deletions
|
@ -46,11 +46,11 @@
|
||||||
rtcConfig: rtcConfig
|
rtcConfig: rtcConfig
|
||||||
});
|
});
|
||||||
|
|
||||||
dbg = function(string, torrent, color) {
|
dbg = function(string, item, color) {
|
||||||
color = color != null ? color : '#333333';
|
color = color != null ? color : '#333333';
|
||||||
if (window.localStorage.getItem('debug') != null) {
|
if (window.localStorage.getItem('debug') != null) {
|
||||||
if ((torrent != null) && torrent.name) {
|
if ((item != null) && item.name) {
|
||||||
console.debug('%cβTorrent:torrent:' + torrent.name + ' (' + torrent.infoHash + ') %c' + string, 'color: #33C3F0', 'color: ' + color);
|
console.debug('%cβTorrent:' + (item.infoHash != null ? 'torrent ' : 'torrent ' + item._torrent.name + ':file ') + item.name + (item.infoHash != null ? ' (' + item.infoHash + ')' : '') + ' %c' + string, 'color: #33C3F0', 'color: ' + color);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
console.debug('%cβTorrent:client %c' + string, 'color: #33C3F0', 'color: ' + color);
|
console.debug('%cβTorrent:client %c' + string, 'color: #33C3F0', 'color: ' + color);
|
||||||
|
@ -131,7 +131,7 @@
|
||||||
];
|
];
|
||||||
$scope.gridOptions = {
|
$scope.gridOptions = {
|
||||||
columnDefs: $scope.columns,
|
columnDefs: $scope.columns,
|
||||||
data: $scope.client.validTorrents,
|
data: $scope.client.torrents,
|
||||||
enableColumnResizing: true,
|
enableColumnResizing: true,
|
||||||
enableColumnMenus: false,
|
enableColumnMenus: false,
|
||||||
enableRowSelection: true,
|
enableRowSelection: true,
|
||||||
|
@ -155,11 +155,19 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.seedFile = function(file) {
|
$scope.seedFiles = function(files) {
|
||||||
if (file != null) {
|
var name;
|
||||||
dbg('Seeding file ' + file.name);
|
if (files != null) {
|
||||||
|
if (files.length === 1) {
|
||||||
|
dbg('Seeding file ' + files[0].name);
|
||||||
|
} else {
|
||||||
|
dbg('Seeding ' + files.length + ' files');
|
||||||
|
name = prompt('Please name your torrent', 'My Awesome Torrent') || 'My Awesome Torrent';
|
||||||
|
opts.name = name;
|
||||||
|
}
|
||||||
$scope.client.processing = true;
|
$scope.client.processing = true;
|
||||||
$scope.client.seed(file, opts, $scope.onSeed);
|
$scope.client.seed(files, opts, $scope.onSeed);
|
||||||
|
delete opts.name;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$scope.openTorrentFile = function(file) {
|
$scope.openTorrentFile = function(file) {
|
||||||
|
@ -183,11 +191,21 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$scope.destroyedTorrent = function(err) {
|
$scope.destroyedTorrent = function(err) {
|
||||||
$scope.client.processing = false;
|
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
dbg('Destroyed torrent');
|
dbg('Destroyed torrent', $scope.selectedTorrent);
|
||||||
|
$scope.selectedTorrent = null;
|
||||||
|
$scope.client.processing = false;
|
||||||
|
};
|
||||||
|
$scope.changePriority = function(file) {
|
||||||
|
if (file.priority === '-1') {
|
||||||
|
dbg('Deselected', file);
|
||||||
|
return file.deselect();
|
||||||
|
} else {
|
||||||
|
dbg('Selected ', file);
|
||||||
|
return file.select();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
$scope.onTorrent = function(torrent, isSeed) {
|
$scope.onTorrent = function(torrent, isSeed) {
|
||||||
torrent.safeTorrentFileURL = torrent.torrentFileURL;
|
torrent.safeTorrentFileURL = torrent.torrentFileURL;
|
||||||
|
@ -206,7 +224,9 @@
|
||||||
}
|
}
|
||||||
if (isSeed) {
|
if (isSeed) {
|
||||||
dbg('Started seeding', torrent);
|
dbg('Started seeding', torrent);
|
||||||
|
if ($scope.client.validTorrents.indexOf(torrent) === -1) {
|
||||||
$scope.client.validTorrents.push(torrent);
|
$scope.client.validTorrents.push(torrent);
|
||||||
|
}
|
||||||
if (!($scope.selectedTorrent != null)) {
|
if (!($scope.selectedTorrent != null)) {
|
||||||
$scope.selectedTorrent = torrent;
|
$scope.selectedTorrent = torrent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0,angular.ng-notify@0.7,angular.file-upload@10.1"></script>
|
<script src="https://cdn.jsdelivr.net/g/webtorrent@0.67.1,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0,angular.ng-notify@0.7,angular.file-upload@10.1"></script>
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/g/normalize@3.0,skeleton@2.0,angular.ng-notify@0.7(ng-notify.min.css)">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/g/normalize@3.0,skeleton@2.0,angular.ng-notify@0.7(ng-notify.min.css)">
|
||||||
<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">
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/angular.ui-grid/3.0.7/ui-grid.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/angular.ui-grid/3.0.7/ui-grid.min.css">
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body ng-controller="bTorrentCtrl" ng-cloak="">
|
<body ng-controller="bTorrentCtrl" ng-cloak="">
|
||||||
<header>
|
<header>
|
||||||
<h1>βTorrent<span class="version"> v0.8.1</span></h1>
|
<h1>βTorrent<span class="version"> v0.9.0</span></h1>
|
||||||
</header>
|
</header>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -30,13 +30,17 @@
|
||||||
<button type="file" ngf-select="openTorrentFile($file)" class="button-primary"><i class="fa fa-folder-open"></i> Open torrent file</button>
|
<button type="file" ngf-select="openTorrentFile($file)" class="button-primary"><i class="fa fa-folder-open"></i> Open torrent file</button>
|
||||||
</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 ngf-select="seedFiles($files)" multiple="" class="u-pull-right button-primary"><i class="fa fa-upload"></i> Seed files</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div ui-grid="gridOptions" ui-grid-resize-columns ui-grid-selection class="row grid"></div>
|
<div ui-grid="gridOptions" ui-grid-resize-columns ui-grid-selection class="row grid"></div>
|
||||||
<div ng-if="selectedTorrent" class="row">
|
<div ng-if="selectedTorrent" class="row">
|
||||||
<div style="overflow: auto" class="six columns">
|
<div style="overflow: auto" class="six columns">
|
||||||
<h5>{{selectedTorrent.name}}</h5>
|
<h5>{{selectedTorrent.name}}
|
||||||
|
<button ng-if="!selectedTorrent.swarm.paused" ng-click="selectedTorrent.pause()"><i class="fa fa-pause"></i> Pause</button>
|
||||||
|
<button ng-if="selectedTorrent.swarm.paused" ng-click="selectedTorrent.resume()"><i class="fa fa-play"></i> Resume</button>
|
||||||
|
<button ng-click="client.remove(selectedTorrent.infoHash, destroyedTorrent)" class="button-danger"><i class="fa fa-times"></i> Remove</button>
|
||||||
|
</h5>
|
||||||
<h6>Share</h6>
|
<h6>Share</h6>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a ng-href="#{{selectedTorrent.infoHash}}" target="_blank">βTorrent</a></li>
|
<li><a ng-href="#{{selectedTorrent.infoHash}}" target="_blank">βTorrent</a></li>
|
||||||
|
@ -52,13 +56,21 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Size</th>
|
<th>Size</th>
|
||||||
|
<th>Priority</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="file in selectedTorrent.files" class="files">
|
<tr ng-repeat="file in selectedTorrent.files" class="files">
|
||||||
<td ng-hide="file.done">{{file.name}}</td>
|
<td ng-hide="file.done">{{file.name}}</td>
|
||||||
<td ng-show="file.done"><a ng-href="{{file.url}}" download="{{file.name}}" target="_self" ng-show="file.done">{{file.name}}</a></td>
|
<td ng-show="file.done"><a ng-href="{{file.url}}" download="{{file.name}}" target="_self" ng-show="file.done">{{file.name}}</a></td>
|
||||||
<td> {{file.length | pbytes}}</td>
|
<td>{{file.length | pbytes}}</td>
|
||||||
|
<td>
|
||||||
|
<select name="{{file.name}}Priority" ng-model="file.priority" ng-init="file.priority = "0"" ng-change="changePriority(file)" class="no-margin">
|
||||||
|
<option value="1">High Priority</option>
|
||||||
|
<option value="0" selected="">Low Priority</option>
|
||||||
|
<option value="-1">Don't download</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -33,6 +33,9 @@ footer {
|
||||||
.download-button {
|
.download-button {
|
||||||
margin-left: 10px; }
|
margin-left: 10px; }
|
||||||
|
|
||||||
|
.no-margin {
|
||||||
|
margin: 0px; }
|
||||||
|
|
||||||
.spinner {
|
.spinner {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 30%;
|
top: 30%;
|
||||||
|
@ -51,3 +54,26 @@ footer {
|
||||||
margin-top: -100px;
|
margin-top: -100px;
|
||||||
font-size: 200px;
|
font-size: 200px;
|
||||||
transform: translateY(-50%); }
|
transform: translateY(-50%); }
|
||||||
|
|
||||||
|
.button.button-danger,
|
||||||
|
button.button-danger,
|
||||||
|
input[type="submit"].button-danger,
|
||||||
|
input[type="reset"].button-danger,
|
||||||
|
input[type="button"].button-danger {
|
||||||
|
color: #FFF;
|
||||||
|
background-color: #D9534F;
|
||||||
|
border-color: #D9534F; }
|
||||||
|
|
||||||
|
.button.button-danger:hover,
|
||||||
|
button.button-danger:hover,
|
||||||
|
input[type="submit"].button-danger:hover,
|
||||||
|
input[type="reset"].button-danger:hover,
|
||||||
|
input[type="button"].button-danger:hover,
|
||||||
|
.button.button-danger:focus,
|
||||||
|
button.button-danger:focus,
|
||||||
|
input[type="submit"].button-danger:focus,
|
||||||
|
input[type="reset"].button-danger:focus,
|
||||||
|
input[type="button"].button-danger:focus {
|
||||||
|
color: #FFF;
|
||||||
|
background-color: #C43E3A;
|
||||||
|
border-color: #C43E3A; }
|
||||||
|
|
|
@ -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.66,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0,angular.ng-notify@0.7,angular.file-upload@10.1')
|
script(src='https://cdn.jsdelivr.net/g/webtorrent@0.67.1,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0,angular.ng-notify@0.7,angular.file-upload@10.1')
|
||||||
link(rel='stylesheet', href='https://cdn.jsdelivr.net/g/normalize@3.0,skeleton@2.0,angular.ng-notify@0.7(ng-notify.min.css)')
|
link(rel='stylesheet', href='https://cdn.jsdelivr.net/g/normalize@3.0,skeleton@2.0,angular.ng-notify@0.7(ng-notify.min.css)')
|
||||||
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')
|
||||||
link(rel='stylesheet', href='https://cdn.jsdelivr.net/angular.ui-grid/3.0.7/ui-grid.min.css')
|
link(rel='stylesheet', href='https://cdn.jsdelivr.net/angular.ui-grid/3.0.7/ui-grid.min.css')
|
||||||
|
|
Loading…
Reference in a new issue