From 4a0ade4788b0e8d53c6b0eabaf9652643b6a073a Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 8 Jan 2015 21:41:32 +0100 Subject: Fixed some whisper issues --- cmd/mist/assets/ext/eth.js/main.js | 1 + cmd/mist/assets/qml/browser.qml | 44 ++++++++++++++++++++++---------------- 2 files changed, 26 insertions(+), 19 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/ext/eth.js/main.js b/cmd/mist/assets/ext/eth.js/main.js index 5c7ca0603..71e304a55 100644 --- a/cmd/mist/assets/ext/eth.js/main.js +++ b/cmd/mist/assets/ext/eth.js/main.js @@ -352,6 +352,7 @@ web3.provider = new ProviderManager(); web3.setProvider = function(provider) { + console.log("setprovider", provider) provider.onmessage = messageHandler; web3.provider.set(provider); web3.provider.sendQueued(); diff --git a/cmd/mist/assets/qml/browser.qml b/cmd/mist/assets/qml/browser.qml index 4cf6b2470..c2f8741bc 100644 --- a/cmd/mist/assets/qml/browser.qml +++ b/cmd/mist/assets/qml/browser.qml @@ -59,7 +59,7 @@ Rectangle { } Component.onCompleted: { - webview.url = "/Users/jeffrey/test.html" + webview.url = "http://etherian.io" } signal messages(var messages, int id); @@ -153,7 +153,9 @@ Rectangle { } function injectJs(js) { - experimental.evaluateJavaScript(js) + //webview.experimental.navigatorQtObjectEnabled = true; + //webview.experimental.evaluateJavaScript(js) + //webview.experimental.javascriptEnabled = true; } function sendMessage(data) { @@ -164,7 +166,7 @@ Rectangle { experimental.preferences.javascriptEnabled: true experimental.preferences.navigatorQtObjectEnabled: true experimental.preferences.developerExtrasEnabled: true - //experimental.userScripts: ["../ext/q.js", "../ext/eth.js/main.js", "../ext/eth.js/qt.js", "../ext/setup.js"] + experimental.userScripts: ["../ext/q.js", "../ext/eth.js/main.js", "../ext/eth.js/qt.js", "../ext/setup.js"] experimental.onMessageReceived: { console.log("[onMessageReceived]: ", message.data) // TODO move to messaging.js @@ -344,24 +346,28 @@ Rectangle { break; case "newIdentity": - postData(data._id, shh.newIdentity()) - break + var id = shh.newIdentity() + console.log("newIdentity", id) + postData(data._id, id) + + break case "post": - require(1); - var params = data.args[0]; - var fields = ["payload", "to", "from"]; - for(var i = 0; i < fields.length; i++) { - params[fields[i]] = params[fields[i]] || ""; - } - if(typeof params.payload !== "object") { params.payload = [params.payload]; } //params.payload = params.payload.join(""); } - params.topics = params.topics || []; - params.priority = params.priority || 1000; - params.ttl = params.ttl || 100; - - console.log(JSON.stringify(params)) - shh.post(params.payload, params.to, params.from, params.topics, params.priority, params.ttl); - break; + require(1); + + var params = data.args[0]; + var fields = ["payload", "to", "from"]; + for(var i = 0; i < fields.length; i++) { + params[fields[i]] = params[fields[i]] || ""; + } + if(typeof params.payload !== "object") { params.payload = [params.payload]; } //params.payload = params.payload.join(""); } + params.topics = params.topics || []; + params.priority = params.priority || 1000; + params.ttl = params.ttl || 100; + + shh.post(params.payload, params.to, params.from, params.topics, params.priority, params.ttl); + + break; } } catch(e) { console.log(data.call + ": " + e) -- cgit