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 <i class="icon-download"></i> By URIs
</a> </a>
</li> </li>
<li> <li ng-show="isFeatureEnabled('BitTorrent')">
<a href="#" ng-click="addTorrents()"> <a href="#" ng-click="addTorrents()">
<i class="icon-file"></i> By Torrents <i class="icon-file"></i> By Torrents
</a> </a>
</li> </li>
<li> <li ng-show="isFeatureEnabled('Metalink')">
<a href="#" ng-click="addMetalinks()"> <a href="#" ng-click="addMetalinks()">
<i class="icon-file"></i> By Metalinks <i class="icon-file"></i> By Metalinks
</a> </a>
@ -194,7 +194,7 @@
</div> </div>
<!-- }}} --> <!-- }}} -->
<!-- {{{ body -->
<div role="main" class="container" ng-controller="DownloadCtrl"> <div role="main" class="container" ng-controller="DownloadCtrl">
<!-- {{{ alerts --> <!-- {{{ alerts -->
@ -521,6 +521,7 @@
</div> </div>
<!-- }}} --> <!-- }}} -->
<!-- {{{ global statistics -->
<h3>Global Statistics</h3> <h3>Global Statistics</h3>
<div class="download-graph" <div class="download-graph"
@ -529,6 +530,9 @@
dgraph> dgraph>
</div> </div>
<!-- }}} -->
<!-- {{{ miscellaneous -->
<h3>Miscellaneous</h3> <h3>Miscellaneous</h3>
<b>Aria2 Version {{miscellaneous.version}}</b> <b>Aria2 Version {{miscellaneous.version}}</b>
<br><br> <br><br>
@ -546,9 +550,11 @@
<br> <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> 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> </p>
<!-- }}} -->
</div> </div>
<!-- }}} -->
<!-- {{{ modals --> <!-- {{{ modals -->
<div ng-controller="ModalCtrl"> <div ng-controller="ModalCtrl">

View File

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

View File

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

View File

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