v0.9.2 - Fixed data binding, compiled
This commit is contained in:
parent
9f9ba0b386
commit
9c09ad40e1
4 changed files with 18 additions and 33 deletions
|
@ -1,6 +1,6 @@
|
||||||
// Generated by CoffeeScript 1.10.0
|
// Generated by CoffeeScript 1.10.0
|
||||||
(function() {
|
(function() {
|
||||||
var app, client, dbg, er, opts, rtcConfig, trackers;
|
var app, client, dbg, debug, er, opts, rtcConfig, trackers;
|
||||||
|
|
||||||
trackers = [['wss://tracker.btorrent.xyz'], ['wss://tracker.webtorrent.io']];
|
trackers = [['wss://tracker.btorrent.xyz'], ['wss://tracker.webtorrent.io']];
|
||||||
|
|
||||||
|
@ -16,18 +16,6 @@
|
||||||
}, {
|
}, {
|
||||||
"url": "stun:stun.l.google.com:19302",
|
"url": "stun:stun.l.google.com:19302",
|
||||||
"urls": "stun:stun.l.google.com:19302"
|
"urls": "stun:stun.l.google.com:19302"
|
||||||
}, {
|
|
||||||
"url": "stun:stun1.l.google.com:19302",
|
|
||||||
"urls": "stun:stun1.l.google.com:19302"
|
|
||||||
}, {
|
|
||||||
"url": "stun:stun2.l.google.com:19302",
|
|
||||||
"urls": "stun:stun2.l.google.com:19302"
|
|
||||||
}, {
|
|
||||||
"url": "stun:stun3.l.google.com:19302",
|
|
||||||
"urls": "stun:stun3.l.google.com:19302"
|
|
||||||
}, {
|
|
||||||
"url": "stun:stun4.l.google.com:19302",
|
|
||||||
"urls": "stun:stun4.l.google.com:19302"
|
|
||||||
}, {
|
}, {
|
||||||
"url": "turn:global.turn.twilio.com:3478?transport=udp",
|
"url": "turn:global.turn.twilio.com:3478?transport=udp",
|
||||||
"urls": "turn:global.turn.twilio.com:3478?transport=udp",
|
"urls": "turn:global.turn.twilio.com:3478?transport=udp",
|
||||||
|
@ -42,13 +30,11 @@
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
client = new WebTorrent({
|
debug = window.localStorage.getItem('debug') != null;
|
||||||
rtcConfig: rtcConfig
|
|
||||||
});
|
|
||||||
|
|
||||||
dbg = function(string, item, color) {
|
dbg = function(string, item, color) {
|
||||||
color = color != null ? color : '#333333';
|
color = color != null ? color : '#333333';
|
||||||
if (window.localStorage.getItem('debug') != null) {
|
if (debug) {
|
||||||
if ((item != null) && item.name) {
|
if ((item != null) && item.name) {
|
||||||
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);
|
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;
|
||||||
|
@ -63,6 +49,10 @@
|
||||||
return dbg(err, torrent, '#FF0000');
|
return dbg(err, torrent, '#FF0000');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
client = new WebTorrent({
|
||||||
|
rtcConfig: rtcConfig
|
||||||
|
});
|
||||||
|
|
||||||
app = angular.module('bTorrent', ['ui.grid', 'ui.grid.resizeColumns', 'ui.grid.selection', 'ngFileUpload', 'ngNotify'], [
|
app = angular.module('bTorrent', ['ui.grid', 'ui.grid.resizeColumns', 'ui.grid.selection', 'ngFileUpload', 'ngNotify'], [
|
||||||
'$compileProvider', '$locationProvider', function($compileProvider, $locationProvider) {
|
'$compileProvider', '$locationProvider', function($compileProvider, $locationProvider) {
|
||||||
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|magnet|blob|javascript):/);
|
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|magnet|blob|javascript):/);
|
||||||
|
@ -78,7 +68,6 @@
|
||||||
var updateAll;
|
var updateAll;
|
||||||
$scope.client = client;
|
$scope.client = client;
|
||||||
$scope.seedIt = true;
|
$scope.seedIt = true;
|
||||||
$scope.client.validTorrents = [];
|
|
||||||
$scope.columns = [
|
$scope.columns = [
|
||||||
{
|
{
|
||||||
field: 'name',
|
field: 'name',
|
||||||
|
@ -108,7 +97,7 @@
|
||||||
field: 'timeRemaining',
|
field: 'timeRemaining',
|
||||||
displayName: 'ETA',
|
displayName: 'ETA',
|
||||||
cellFilter: 'humanTime',
|
cellFilter: 'humanTime',
|
||||||
width: '150'
|
width: '140'
|
||||||
}, {
|
}, {
|
||||||
field: 'uploaded',
|
field: 'uploaded',
|
||||||
displayName: 'Uploaded',
|
displayName: 'Uploaded',
|
||||||
|
@ -211,7 +200,6 @@
|
||||||
torrent.safeTorrentFileURL = torrent.torrentFileURL;
|
torrent.safeTorrentFileURL = torrent.torrentFileURL;
|
||||||
torrent.fileName = torrent.name + '.torrent';
|
torrent.fileName = torrent.name + '.torrent';
|
||||||
if (!isSeed) {
|
if (!isSeed) {
|
||||||
$scope.client.validTorrents.push(torrent);
|
|
||||||
if (!($scope.selectedTorrent != null)) {
|
if (!($scope.selectedTorrent != null)) {
|
||||||
$scope.selectedTorrent = torrent;
|
$scope.selectedTorrent = torrent;
|
||||||
}
|
}
|
||||||
|
@ -224,9 +212,6 @@
|
||||||
}
|
}
|
||||||
if (isSeed) {
|
if (isSeed) {
|
||||||
dbg('Started seeding', torrent);
|
dbg('Started seeding', torrent);
|
||||||
if ($scope.client.validTorrents.indexOf(torrent) === -1) {
|
|
||||||
$scope.client.validTorrents.push(torrent);
|
|
||||||
}
|
|
||||||
if (!($scope.selectedTorrent != null)) {
|
if (!($scope.selectedTorrent != null)) {
|
||||||
$scope.selectedTorrent = torrent;
|
$scope.selectedTorrent = torrent;
|
||||||
}
|
}
|
||||||
|
@ -234,11 +219,11 @@
|
||||||
}
|
}
|
||||||
file.url = url;
|
file.url = url;
|
||||||
if (!isSeed) {
|
if (!isSeed) {
|
||||||
dbg('Finished downloading file ' + file.name, torrent);
|
dbg('Done ', file);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!isSeed) {
|
if (!isSeed) {
|
||||||
dbg('Received file ' + file.name + ' metadata', torrent);
|
dbg('Received metadata', file);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
torrent.on('download', function(chunkSize) {
|
torrent.on('download', function(chunkSize) {
|
||||||
|
@ -268,8 +253,10 @@
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
dbg('Adding ' + $location.hash());
|
dbg('Adding ' + $location.hash());
|
||||||
return $scope.client.add($location.hash(), $scope.onTorrent);
|
return $scope.client.add($location.hash(), $scope.onTorrent);
|
||||||
}, 500);
|
}, 0);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
return dbg('Ready');
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -287,13 +274,11 @@
|
||||||
if (isNaN(num)) {
|
if (isNaN(num)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
exponent = void 0;
|
|
||||||
unit = void 0;
|
|
||||||
units = ['B', 'kB', 'MB', 'GB', 'TB'];
|
units = ['B', 'kB', 'MB', 'GB', 'TB'];
|
||||||
if (num < 1) {
|
if (num < 1) {
|
||||||
return (speed ? '' : '0 B');
|
return (speed ? '' : '0 B');
|
||||||
}
|
}
|
||||||
exponent = Math.min(Math.floor(Math.log(num) / Math.log(1000)), 8);
|
exponent = Math.min(Math.floor(Math.log(num) / 6.907755278982137), 8);
|
||||||
num = (num / Math.pow(1000, exponent)).toFixed(1) * 1;
|
num = (num / Math.pow(1000, exponent)).toFixed(1) * 1;
|
||||||
unit = units[exponent];
|
unit = units[exponent];
|
||||||
return num + ' ' + unit + (speed ? '/s' : '');
|
return num + ' ' + unit + (speed ? '/s' : '');
|
||||||
|
@ -306,7 +291,7 @@
|
||||||
if (millis < 1000) {
|
if (millis < 1000) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
remaining = moment.duration(millis / 1000, 'seconds').humanize();
|
remaining = moment.duration(millis).humanize();
|
||||||
return remaining[0].toUpperCase() + remaining.substr(1);
|
return remaining[0].toUpperCase() + remaining.substr(1);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -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.9.0</span></h1>
|
<h1>βTorrent<span class="version"> v0.9.2</span></h1>
|
||||||
</header>
|
</header>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -83,7 +83,7 @@ app.controller 'bTorrentCtrl', ['$scope','$http','$log','$location', 'ngNotify',
|
||||||
$scope.$apply()
|
$scope.$apply()
|
||||||
return
|
return
|
||||||
|
|
||||||
#setInterval updateAll, 500
|
setInterval updateAll, 500
|
||||||
|
|
||||||
$scope.gridOptions.onRegisterApi = ( gridApi ) ->
|
$scope.gridOptions.onRegisterApi = ( gridApi ) ->
|
||||||
$scope.gridApi = gridApi
|
$scope.gridApi = gridApi
|
||||||
|
|
|
@ -17,7 +17,7 @@ html(ng-app='bTorrent', lang='en')
|
||||||
header
|
header
|
||||||
h1
|
h1
|
||||||
| βTorrent
|
| βTorrent
|
||||||
span.version v0.9.1
|
span.version v0.9.2
|
||||||
.container
|
.container
|
||||||
.row
|
.row
|
||||||
.four.columns
|
.four.columns
|
||||||
|
|
Loading…
Reference in a new issue