In NDN Toolbar, added Set button to set the hub.
diff --git a/js/ndnProtocol/content/ndnToolbar.js b/js/ndnProtocol/content/ndnToolbar.js
index fcff0e6..ddd5cda 100644
--- a/js/ndnProtocol/content/ndnToolbar.js
+++ b/js/ndnProtocol/content/ndnToolbar.js
@@ -62,3 +62,24 @@
}
window.addEventListener("load", function() { NdnProtocolInfo.addNdnHubChangedListener(onNdnHubChanged); }, false);
+
+function ndnToolbarSetHub() {
+ var host = prompt("Enter hub host:", NdnProtocolInfo.ndn.host);
+ if (!host)
+ return;
+
+ host = host.trim();
+ if (host == "")
+ return;
+ if (host == NdnProtocolInfo.ndn.host)
+ // No change.
+ return;
+
+ var port = 9695;
+ NdnProtocolInfo.ndn.createRoute(host, port);
+ document.getElementById("ndnHubLabel").setAttribute("value", "Hub: trying " + host + ":" + port);
+
+ if (window._content.document.location.protocol == "ndn:")
+ // Reload with the new hub.
+ window._content.document.location = window._content.document.location.href;
+}