From d272f1d086e4a2fb7d781967ed96c9b65a17a4ca Mon Sep 17 00:00:00 2001
From: hamza zia
Date: Wed, 20 Mar 2013 08:45:28 +0100
Subject: [PATCH] feature detection for compiled support for bittorrent and
metalinks added
---
index.html | 12 +++++++++---
js/ctrls/download.js | 2 +-
js/ctrls/nav.js | 2 ++
js/services/rpc/helpers.js | 9 ++++++++-
4 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/index.html b/index.html
index abc2f46..e7be6f9 100755
--- a/index.html
+++ b/index.html
@@ -107,12 +107,12 @@
By URIs
-
+
By Torrents
-
+
By Metalinks
@@ -194,7 +194,7 @@
-
+
@@ -521,6 +521,7 @@
+
Global Statistics
+
+
+
Miscellaneous
Aria2 Version {{miscellaneous.version}}
@@ -546,9 +550,11 @@
Or you can open the latest version in browser through http://ziahamza.github.com/webui-aria2
+
+
diff --git a/js/ctrls/download.js b/js/ctrls/download.js
index 60487c8..3211b2d 100644
--- a/js/ctrls/download.js
+++ b/js/ctrls/download.js
@@ -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
diff --git a/js/ctrls/nav.js b/js/ctrls/nav.js
index cb57346..4774f69 100644
--- a/js/ctrls/nav.js
+++ b/js/ctrls/nav.js
@@ -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;
diff --git a/js/services/rpc/helpers.js b/js/services/rpc/helpers.js
index 4705845..615edae 100644
--- a/js/services/rpc/helpers.js
+++ b/js/services/rpc/helpers.js
@@ -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