Browse Source

Merge branch 'develop' of github.com:ethereum/cpp-ethereum into develop

cl-refactor
Gav Wood 10 years ago
parent
commit
bca953c2bc
  1. 13
      alethzero/DappHost.cpp
  2. 6
      alethzero/DappHost.h
  3. 5
      alethzero/MainWin.cpp
  4. 1
      extdep/getstuff.bat

13
alethzero/DappHost.cpp

@ -28,7 +28,11 @@
using namespace dev;
DappHost::DappHost(int _port, int _threads):
m_port(_port), m_threads(_threads), m_running(false), m_daemon(nullptr)
m_port(_port),
m_url(QString("http://localhost:%1/").arg(m_port)),
m_threads(_threads),
m_running(false),
m_daemon(nullptr)
{
startListening();
}
@ -135,5 +139,10 @@ QUrl DappHost::hostDapp(Dapp&& _dapp)
for (ManifestEntry const& entry: m_dapp.manifest.entries)
m_entriesByPath[QString::fromStdString(entry.path)] = &entry;
return QUrl(QString("http://localhost:%1/").arg(m_port));
return m_url;
}
bool DappHost::servesUrl(QUrl const& _url) const
{
return m_url == _url || m_url.isParentOf(_url);
}

6
alethzero/DappHost.h

@ -40,6 +40,9 @@ public:
/// Load and host a dapp. Previsous dapp in discarded. Synchronous
QUrl hostDapp(Dapp&& _dapp);
/// @returns true if the given url is served from this DappHost.
bool servesUrl(QUrl const& _url) const;
private:
void startListening();
void stopListening();
@ -48,7 +51,8 @@ private:
void sendResponse(std::string const& _url, MHD_Connection* _connection);
static int callback(void* _cls, MHD_Connection* _connection, char const* _url, char const* _method, char const* _version, char const* _uploadData, size_t* _uploadDataSize, void** _conCls);
int m_port;
int const m_port;
QUrl const m_url;
int m_threads;
bool m_running;
MHD_Daemon* m_daemon;

5
alethzero/MainWin.cpp

@ -232,6 +232,11 @@ Main::Main(QWidget *parent) :
{
ui->tabWidget->setTabText(0, ui->webView->title());
});
connect(ui->webView, &QWebEngineView::urlChanged, [=](QUrl const& _url)
{
if (!m_dappHost->servesUrl(_url))
ui->urlEdit->setText(_url.toString());
});
m_dappHost.reset(new DappHost(8081));
m_dappLoader = new DappLoader(this, web3(), getNameReg());

1
extdep/getstuff.bat

@ -11,6 +11,7 @@ call :download curl 7.4.2
call :download jsoncpp 1.6.2
call :download json-rpc-cpp 0.5.0
call :download leveldb 1.2
call :download llvm 3.7svn
call :download microhttpd 0.9.2
call :download qt 5.4.1
call :download miniupnpc 1.9

Loading…
Cancel
Save