From 3fd0337330ab4ceb25abfc7ec04b576e8f3f0914 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 14 Aug 2014 13:26:29 +0200 Subject: [PATCH] DNS for a hrefs should now be fixed --- ethereal/assets/back.png | Bin 931 -> 1004 bytes ethereal/assets/bug.png | Bin 0 -> 1671 bytes ethereal/assets/ext/home.html | 5 +- ethereal/assets/qml/webapp.qml | 202 +++++++++++++++++---------------- ethereal/gui.go | 4 +- 5 files changed, 112 insertions(+), 99 deletions(-) create mode 100644 ethereal/assets/bug.png diff --git a/ethereal/assets/back.png b/ethereal/assets/back.png index 71486c7c05795d7ee5a3ef0ee77af0c0085b40d9..38fc84d6ea9203583110c91f2eaf7610061dbbb9 100644 GIT binary patch delta 637 zcmV-@0)qXc2kZxGiBL{Q4GJ0x0000DNk~Le0000P0000P2nGNE0L1BqV*mgE1ZP1_ zK>z@;j|==^1poj50drDELIAGL9O(c603c&XQcVB=dL{q>fP?@5`Tzg`fam}Kbua(` z>RI+y?e7jT@qQ9Q9OeF1;)NklYkZW>Ay%h zrx2}ItWOGda{Rx&>=U@nc}Y3H3qW&>txRO7B@5+pxrsf+O^QJv zJxr41lp8k7Sk)$Io+y7_C5oa4@JY^wi6C+wX&E>Rz9f~33N|vya~bWD5abwwOE6Oj4#QNUcqgJ$ zilXjtCJiQ=*fS8CGr`_%x7&NPbIke`IurI9B6qtQ+^B0*SJ!{tt~EIoluVyhjX57x z3>g@oUe+Zu|vD92mM4hwjy2c7VpcZbyaqm40|EIX8A<(kQgG7p+EBN za%uDvxv%g(4nOi0_KDQnlKv;OY8`XJE)LZy8{-2MOjY?(h#+s1PxLGQc)x*aOf~ zKm{eDK_K81EFCnoE1n_zV`eNX4<*4)svT)|5_>#fW-^X92u9LT1yoH=2tU%4{gayO zoZO;<)pZ}ZVCmmbQBd1C#*NM{j^iz*R4+}_7mN*|&TxMlWM30hOBjaxQ4|fKDfA43 zlQPBDo3Wt>3?!&lP&SxURk217R0frd&k=2cBT~b8kuvBTXL}9GB9mHy9!gnZKlu6v zz$J!`!BUwC-b8Z^Y2FnY$$qB-y#!zu>M8^_a8t4j^qn)kgYy~_XJDtG)YVON8vaxz z5oPFr>|lTNm}kCVwIlZJ6ZY>jECK1u^#e8Qa9t&|CPa*H*nW~EC$vBUtOERi`+4Xm zbR0@Ti^N9{IR3l>yoneCQ)bVA%IA~q^9au)D3zMBl~OBDrH)W)irI$_pju4UDEBT@ zzEIL!_wZV0UvJID@${b5*BQ8Mrz=d(iL-;He#v|FjFdenfm7xy45g0u@&Vy^K^a^= znYVCUW@qz?WU;F?a6S&@oy#F{0YE3mBAvwoZ}nJ|irJa(0WKMzwwZAbj=w%Vz_&56 zz>~S|AtCd{FKg=&}F+002ovPDHLkV1l-2 B_F(`3 diff --git a/ethereal/assets/bug.png b/ethereal/assets/bug.png new file mode 100644 index 0000000000000000000000000000000000000000..f5e85dc99c85e6c283ff978a9a8f626d11fd36e1 GIT binary patch literal 1671 zcmY*adt4G$6vpM60#X|GAf1ShY6Xbki@?gTAT`sdOlXLRio8rH5g%zu2{rT4!&j+k zXt7F7GiyFFTbZx=WrUfTMutl(S6h?~2i4kkf4_6@Ip==o`_8%lT=}Mr>#cw=AOHZc zqL4|U#&eO$EM^<`j&T{wc$kSo*ZTp^_u7pc1Iu{wb`byonrAXIKvBs;BVap+8YT`4 z3dFO7d=xWE7|BLS`0++G06>u7jV_-pX2K~=5HXjC2n*T- zUn@*t!#z+qlpDeq2#3Q72~pAbP|~_D<;IAJh!u?0 zw7Wafh(L;x1Y)KHDG)h*Ci#bl#1^pO;*{L6({WHdLP5zIpup9aPFu=W|i0nCwxvkUbhMb(7E}ndzIx(Hrgz79UD9Exw`R((ylt(15(EMTgCP)QZD|FwqKC1%G(E~ovYMpZ*0#~Hfq5i(F(oup8E%EuXL7XmPURt#ik9y_YSEvp#Nc3_^KWA_GCd;FL8ZX;}o=e$M&m zg8Mcp4DSM(ZCNMJbJ{jtDkpW?`na1{Q`+p84vNa?sJ?GF?e112XuBuEf!1|>>-ZXL zjr74iUNLiGe4O&fyLZC@r!HVe!q-(*RS{uFa6b5I0d9FkrmB`VGR9e`^TG^ZJ!XlR z4`oeQpX|TDQH(nOo6pC_P)o@bO_8xf*q8##2U2y!Yy#$T&wHQCt0eQ7H+pTTi z+Y+2@b8~a@GRcA2hpR0uW2S}~;o(=vC;CXUpc8<>Y{pd|aJ^!tYjkw9R4ew|4Vc+= z-T?XCL+dpXuiuhO?pC(r!Pl5s+3EhdE94h%xoCj~Mn@njDTFMYN_3p#I0xQ?Yt1&~ z=$CYLb*&0vSyVP$D7u5wO-!Vebck^30Hyp0tNx8Fm(_8@QD1)gH2dAhk12Pd8UtQ} zv_Eo*U2K=flG2sS-gHJRxcxnXkiG{py=_3J7}eT7b7BXSmAe%6COT^}R-=w%r+cCj z2Tsl1ZB7dh61*-iA(hs(2o*>3<+s`FOBj-jwd85e-uPxGf>X2wJPtV7F(3L}5ISH1TnX1Oy%&k|k z(tc;^g&OG@;hi1Kpyhda7O`m=oufEpSz~$6Du1hnN{=R&T@A$%2VgMRUK)*dpdVyS znPfvV7W}jhYxk%T`odubs-eYY2?d3GAl;=MjgW?jZh1F-fHsp$^Ihe*`hoS0!^>Ju zzR2oh1`SjK49V?3^DL@5iy_xrU;_iw^I B;2{72 literal 0 HcmV?d00001 diff --git a/ethereal/assets/ext/home.html b/ethereal/assets/ext/home.html index 86a659d65f..a524e84032 100644 --- a/ethereal/assets/ext/home.html +++ b/ethereal/assets/ext/home.html @@ -8,14 +8,15 @@ h1 { text-align: center; font-family: Courier; font-size: 50pt; - margin-top: 25% }

... Ethereum ...

- + diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml index ec2f01741a..a0ec527525 100644 --- a/ethereal/assets/qml/webapp.qml +++ b/ethereal/assets/qml/webapp.qml @@ -2,6 +2,7 @@ import QtQuick 2.0 import QtWebKit 3.0 import QtWebKit.experimental 1.0 import QtQuick.Controls 1.0; +import QtQuick.Controls.Styles 1.0 import QtQuick.Layouts 1.0; import QtQuick.Window 2.1; import Ethereum 1.0 @@ -9,8 +10,8 @@ import Ethereum 1.0 ApplicationWindow { id: window title: "Ethereum" - width: 900 - height: 600 + width: 1000 + height: 800 minimumHeight: 300 property alias url: webview.url @@ -24,29 +25,74 @@ ApplicationWindow { RowLayout { id: navBar + height: 40 anchors { left: parent.left right: parent.right + leftMargin: 7 } Button { id: back - iconSource: "../back.png" onClicked: { webview.goBack() } + style: ButtonStyle { + background: Image { + source: "../back.png" + width: 30 + height: 30 + } + } } TextField { anchors { - top: parent.top left: back.right - right: parent.right + right: toggleInspector.left + leftMargin: 5 + rightMargin: 5 } id: uriNav + y: parent.height / 2 - this.height / 2 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)) { uri = "http://" + uri; } @@ -54,7 +100,7 @@ ApplicationWindow { var reg = /(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.eth)(.*)/ if(reg.test(uri)) { - this.text.replace(reg, function(match, pre, domain, path) { + uri.replace(reg, function(match, pre, domain, path) { uri = pre; 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; + } 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.navigatorQtObjectEnabled: true experimental.preferences.developerExtrasEnabled: true @@ -102,107 +139,107 @@ ApplicationWindow { try { switch(data.call) { case "getCoinBase": - postData(data._seed, eth.getCoinBase()) + postData(data._seed, eth.getCoinBase()) - break + break case "getIsListening": - postData(data._seed, eth.getIsListening()) + postData(data._seed, eth.getIsListening()) - break + break case "getIsMining": - postData(data._seed, eth.getIsMining()) + postData(data._seed, eth.getIsMining()) - break + break case "getPeerCount": - postData(data._seed, eth.getPeerCount()) + postData(data._seed, eth.getPeerCount()) - break + break case "getTxCountAt": - require(1) - postData(data._seed, eth.getTxCountAt(data.args[0])) + require(1) + postData(data._seed, eth.getTxCountAt(data.args[0])) - break + break case "getBlockByNumber": - var block = eth.getBlock(data.args[0]) - postData(data._seed, block) + var block = eth.getBlock(data.args[0]) + postData(data._seed, block) - break + break case "getBlockByHash": - var block = eth.getBlock(data.args[0]) - postData(data._seed, block) + var block = eth.getBlock(data.args[0]) + postData(data._seed, block) - break + break 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]) - postData(data._seed, tx) + 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) - break + break case "getStorage": - require(2); + require(2); - var stateObject = eth.getStateObject(data.args[0]) - var storage = stateObject.getStorage(data.args[1]) - postData(data._seed, storage) + var stateObject = eth.getStateObject(data.args[0]) + var storage = stateObject.getStorage(data.args[1]) + postData(data._seed, storage) - break + break case "getStateKeyVals": - require(1); - var stateObject = eth.getStateObject(data.args[0]).stateKeyVal(true) - postData(data._seed,stateObject) + require(1); + var stateObject = eth.getStateObject(data.args[0]).stateKeyVal(true) + postData(data._seed,stateObject) - break + break case "getTransactionsFor": - require(1); - var txs = eth.getTransactionsFor(data.args[0], true) - postData(data._seed, txs) + require(1); + var txs = eth.getTransactionsFor(data.args[0], true) + postData(data._seed, txs) - break + break 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": - var key = eth.getKey().privateKey; + var key = eth.getKey().privateKey; - postData(data._seed, key) - break + postData(data._seed, key) + break case "watch": - require(1) - eth.watch(data.args[0], data.args[1]); + require(1) + eth.watch(data.args[0], data.args[1]); - break + break case "disconnect": - require(1) - postData(data._seed, null) + require(1) + postData(data._seed, null) - break; + break; case "getSecretToAddress": - require(1) - postData(data._seed, eth.secretToAddress(data.args[0])) + require(1) + postData(data._seed, eth.secretToAddress(data.args[0])) - break; + break; case "debug": - console.log(data.args[0]); + console.log(data.args[0]); break; } } 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 { id: sizeGrip diff --git a/ethereal/gui.go b/ethereal/gui.go index 710a1bd1e1..d191f67d05 100644 --- a/ethereal/gui.go +++ b/ethereal/gui.go @@ -391,12 +391,12 @@ func (gui *Gui) update() { if bytes.Compare(tx.Sender(), gui.address()) == 0 { 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()) } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { 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()) }