forked from cerc-io/plugeth
Support the ".eth" TLD through the DnsContract
This commit is contained in:
parent
bbe896875e
commit
a915ba17ed
@ -21,19 +21,54 @@ ApplicationWindow {
|
|||||||
id: root
|
id: root
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
state: "inspectorShown"
|
state: "inspectorShown"
|
||||||
|
TextField {
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
id: uriNav
|
||||||
|
//text: webview.url
|
||||||
|
|
||||||
|
Keys.onReturnPressed: {
|
||||||
|
var reg = /(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.eth)(.*)/
|
||||||
|
|
||||||
|
var uri = this.text;
|
||||||
|
if(reg.test(uri)) {
|
||||||
|
this.text.replace(reg, function(match, pre, domain, path) {
|
||||||
|
uri = pre;
|
||||||
|
|
||||||
|
var lookup = eth.lookupDomain(domain.substring(0, domain.length - 4));
|
||||||
|
var ip = [];
|
||||||
|
for(var i = 0, l = lookup.length; i < l; i++) {
|
||||||
|
ip.push(lookup.charCodeAt(i))
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ip.length != 0) {
|
||||||
|
uri += ip.join(".");
|
||||||
|
} else {
|
||||||
|
uri += domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
uri += path;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("connecting to ...", uri)
|
||||||
|
|
||||||
|
webview.url = uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WebView {
|
WebView {
|
||||||
objectName: "webView"
|
objectName: "webView"
|
||||||
id: webview
|
id: webview
|
||||||
anchors.fill: parent
|
anchors {
|
||||||
/*
|
left: parent.left
|
||||||
anchors {
|
right: parent.right
|
||||||
left: parent.left
|
bottom: parent.bottom
|
||||||
right: parent.right
|
top: uriNav.bottom
|
||||||
bottom: sizeGrip.top
|
}
|
||||||
top: parent.top
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
onTitleChanged: { window.title = title }
|
onTitleChanged: { window.title = title }
|
||||||
experimental.preferences.javascriptEnabled: true
|
experimental.preferences.javascriptEnabled: true
|
||||||
experimental.preferences.navigatorQtObjectEnabled: true
|
experimental.preferences.navigatorQtObjectEnabled: true
|
||||||
@ -46,50 +81,50 @@ ApplicationWindow {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
switch(data.call) {
|
switch(data.call) {
|
||||||
case "getCoinBase":
|
case "getCoinBase":
|
||||||
postData(data._seed, eth.getCoinBase())
|
postData(data._seed, eth.getCoinBase())
|
||||||
|
|
||||||
break
|
break
|
||||||
case "getIsListening":
|
case "getIsListening":
|
||||||
postData(data._seed, eth.getIsListening())
|
postData(data._seed, eth.getIsListening())
|
||||||
|
|
||||||
break
|
break
|
||||||
case "getIsMining":
|
case "getIsMining":
|
||||||
postData(data._seed, eth.getIsMining())
|
postData(data._seed, eth.getIsMining())
|
||||||
|
|
||||||
break
|
break
|
||||||
case "getPeerCount":
|
case "getPeerCount":
|
||||||
postData(data._seed, eth.getPeerCount())
|
postData(data._seed, eth.getPeerCount())
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
case "getTxCountAt":
|
case "getTxCountAt":
|
||||||
require(1)
|
require(1)
|
||||||
postData(data._seed, eth.getTxCountAt(data.args[0]))
|
postData(data._seed, eth.getTxCountAt(data.args[0]))
|
||||||
|
|
||||||
break
|
break
|
||||||
case "getBlockByNumber":
|
case "getBlockByNumber":
|
||||||
var block = eth.getBlock(data.args[0])
|
var block = eth.getBlock(data.args[0])
|
||||||
postData(data._seed, block)
|
postData(data._seed, block)
|
||||||
|
|
||||||
break
|
break
|
||||||
case "getBlockByHash":
|
case "getBlockByHash":
|
||||||
var block = eth.getBlock(data.args[0])
|
var block = eth.getBlock(data.args[0])
|
||||||
postData(data._seed, block)
|
postData(data._seed, block)
|
||||||
|
|
||||||
break
|
break
|
||||||
case "transact":
|
case "transact":
|
||||||
require(5)
|
require(5)
|
||||||
|
|
||||||
var tx = eth.transact(data.args[0], data.args[1], data.args[2],data.args[3],data.args[4],data.args[5])
|
var tx = eth.transact(data.args[0], data.args[1], data.args[2],data.args[3],data.args[4],data.args[5])
|
||||||
postData(data._seed, tx)
|
postData(data._seed, tx)
|
||||||
|
|
||||||
break
|
break
|
||||||
case "create":
|
case "create":
|
||||||
postData(data._seed, null)
|
postData(data._seed, null)
|
||||||
|
|
||||||
break
|
break
|
||||||
case "getStorage":
|
case "getStorage":
|
||||||
require(2);
|
require(2);
|
||||||
|
|
||||||
var stateObject = eth.getStateObject(data.args[0])
|
var stateObject = eth.getStateObject(data.args[0])
|
||||||
@ -97,52 +132,52 @@ ApplicationWindow {
|
|||||||
postData(data._seed, storage)
|
postData(data._seed, storage)
|
||||||
|
|
||||||
break
|
break
|
||||||
case "getStateKeyVals":
|
case "getStateKeyVals":
|
||||||
require(1);
|
require(1);
|
||||||
var stateObject = eth.getStateObject(data.args[0]).stateKeyVal(true)
|
var stateObject = eth.getStateObject(data.args[0]).stateKeyVal(true)
|
||||||
postData(data._seed,stateObject)
|
postData(data._seed,stateObject)
|
||||||
|
|
||||||
break
|
break
|
||||||
case "getTransactionsFor":
|
case "getTransactionsFor":
|
||||||
require(1);
|
require(1);
|
||||||
var txs = eth.getTransactionsFor(data.args[0], true)
|
var txs = eth.getTransactionsFor(data.args[0], true)
|
||||||
postData(data._seed, txs)
|
postData(data._seed, txs)
|
||||||
|
|
||||||
break
|
break
|
||||||
case "getBalance":
|
case "getBalance":
|
||||||
require(1);
|
require(1);
|
||||||
|
|
||||||
postData(data._seed, eth.getStateObject(data.args[0]).value());
|
postData(data._seed, eth.getStateObject(data.args[0]).value());
|
||||||
|
|
||||||
break
|
break
|
||||||
case "getKey":
|
case "getKey":
|
||||||
var key = eth.getKey().privateKey;
|
var key = eth.getKey().privateKey;
|
||||||
|
|
||||||
postData(data._seed, key)
|
postData(data._seed, key)
|
||||||
break
|
break
|
||||||
case "watch":
|
case "watch":
|
||||||
require(1)
|
require(1)
|
||||||
eth.watch(data.args[0], data.args[1]);
|
eth.watch(data.args[0], data.args[1]);
|
||||||
break
|
break
|
||||||
case "disconnect":
|
case "disconnect":
|
||||||
require(1)
|
require(1)
|
||||||
postData(data._seed, null)
|
postData(data._seed, null)
|
||||||
break;
|
break;
|
||||||
case "set":
|
case "set":
|
||||||
console.log("'Set' has been depcrecated")
|
console.log("'Set' has been depcrecated")
|
||||||
/*
|
/*
|
||||||
for(var key in data.args) {
|
for(var key in data.args) {
|
||||||
if(webview.hasOwnProperty(key)) {
|
if(webview.hasOwnProperty(key)) {
|
||||||
window[key] = data.args[key];
|
window[key] = data.args[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
case "getSecretToAddress":
|
case "getSecretToAddress":
|
||||||
require(1)
|
require(1)
|
||||||
postData(data._seed, eth.secretToAddress(data.args[0]))
|
postData(data._seed, eth.secretToAddress(data.args[0]))
|
||||||
break;
|
break;
|
||||||
case "debug":
|
case "debug":
|
||||||
console.log(data.args[0]);
|
console.log(data.args[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -191,12 +226,12 @@ ApplicationWindow {
|
|||||||
inspector.visible = false
|
inspector.visible = false
|
||||||
}else{
|
}else{
|
||||||
inspector.visible = true
|
inspector.visible = true
|
||||||
inspector.url = webview.experimental.remoteInspectorUrl
|
inspector.url = webview.experimental.remoteInspectorUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onDoubleClicked: {
|
onDoubleClicked: {
|
||||||
console.log('refreshing')
|
console.log('refreshing')
|
||||||
webView.reload()
|
webView.reload()
|
||||||
}
|
}
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user