Browse Source

common changes

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
cab4784dba
  1. 6
      alethzero/MainWin.cpp
  2. 2
      eth/main.cpp
  3. 1
      libweb3jsonrpc/WebThreeStubServer.cpp
  4. 2
      neth/main.cpp
  5. 1
      test/jsonrpc.cpp
  6. 5
      third/MainWin.cpp
  7. 3
      third/MainWin.h

6
alethzero/MainWin.cpp

@ -153,14 +153,14 @@ Main::Main(QWidget *parent) :
m_server = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(m_qwebConnector, *web3(), keysAsVector(m_myKeys)));
m_server->setIdentities(keysAsVector(owned()));
m_server->StartListening();
connect(ui->webView, &QWebView::loadStarted, [this]()
{
// NOTE: no need to delete as QETH_INSTALL_JS_NAMESPACE adopts it.
m_qweb = new QWebThree(this);
auto qweb = m_qweb;
m_qwebConnector->setQWeb(qweb);
QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
QWebFrame* f = ui->webView->page()->mainFrame();
f->disconnect(SIGNAL(javaScriptWindowObjectCleared()));
@ -179,9 +179,7 @@ Main::Main(QWidget *parent) :
});
readSettings();
installWatches();
startTimer(100);
{

2
eth/main.cpp

@ -341,6 +341,7 @@ int main(int argc, char** argv)
if (jsonrpc > -1)
{
jsonrpcServer = auto_ptr<WebThreeStubServer>(new WebThreeStubServer(new jsonrpc::CorsHttpServer(jsonrpc), web3, {us}));
jsonrpcServer->setIdentities({us});
jsonrpcServer->StartListening();
}
#endif
@ -428,6 +429,7 @@ int main(int argc, char** argv)
if (jsonrpc < 0)
jsonrpc = 8080;
jsonrpcServer = auto_ptr<WebThreeStubServer>(new WebThreeStubServer(new jsonrpc::CorsHttpServer(jsonrpc), web3, {us}));
jsonrpcServer->setIdentities({us});
jsonrpcServer->StartListening();
}
else if (cmd == "jsonstop")

1
libweb3jsonrpc/WebThreeStubServer.cpp

@ -463,6 +463,7 @@ std::string WebThreeStubServer::newGroup(std::string const& _id, std::string con
std::string WebThreeStubServer::newIdentity()
{
KeyPair kp = KeyPair::create();
m_ids[kp.pub()] = kp.secret();
return toJS(kp.pub());
}

2
neth/main.cpp

@ -479,6 +479,7 @@ int main(int argc, char** argv)
if (jsonrpc > -1)
{
jsonrpcServer = auto_ptr<WebThreeStubServer>(new WebThreeStubServer(new jsonrpc::HttpServer(jsonrpc), web3, {us}));
jsonrpcServer->setIdentities({us});
jsonrpcServer->StartListening();
}
#endif
@ -552,6 +553,7 @@ int main(int argc, char** argv)
if (jsonrpc < 0)
jsonrpc = 8080;
jsonrpcServer = auto_ptr<WebThreeStubServer>(new WebThreeStubServer(new jsonrpc::HttpServer(jsonrpc), web3, {us}));
jsonrpcServer->setIdentities({us});
jsonrpcServer->StartListening();
}
else if (cmd == "jsonstop")

1
test/jsonrpc.cpp

@ -61,6 +61,7 @@ struct JsonrpcFixture {
web3.setIdealPeerCount(5);
web3.ethereum()->setForceMining(true);
jsonrpcServer = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(new jsonrpc::CorsHttpServer(8080), web3, {}));
jsonrpcServer->setIdentities({});
jsonrpcServer->StartListening();
jsonrpcClient = unique_ptr<WebThreeStubClient>(new WebThreeStubClient(new jsonrpc::HttpClient("http://localhost:8080")));

5
third/MainWin.cpp

@ -118,7 +118,8 @@ Main::Main(QWidget *parent) :
m_web3->connect(Host::pocHost());
m_qwebConnector = new QWebThreeConnector();
m_server = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(m_qwebConnector, *web3(), keysAsVector(owned())));
m_server = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(m_qwebConnector, *web3(), keysAsVector(m_myKeys)));
m_server->setIdentities(keysAsVector(owned()));
m_server->StartListening();
connect(ui->webView, &QWebView::loadStarted, [this]()
@ -557,7 +558,7 @@ void Main::ourAccountsRowsMoved()
m_myKeys = myKeys;
if (m_server.get())
m_server->setAccounts(keysAsVector(owned()));
m_server->setAccounts(keysAsVector(myKeys));
}
void Main::on_ourAccounts_doubleClicked()

3
third/MainWin.h

@ -62,7 +62,7 @@ public:
dev::eth::Client* ethereum() const;
std::shared_ptr<dev::shh::WhisperHost> whisper() const;
QList<dev::KeyPair> const& owned() const { return m_myKeys; }
QList<dev::KeyPair> owned() const { return m_myKeys + m_myIdentities;}
public slots:
void note(QString _entry);
@ -122,6 +122,7 @@ private:
std::unique_ptr<dev::WebThreeDirect> m_web3;
QList<dev::KeyPair> m_myKeys;
QList<dev::KeyPair> m_myIdentities;
std::map<unsigned, std::function<void()>> m_handlers;
unsigned m_nameRegFilter = (unsigned)-1;

Loading…
Cancel
Save