cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [18/34] git commit: Add getListenAddress() to harness-push
Date Tue, 06 May 2014 19:29:32 GMT
Add getListenAddress() to harness-push


Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/7454e2fc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/7454e2fc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/7454e2fc

Branch: refs/heads/master
Commit: 7454e2fcd8f4ee4ff933a16516a343a4bb208e9a
Parents: 9e8f9f8
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Tue Mar 18 16:26:53 2014 -0700
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue Mar 18 16:26:53 2014 -0700

----------------------------------------------------------------------
 harness-push/js/push.js | 12 ++++++++++++
 harness-push/plugin.xml |  2 ++
 2 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/7454e2fc/harness-push/js/push.js
----------------------------------------------------------------------
diff --git a/harness-push/js/push.js b/harness-push/js/push.js
index f5ce503..bf96d23 100644
--- a/harness-push/js/push.js
+++ b/harness-push/js/push.js
@@ -4,6 +4,18 @@
 
 var exec = require('cordova/exec');
 
+exports.getListenAddress = function(win) {
+    chrome.socket.getNetworkList(function(interfaces) {
+        // Filter out ipv6 addresses.
+        var ret = interfaces.filter(function(i) {
+            return i.address.indexOf(':') === -1;
+        }).map(function(i) {
+            return i.address;
+        }).join(', ');
+        win(ret);
+    });
+};
+
 exports.listen = function(win, fail) {
     exec(win, fail, 'HarnessPush', 'listen', []);
 };

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/7454e2fc/harness-push/plugin.xml
----------------------------------------------------------------------
diff --git a/harness-push/plugin.xml b/harness-push/plugin.xml
index fae233a..6552a41 100644
--- a/harness-push/plugin.xml
+++ b/harness-push/plugin.xml
@@ -13,6 +13,8 @@
 
   <name>App Harness Push Protocol</name>
 
+  <dependency id="org.chromium.socket" />
+
   <platform name="android">
     <source-file src="src/android/Push.java" target-dir="src/org/apache/appharness" />
     <source-file src="src/android/nanohttpd/NanoHTTPD.java" target-dir="src/fi/iki/elonen"
/>


Mime
View raw message