DNS for a hrefs should now be fixed

pull/121/head
obscuren 10 years ago
parent 14e4f1283c
commit 3fd0337330
  1. BIN
      ethereal/assets/back.png
  2. BIN
      ethereal/assets/bug.png
  3. 5
      ethereal/assets/ext/home.html
  4. 202
      ethereal/assets/qml/webapp.qml
  5. 4
      ethereal/gui.go

Binary file not shown.

Before

Width:  |  Height:  |  Size: 931 B

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

@ -8,14 +8,15 @@ h1 {
text-align: center; text-align: center;
font-family: Courier; font-family: Courier;
font-size: 50pt; font-size: 50pt;
margin-top: 25%
} }
</style> </style>
</head> </head>
<body> <body>
<h1>... Ethereum ...</h1> <h1>... Ethereum ...</h1>
<!-- ĐΞV --!> <ul>
<li><a href="http://std.eth">std::Service</a></li>
</ul>
</body> </body>
</html> </html>

@ -2,6 +2,7 @@ import QtQuick 2.0
import QtWebKit 3.0 import QtWebKit 3.0
import QtWebKit.experimental 1.0 import QtWebKit.experimental 1.0
import QtQuick.Controls 1.0; import QtQuick.Controls 1.0;
import QtQuick.Controls.Styles 1.0
import QtQuick.Layouts 1.0; import QtQuick.Layouts 1.0;
import QtQuick.Window 2.1; import QtQuick.Window 2.1;
import Ethereum 1.0 import Ethereum 1.0
@ -9,8 +10,8 @@ import Ethereum 1.0
ApplicationWindow { ApplicationWindow {
id: window id: window
title: "Ethereum" title: "Ethereum"
width: 900 width: 1000
height: 600 height: 800
minimumHeight: 300 minimumHeight: 300
property alias url: webview.url property alias url: webview.url
@ -24,29 +25,74 @@ ApplicationWindow {
RowLayout { RowLayout {
id: navBar id: navBar
height: 40
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
leftMargin: 7
} }
Button { Button {
id: back id: back
iconSource: "../back.png"
onClicked: { onClicked: {
webview.goBack() webview.goBack()
} }
style: ButtonStyle {
background: Image {
source: "../back.png"
width: 30
height: 30
}
}
} }
TextField { TextField {
anchors { anchors {
top: parent.top
left: back.right left: back.right
right: parent.right right: toggleInspector.left
leftMargin: 5
rightMargin: 5
} }
id: uriNav id: uriNav
y: parent.height / 2 - this.height / 2
Keys.onReturnPressed: { Keys.onReturnPressed: {
var uri = this.text; webview.url = this.text;
}
}
Button {
id: toggleInspector
anchors {
right: parent.right
}
iconSource: "../bug.png"
onClicked: {
if(inspector.visible == true){
inspector.visible = false
}else{
inspector.visible = true
inspector.url = webview.experimental.remoteInspectorUrl
}
}
}
}
WebView {
objectName: "webView"
id: webview
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
top: navBar.bottom
}
onTitleChanged: { window.title = title }
property var cleanPath: false
onNavigationRequested: {
if(!this.cleanPath) {
var uri = request.url.toString();
if(!/.*\:\/\/.*/.test(uri)) { if(!/.*\:\/\/.*/.test(uri)) {
uri = "http://" + uri; uri = "http://" + uri;
} }
@ -54,7 +100,7 @@ ApplicationWindow {
var reg = /(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.eth)(.*)/ var reg = /(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.eth)(.*)/
if(reg.test(uri)) { if(reg.test(uri)) {
this.text.replace(reg, function(match, pre, domain, path) { uri.replace(reg, function(match, pre, domain, path) {
uri = pre; uri = pre;
var lookup = eth.lookupDomain(domain.substring(0, domain.length - 4)); var lookup = eth.lookupDomain(domain.substring(0, domain.length - 4));
@ -73,23 +119,14 @@ ApplicationWindow {
}); });
} }
console.log("connecting to ...", uri) this.cleanPath = true;
webview.url = uri; webview.url = uri;
} else {
// Prevent inf loop.
this.cleanPath = false;
} }
} }
}
WebView {
objectName: "webView"
id: webview
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
top: navBar.bottom
}
onTitleChanged: { window.title = title }
experimental.preferences.javascriptEnabled: true experimental.preferences.javascriptEnabled: true
experimental.preferences.navigatorQtObjectEnabled: true experimental.preferences.navigatorQtObjectEnabled: true
experimental.preferences.developerExtrasEnabled: true experimental.preferences.developerExtrasEnabled: true
@ -102,107 +139,107 @@ 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 "getStorage": case "getStorage":
require(2); require(2);
var stateObject = eth.getStateObject(data.args[0]) var stateObject = eth.getStateObject(data.args[0])
var storage = stateObject.getStorage(data.args[1]) var storage = stateObject.getStorage(data.args[1])
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 "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;
} }
} catch(e) { } catch(e) {
@ -236,31 +273,6 @@ ApplicationWindow {
} }
} }
Rectangle {
id: toggleInspector
color: "#bcbcbc"
visible: true
height: 20
width: 20
anchors {
right: root.right
}
MouseArea {
onClicked: {
if(inspector.visible == true){
inspector.visible = false
}else{
inspector.visible = true
inspector.url = webview.experimental.remoteInspectorUrl
}
}
onDoubleClicked: {
webView.reload()
}
anchors.fill: parent
}
}
Rectangle { Rectangle {
id: sizeGrip id: sizeGrip

@ -391,12 +391,12 @@ func (gui *Gui) update() {
if bytes.Compare(tx.Sender(), gui.address()) == 0 { if bytes.Compare(tx.Sender(), gui.address()) == 0 {
object.SubAmount(tx.Value) object.SubAmount(tx.Value)
gui.getObjectByName("transactionView").Call("addTx", "post", ethpub.NewPTx(tx), "send") gui.getObjectByName("transactionView").Call("addTx", ethpub.NewPTx(tx), "send")
gui.txDb.Put(tx.Hash(), tx.RlpEncode()) gui.txDb.Put(tx.Hash(), tx.RlpEncode())
} else if bytes.Compare(tx.Recipient, gui.address()) == 0 { } else if bytes.Compare(tx.Recipient, gui.address()) == 0 {
object.AddAmount(tx.Value) object.AddAmount(tx.Value)
gui.getObjectByName("transactionView").Call("addTx", "post", ethpub.NewPTx(tx), "recv") gui.getObjectByName("transactionView").Call("addTx", ethpub.NewPTx(tx), "recv")
gui.txDb.Put(tx.Hash(), tx.RlpEncode()) gui.txDb.Put(tx.Hash(), tx.RlpEncode())
} }

Loading…
Cancel
Save