Support the ".eth" TLD through the DnsContract

pull/113/head
obscuren 10 years ago
parent bbe896875e
commit a915ba17ed
  1. 45
      ethereal/assets/qml/webapp.qml

@ -21,19 +21,54 @@ ApplicationWindow {
id: root
anchors.fill: parent
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 {
objectName: "webView"
id: webview
anchors.fill: parent
/*
anchors {
left: parent.left
right: parent.right
bottom: sizeGrip.top
top: parent.top
bottom: parent.bottom
top: uriNav.bottom
}
*/
onTitleChanged: { window.title = title }
experimental.preferences.javascriptEnabled: true
experimental.preferences.navigatorQtObjectEnabled: true

Loading…
Cancel
Save