Remove full_web_node #457

This commit is contained in:
theoreticalbts 2015-11-23 10:04:26 -05:00
parent 09855166a2
commit 751d68789a
27 changed files with 0 additions and 400 deletions

View file

@ -9,7 +9,3 @@ set(BUILD_QT_GUI FALSE CACHE BOOL "Build the Qt-based light client GUI")
if(BUILD_QT_GUI)
# add_subdirectory(light_client)
endif()
set(BUILD_WEB_NODE FALSE CACHE BOOL "Build the Qt-based full node with web GUI")
if(BUILD_WEB_NODE)
add_subdirectory(full_web_node)
endif()

View file

@ -1,86 +0,0 @@
/*
* Copyright (c) 2015 Cryptonomex, Inc., and contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Any modified source or binaries are used only with the BitShares network.
*
* 2. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 3. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "BlockChain.hpp"
#include <graphene/app/application.hpp>
#include <graphene/account_history/account_history_plugin.hpp>
#include <graphene/market_history/market_history_plugin.hpp>
#include <fc/thread/thread.hpp>
#include <boost/program_options.hpp>
#include <QThread>
#include <QTimer>
#include <QDebug>
#include <QStandardPaths>
#include <QDir>
#include <QSettings>
BlockChain::BlockChain()
: chainThread(new fc::thread("chainThread")),
grapheneApp(new graphene::app::application),
webUsername(QStringLiteral("webui")),
webPassword(QString::fromStdString(fc::sha256::hash(fc::ecc::private_key::generate())))
{}
BlockChain::~BlockChain() {
startFuture.cancel_and_wait(__FUNCTION__);
chainThread->async([this] {
grapheneApp->shutdown_plugins();
delete grapheneApp;
}).wait();
delete chainThread;
}
void BlockChain::start()
{
startFuture = chainThread->async([this] {
try {
QSettings settings;
rpcEndpoint = settings.value( "rpc-endpoint", "127.0.0.1:8090" ).value<QString>();
auto seed_node = settings.value( "seed-node", "104.236.51.238:2005" ).value<QString>().toStdString();
grapheneApp->register_plugin<graphene::account_history::account_history_plugin>();
grapheneApp->register_plugin<graphene::market_history::market_history_plugin>();
QString dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
QDir(dataDir).mkpath(".");
idump((dataDir.toStdString()));
boost::program_options::variables_map map;
map.insert({"rpc-endpoint",boost::program_options::variable_value(rpcEndpoint.toStdString(), false)});
map.insert({"seed-node",boost::program_options::variable_value(std::vector<std::string>{(seed_node)}, false)});
grapheneApp->initialize(dataDir.toStdString(), map);
grapheneApp->initialize_plugins(map);
grapheneApp->startup();
grapheneApp->startup_plugins();
graphene::app::api_access_info webPermissions;
auto passHash = fc::sha256::hash(webPassword.toStdString());
webPermissions.password_hash_b64 = fc::base64_encode(passHash.data(), passHash.data_size());
webPermissions.password_salt_b64 = fc::base64_encode("");
webPermissions.allowed_apis = {"database_api", "network_broadcast_api", "network_node_api", "history_api"};
grapheneApp->set_api_access_info(webUsername.toStdString(), std::move(webPermissions) );
} catch (const fc::exception& e) {
elog("Crap went wrong: ${e}", ("e", e.to_detail_string()));
}
QMetaObject::invokeMethod(this, "started");
});
}

View file

@ -1,53 +0,0 @@
/*
* Copyright (c) 2015 Cryptonomex, Inc., and contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Any modified source or binaries are used only with the BitShares network.
*
* 2. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 3. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#pragma once
#include <fc/thread/future.hpp>
#include <QObject>
class QTimer;
class QThread;
namespace fc { class thread; }
namespace graphene { namespace app { class application; } }
class BlockChain : public QObject {
Q_OBJECT
Q_PROPERTY(QString webUsername MEMBER webUsername CONSTANT)
Q_PROPERTY(QString webPassword MEMBER webPassword CONSTANT)
Q_PROPERTY(QString rpcEndpoint MEMBER rpcEndpoint CONSTANT)
fc::thread* chainThread;
graphene::app::application* grapheneApp;
fc::future<void> startFuture;
QString webUsername;
QString webPassword;
QString rpcEndpoint;
public:
BlockChain();
virtual ~BlockChain();
public Q_SLOTS:
void start();
Q_SIGNALS:
void started();
};

View file

@ -1,117 +0,0 @@
#cmake_minimum_required(VERSION 2.8.11)
#project(full_web_node)
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
ENDIF("${isSystemDir}" STREQUAL "-1")
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
find_package(Qt5Core)
find_package(Qt5Quick)
find_package(Qt5WebEngine)
file(GLOB QML qml/*)
file(GLOB WEB web/*)
qt5_add_resources(QML_QRC qml/qml.qrc)
qt5_add_resources(WEB_QRC web/web.qrc)
set( APP_NAME "GrapheneOct5" )
set( CPACK_BUNDLE_NAME ${APP_NAME} )
set( CPACK_PACKAGE_NAME ${CPACK_BUNDLE_NAME} )
set( CPACK_PACKAGE_EXECUTABLES qt_wallet ${CPACK_BUNDLE_NAME} )
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "package description summary" )
set( CPACK_PACKAGE_VENDOR "BitShares" )
set( CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR} )
set( CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR} )
set( CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH} )
set( CPACK_DMG_VOLUME_NAME ${CPACK_BUNDLE_NAME} )
set( CPACK_PACKAGE_FILE_NAME ${CPACK_BUNDLE_NAME} )
get_filename_component( QT_PATH ${Qt5Core_DIR}/../../../ ABSOLUTE )
IF( APPLE )
set ( OSX_ICON_FILE "${CMAKE_CURRENT_SOURCE_DIR}/images/bitshares.icns" )
SET_SOURCE_FILES_PROPERTIES( "${OSX_ICON_FILE}" PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
SET( MACOSX_BUNDLE_BUNDLE_NAME ${CPACK_BUNDLE_NAME} )
SET( MACOSX_BUNDLE_EXECUTABLE_NAME ${CPACK_BUNDLE_NAME} )
SET( MACOSX_BUNDLE_GUI_IDENTIFIER "org.cryptonomex.${CPACK_BUNDLE_NAME}" )
SET( MACOSX_BUNDLE_ICON_FILE "bitshares.icns" )
SET( MACOSX_BUNDLE_INFO_STRING "Graphene v${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
SET( MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
SET( MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
SET( MACOSX_BUNDLE_BUNDLE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
SET( MACOSX_BUNDLE_COPYRIGHT "(C) 2014 Cryptonomex" )
# SET( MACOSX_BUNDLE_URL_HANDLER_NAME "${MACOSX_BUNDLE_GUI_IDENTIFIER}" )
# SET( MACOSX_BUNDLE_URL_HANDLER_SCHEME "${CUSTOM_URL_SCHEME}" )
# set_source_files_properties("images/bitshares.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
ENDIF()
add_executable( ${APP_NAME} WIN32 MACOSX_BUNDLE BlockChain.cpp main.cpp ${QML_QRC} ${WEB_QRC} ${QML})
target_link_libraries(${APP_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::WebEngine
graphene_chain graphene_egenesis_full graphene_utilities fc graphene_account_history graphene_market_history graphene_app )
#install( TARGETS
# ${APP_NAME}
# RUNTIME DESTINATION bin
# LIBRARY DESTINATION lib
# ARCHIVE DESTINATION lib
#)
ADD_CUSTOM_COMMAND(TARGET ${APP_NAME} POST_BUILD ${POST_BUILD_STEP_COMMANDS}
COMMENT "Copying binaries and other files into target directory."
)
ADD_CUSTOM_COMMAND(TARGET ${APP_NAME} PRE_BUILD ${PRE_BUILD_STEP_COMMANDS}
COMMENT "Copying static resource files to build directory."
)
include( DeployQt4 )
include( InstallRequiredSystemLibraries )
install( TARGETS ${APP_NAME} DESTINATION "." )
IF( APPLE )
set( CPACK_GENERATOR "DragNDrop" )
include( CPack )
set( PLUGINS "")
list( APPEND PLUGINS "${QT_PATH}/plugins/platforms/libqcocoa.dylib" )
list( APPEND PLUGINS "${QT_PATH}/plugins/imageformats/libqjpeg.dylib" )
install_qt4_executable( ${APP_NAME}.app "${PLUGINS}" )
ENDIF()

View file

@ -1,46 +0,0 @@
/*
* Copyright (c) 2015 Cryptonomex, Inc., and contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Any modified source or binaries are used only with the BitShares network.
*
* 2. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 3. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "BlockChain.hpp"
#include <fc/thread/thread.hpp>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QtWebEngine>
#include <QtQml>
int main(int argc, char *argv[])
{
fc::thread::current().set_name("main");
QGuiApplication app(argc, argv);
app.setApplicationName("GrapheneOct5");
app.setApplicationDisplayName(app.applicationName());
app.setOrganizationDomain("cryptonomex.org");
app.setOrganizationName("Cryptonomex, Inc.");
QtWebEngine::initialize();
qmlRegisterType<BlockChain>("Graphene.FullNode", 1, 0, "BlockChain");
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}

View file

@ -1 +0,0 @@
qml.qrc.depends

View file

@ -1,37 +0,0 @@
import QtQuick 2.5
import QtQuick.Window 2.2
import QtWebEngine 1.0
import Graphene.FullNode 1.0
Window {
id: window
width: Screen.width / 2
height: Screen.height / 2
visible: true
BlockChain {
id: blockChain
onStarted: {
var url = "qrc:/index.html#auth/" + webUsername + ":" + webPassword + ":" + rpcEndpoint
console.log("Loading %1 in web view".arg(url))
webView.url = url
}
}
Component.onCompleted: blockChain.start()
Rectangle { anchors.fill: parent; color: "#1F1F1F" }
Text {
font.pointSize: 20
anchors.centerIn: parent
text: qsTr("Loading...")
color: "white"
}
WebEngineView {
id: webView
visible: false
anchors.fill: parent
onLoadProgressChanged: if (loadProgress === 100) visible = true
onJavaScriptConsoleMessage: console.log(JSON.stringify(arguments))
}
}

View file

@ -1,6 +0,0 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1 +0,0 @@
module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\"/>"

View file

@ -1 +0,0 @@
module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\"/>"

View file

@ -1 +0,0 @@
module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\"/>"

View file

@ -1 +0,0 @@
module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\"/>"

View file

@ -1,19 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width"/>
<!--<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>-->
<title>Graphene UI</title>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<style>
body {background-color: #2a2a2a}
</style>
<link rel="stylesheet" href="app.css">
</head>
<body>
<main id="content"></main>
<script src="vendors.js" charset="utf-8"></script>
<script src="app.js" charset="utf-8"></script>
</body>
</html>

View file

@ -1,27 +0,0 @@
<RCC>
<qresource prefix="/">
<file>1.app.js</file>
<file>app.css</file>
<file>app.js</file>
<file>favicon.ico</file>
<file>fonts</file>
<file>fonts/Roboto-Bold.eot</file>
<file>fonts/Roboto-Bold.svg</file>
<file>fonts/Roboto-Bold.ttf</file>
<file>fonts/Roboto-Bold.woff</file>
<file>fonts/Roboto-Light.eot</file>
<file>fonts/Roboto-Light.svg</file>
<file>fonts/Roboto-Light.ttf</file>
<file>fonts/Roboto-Light.woff</file>
<file>fonts/Roboto-Regular.eot</file>
<file>fonts/Roboto-Regular.svg</file>
<file>fonts/Roboto-Regular.ttf</file>
<file>fonts/Roboto-Regular.woff</file>
<file>fonts/RobotoCondensed-Regular.eot</file>
<file>fonts/RobotoCondensed-Regular.svg</file>
<file>fonts/RobotoCondensed-Regular.ttf</file>
<file>fonts/RobotoCondensed-Regular.woff</file>
<file>index.html</file>
<file>vendors.js</file>
</qresource>
</RCC>