feature detection for compiled support for bittorrent and metalinks added

This commit is contained in:
hamza zia 2013-03-20 08:45:28 +01:00
parent cfb721b57d
commit d272f1d086
4 changed files with 20 additions and 5 deletions

View File

@ -107,12 +107,12 @@
<i class="icon-download"></i> By URIs
</a>
</li>
<li>
<li ng-show="isFeatureEnabled('BitTorrent')">
<a href="#" ng-click="addTorrents()">
<i class="icon-file"></i> By Torrents
</a>
</li>
<li>
<li ng-show="isFeatureEnabled('Metalink')">
<a href="#" ng-click="addMetalinks()">
<i class="icon-file"></i> By Metalinks
</a>
@ -194,7 +194,7 @@
</div>
<!-- }}} -->
<!-- {{{ body -->
<div role="main" class="container" ng-controller="DownloadCtrl">
<!-- {{{ alerts -->
@ -521,6 +521,7 @@
</div>
<!-- }}} -->
<!-- {{{ global statistics -->
<h3>Global Statistics</h3>
<div class="download-graph"
@ -529,6 +530,9 @@
dgraph>
</div>
<!-- }}} -->
<!-- {{{ miscellaneous -->
<h3>Miscellaneous</h3>
<b>Aria2 Version {{miscellaneous.version}}</b>
<br><br>
@ -546,9 +550,11 @@
<br>
Or you can open the latest version in browser through <a href="http://ziahamza.github.com/webui-aria2">http://ziahamza.github.com/webui-aria2</a>
</p>
<!-- }}} -->
</div>
<!-- }}} -->
<!-- {{{ modals -->
<div ng-controller="ModalCtrl">

View File

@ -11,7 +11,7 @@ function(
fsettings, activeInclude, waitingExclude
) {
scope.active = [], scope.waiting = [], scope.stopped = [];
scope.gstats = scope.miscellaneous = {};
scope.gstats = {};
// pause the download
// d: the download ctx

View File

@ -17,6 +17,8 @@ angular
// app name
scope.name = name;
scope.isFeatureEnabled = function(f) { return rhelpers.isFeatureEnabled(f) };
// initially collapsed in mobile resolution
scope.collapsed = true;

View File

@ -2,12 +2,19 @@ angular.module('webui.services.rpc.helpers', [
'webui.services.deps', 'webui.services.rpc', 'webui.services.alerts'
])
.factory('$rpchelpers', ['$_', '$rpc', '$alerts', function(_, rpc, alerts) {
var miscellaneous = {version: '', enabledFeatures: []};
rpc.once('getVersion', [], function(data) { miscellaneous = data[0]});
return {
isFeatureEnabled: function(feature) {
return miscellaneous.enabledFeatures.indexOf(feature) != -1;
},
getAria2Version: function() {
return miscellaneous.version;
},
addUris: function(uris) {
_.each(uris, function(uri) {
// passing true to batch all the addUri calls
rpc.once('addUri', [uri], angular.noop, true);
});
// now dispatch all addUri syscalls