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 {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
bottom: sizeGrip.top
|
bottom: parent.bottom
|
||||||
top: parent.top
|
top: uriNav.bottom
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
onTitleChanged: { window.title = title }
|
onTitleChanged: { window.title = title }
|
||||||
experimental.preferences.javascriptEnabled: true
|
experimental.preferences.javascriptEnabled: true
|
||||||
experimental.preferences.navigatorQtObjectEnabled: true
|
experimental.preferences.navigatorQtObjectEnabled: true
|
||||||
|
Loading…
Reference in New Issue
Block a user