From d45b6b9c46a2e3e4325a23b4ec66a562ff2a5639 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Wed, 13 Mar 2019 07:19:38 +0800 Subject: [PATCH 01/11] test content type html response https://github.com/moneroexamples/onion-monero-blockchain-explorer/issues/160#issuecomment-472205835 --- main.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 2a7e544..da87608 100644 --- a/main.cpp +++ b/main.cpp @@ -17,6 +17,15 @@ using namespace std; namespace myxmr { +struct htmlresponse: crow::response +{ + htmlresponse(string&& _body) + : crow::response {std::move(_body)} + { + add_header("Content-Type", "text/html; charset=utf-8"); + } +}; + struct jsonresponse: crow::response { jsonresponse(const nlohmann::json& _body) @@ -291,7 +300,8 @@ main(int ac, const char* av[]) CROW_ROUTE(app, "/") ([&]() { - return crow::response(xmrblocks.index2()); + //return crow::response(xmrblocks.index2()); + return myxmr::htmlresponse(xmrblocks.index2()); }); CROW_ROUTE(app, "/page/") From 73ed903effa596cf3aaac180e614c81be8bd2b1c Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Wed, 13 Mar 2019 08:55:05 +0800 Subject: [PATCH 02/11] add htmlresponse to other endpoints --- main.cpp | 123 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 78 insertions(+), 45 deletions(-) diff --git a/main.cpp b/main.cpp index da87608..93fca21 100644 --- a/main.cpp +++ b/main.cpp @@ -17,7 +17,7 @@ using namespace std; namespace myxmr { -struct htmlresponse: crow::response +struct htmlresponse: public crow::response { htmlresponse(string&& _body) : crow::response {std::move(_body)} @@ -26,7 +26,7 @@ struct htmlresponse: crow::response } }; -struct jsonresponse: crow::response +struct jsonresponse: public crow::response { jsonresponse(const nlohmann::json& _body) : crow::response {_body.dump()} @@ -191,12 +191,13 @@ main(int ac, const char* av[]) try { - mempool_info_timeout = boost::lexical_cast(*mempool_info_timeout_opt); + mempool_info_timeout = boost::lexical_cast( + *mempool_info_timeout_opt); } catch (boost::bad_lexical_cast &e) { - cout << "Cant cast " << (*mempool_info_timeout_opt) <<" into numbers. Using default values." - << endl; + cout << "Cant cast " << (*mempool_info_timeout_opt) + <<" into numbers. Using default values.\n"; } uint64_t mempool_refresh_time {10}; @@ -300,60 +301,68 @@ main(int ac, const char* av[]) CROW_ROUTE(app, "/") ([&]() { - //return crow::response(xmrblocks.index2()); return myxmr::htmlresponse(xmrblocks.index2()); }); CROW_ROUTE(app, "/page/") ([&](size_t page_no) { - return xmrblocks.index2(page_no); + return myxmr::htmlresponse(xmrblocks.index2(page_no)); }); CROW_ROUTE(app, "/block/") ([&](size_t block_height) { - return crow::response(xmrblocks.show_block(block_height)); + return myxmr::htmlresponse(xmrblocks.show_block(block_height)); }); CROW_ROUTE(app, "/block/") ([&](string block_hash) { - return crow::response(xmrblocks.show_block(remove_bad_chars(block_hash))); + return myxmr::htmlresponse( + xmrblocks.show_block(remove_bad_chars(block_hash))); }); CROW_ROUTE(app, "/tx/") ([&](string tx_hash) { - return crow::response(xmrblocks.show_tx(remove_bad_chars(tx_hash))); + return myxmr::htmlresponse( + xmrblocks.show_tx(remove_bad_chars(tx_hash))); }); if (enable_as_hex) { CROW_ROUTE(app, "/txhex/") ([&](string tx_hash) { - return crow::response(xmrblocks.show_tx_hex(remove_bad_chars(tx_hash))); + return crow::response( + xmrblocks.show_tx_hex(remove_bad_chars(tx_hash))); }); CROW_ROUTE(app, "/ringmembershex/") ([&](string tx_hash) { - return crow::response(xmrblocks.show_ringmembers_hex(remove_bad_chars(tx_hash))); + return crow::response( + xmrblocks.show_ringmembers_hex(remove_bad_chars(tx_hash))); }); CROW_ROUTE(app, "/blockhex/") ([&](size_t block_height) { - return crow::response(xmrblocks.show_block_hex(block_height, false)); + return crow::response( + xmrblocks.show_block_hex(block_height, false)); }); CROW_ROUTE(app, "/blockhexcomplete/") ([&](size_t block_height) { - return crow::response(xmrblocks.show_block_hex(block_height, true)); + return crow::response( + xmrblocks.show_block_hex(block_height, true)); }); // CROW_ROUTE(app, "/ringmemberstxhex/") // ([&](string tx_hash) { -// return crow::response(xmrblocks.show_ringmemberstx_hex(remove_bad_chars(tx_hash))); +// return crow::response( +// xmrblocks.show_ringmemberstx_hex(remove_bad_chars(tx_hash))); // }); CROW_ROUTE(app, "/ringmemberstxhex/") ([&](string tx_hash) { - return myxmr::jsonresponse {xmrblocks.show_ringmemberstx_jsonhex(remove_bad_chars(tx_hash))}; + return myxmr::jsonresponse { + xmrblocks.show_ringmemberstx_jsonhex( + remove_bad_chars(tx_hash))}; }); } @@ -361,11 +370,13 @@ main(int ac, const char* av[]) CROW_ROUTE(app, "/tx//") ([&](string tx_hash, uint16_t with_ring_signatures) { - return xmrblocks.show_tx(remove_bad_chars(tx_hash), with_ring_signatures); + return myxmr::htmlresponse( + xmrblocks.show_tx(remove_bad_chars(tx_hash), + with_ring_signatures)); }); CROW_ROUTE(app, "/myoutputs").methods("POST"_method) - ([&](const crow::request& req) + ([&](const crow::request& req) -> myxmr::htmlresponse { map post_body @@ -388,9 +399,12 @@ main(int ac, const char* av[]) string domain = get_domain(req); - return xmrblocks.show_my_outputs(tx_hash, xmr_address, + string response = xmrblocks.show_my_outputs( + tx_hash, xmr_address, viewkey, raw_tx_data, domain); + + return myxmr::htmlresponse(std::move(response)); }); CROW_ROUTE(app, "/myoutputs///") @@ -400,15 +414,17 @@ main(int ac, const char* av[]) string domain = get_domain(req); - return xmrblocks.show_my_outputs(remove_bad_chars(tx_hash), + return myxmr::htmlresponse(xmrblocks.show_my_outputs( + remove_bad_chars(tx_hash), remove_bad_chars(xmr_address), remove_bad_chars(viewkey), string {}, - domain); + domain)); }); CROW_ROUTE(app, "/prove").methods("POST"_method) - ([&](const crow::request& req) { + ([&](const crow::request& req) -> myxmr::htmlresponse + { map post_body = xmreg::parse_crow_post_data(req.body); @@ -431,41 +447,45 @@ main(int ac, const char* av[]) string domain = get_domain(req); - return xmrblocks.show_prove(tx_hash, + return myxmr::htmlresponse(xmrblocks.show_prove(tx_hash, xmr_address, tx_prv_key, raw_tx_data, - domain); + domain)); }); CROW_ROUTE(app, "/prove///") ([&](const crow::request& req, string tx_hash, - string xmr_address, string tx_prv_key) { + string xmr_address, string tx_prv_key) + { string domain = get_domain(req); - return xmrblocks.show_prove(remove_bad_chars(tx_hash), + return myxmr::htmlresponse(xmrblocks.show_prove( + remove_bad_chars(tx_hash), remove_bad_chars(xmr_address), remove_bad_chars(tx_prv_key), string {}, - domain); + domain)); }); if (enable_pusher) { CROW_ROUTE(app, "/rawtx") ([&]() { - return xmrblocks.show_rawtx(); + return myxmr::htmlresponse(xmrblocks.show_rawtx()); }); CROW_ROUTE(app, "/checkandpush").methods("POST"_method) - ([&](const crow::request& req) { + ([&](const crow::request& req) -> myxmr::htmlresponse + { map post_body = xmreg::parse_crow_post_data(req.body); - if (post_body.count("rawtxdata") == 0 || post_body.count("action") == 0) + if (post_body.count("rawtxdata") == 0 + || post_body.count("action") == 0) { return string("Raw tx data or action not provided"); } @@ -474,9 +494,11 @@ main(int ac, const char* av[]) string action = remove_bad_chars(post_body["action"]); if (action == "check") - return xmrblocks.show_checkrawtx(raw_tx_data, action); + return myxmr::htmlresponse( + xmrblocks.show_checkrawtx(raw_tx_data, action)); else if (action == "push") - return xmrblocks.show_pushrawtx(raw_tx_data, action); + return myxmr::htmlresponse( + xmrblocks.show_pushrawtx(raw_tx_data, action)); return string("Provided action is neither check nor push"); }); @@ -486,11 +508,12 @@ main(int ac, const char* av[]) { CROW_ROUTE(app, "/rawkeyimgs") ([&]() { - return xmrblocks.show_rawkeyimgs(); + return myxmr::htmlresponse(xmrblocks.show_rawkeyimgs()); }); CROW_ROUTE(app, "/checkrawkeyimgs").methods("POST"_method) - ([&](const crow::request& req) { + ([&](const crow::request& req) -> myxmr::htmlresponse + { map post_body = xmreg::parse_crow_post_data(req.body); @@ -508,7 +531,8 @@ main(int ac, const char* av[]) string raw_data = remove_bad_chars(post_body["rawkeyimgsdata"]); string viewkey = remove_bad_chars(post_body["viewkey"]); - return xmrblocks.show_checkrawkeyimgs(raw_data, viewkey); + return myxmr::htmlresponse( + xmrblocks.show_checkrawkeyimgs(raw_data, viewkey)); }); } @@ -517,11 +541,12 @@ main(int ac, const char* av[]) { CROW_ROUTE(app, "/rawoutputkeys") ([&]() { - return xmrblocks.show_rawoutputkeys(); + return myxmr::htmlresponse(xmrblocks.show_rawoutputkeys()); }); CROW_ROUTE(app, "/checkrawoutputkeys").methods("POST"_method) - ([&](const crow::request& req) { + ([&](const crow::request& req) -> myxmr::htmlresponse + { map post_body = xmreg::parse_crow_post_data(req.body); @@ -540,25 +565,29 @@ main(int ac, const char* av[]) string raw_data = remove_bad_chars(post_body["rawoutputkeysdata"]); string viewkey = remove_bad_chars(post_body["viewkey"]); - return xmrblocks.show_checkcheckrawoutput(raw_data, viewkey); + return myxmr::htmlresponse( + xmrblocks.show_checkcheckrawoutput(raw_data, viewkey)); }); } CROW_ROUTE(app, "/search").methods("GET"_method) ([&](const crow::request& req) { - return xmrblocks.search(remove_bad_chars(string(req.url_params.get("value")))); + return myxmr::htmlresponse( + xmrblocks.search( + remove_bad_chars( + string(req.url_params.get("value"))))); }); CROW_ROUTE(app, "/mempool") ([&]() { - return xmrblocks.mempool(true); + return myxmr::htmlresponse(xmrblocks.mempool(true)); }); // alias to "/mempool" CROW_ROUTE(app, "/txpool") ([&]() { - return xmrblocks.mempool(true); + return myxmr::htmlresponse(xmrblocks.mempool(true)); }); // CROW_ROUTE(app, "/altblocks") @@ -783,13 +812,16 @@ main(int ac, const char* av[]) try { - in_mempool_aswell = regex_search(req.raw_url, regex {"mempool=[01]"}) ? - boost::lexical_cast(req.url_params.get("mempool")) : + in_mempool_aswell = regex_search( + req.raw_url, regex {"mempool=[01]"}) ? + boost::lexical_cast( + req.url_params.get("mempool")) : false; } catch (const boost::bad_lexical_cast &e) { - cerr << "Cant parse tx_prove as bool. Using default value" << endl; + cerr << "Cant parse tx_prove as bool. Using default value" + << endl; } myxmr::jsonresponse r{xmrblocks.json_outputsblocks( @@ -826,7 +858,8 @@ main(int ac, const char* av[]) if (use_ssl) { cout << "Staring in ssl mode" << endl; - app.bindaddr(bindaddr).port(app_port).ssl_file(ssl_crt_file, ssl_key_file) + app.bindaddr(bindaddr).port(app_port).ssl_file( + ssl_crt_file, ssl_key_file) .multithreaded().run(); } else From 271addafac6d05595959108f6573c65592c1d867 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Sat, 16 Mar 2019 12:02:44 +0800 Subject: [PATCH 03/11] make it work with master and release-v0.13 branches --- .gitignore | 1 + README.md | 6 +-- src/page.h | 136 ++++++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 119 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 832ca90..9a098af 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ tests/ build/ cmake-build-debug/ +.ycm_extra_conf.py diff --git a/README.md b/README.md index 0bd0e40..8d4110c 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ Note: `devel` branch of the explorer follows `master` branch of the monero. ## Compilation on Ubuntu 16.04/18.04 -##### Compile latest Monero version (0.14.0.0) +##### Compile latest Monero version (0.14.0.2) Download and compile recent Monero into your home folder: @@ -106,8 +106,8 @@ sudo apt install git build-essential cmake libboost-all-dev miniupnpc libunbound # go to home folder cd ~ -# download monero sourced for branch release-v0.13 -git clone --recursive -b release-v0.13 https://github.com/monero-project/monero.git +# download monero sourced for master branch +git clone --recursive https://github.com/monero-project/monero.git cd monero/ diff --git a/src/page.h b/src/page.h index 42115ca..3f7d3d7 100644 --- a/src/page.h +++ b/src/page.h @@ -35,7 +35,7 @@ #include #include #include - +#include #define TMPL_DIR "./templates" @@ -103,6 +103,43 @@ struct tx_info_cache }; }; + +// helper to ignore any number of template parametrs +template using VoidT = void; + +// primary template; +template> +struct HasSpanInGetOutputKeyT: std::false_type +{}; + +//partial specialization (myy be SFINAEed away) +template +struct HasSpanInGetOutputKeyT< + T, + VoidT() + .get_output_key( + std::declval&>(), + std::declval&>(), + std::declval&>())) + >>: std::true_type +{}; + + +// primary template; +template> +struct OutputIndicesReturnVectOfVectT : std::false_type +{}; + +template +struct OutputIndicesReturnVectOfVectT< + T, + VoidT() + .get_tx_amount_output_indices( + uint64_t{}, size_t{}) + .front().front()) + >>: std::true_type +{}; + // indect overload of hash for tx_info_cache::key namespace std { @@ -466,7 +503,6 @@ page(MicroCore* _mcore, testnet = nettype == cryptonote::network_type::TESTNET; stagenet = nettype == cryptonote::network_type::STAGENET; - no_of_mempool_tx_of_frontpage = 25; // read template files for all the pages @@ -1720,9 +1756,12 @@ show_ringmembers_hex(string const& tx_hash_str) == false) continue; - core_storage->get_db().get_output_key(in_key.amount, - absolute_offsets, - mixin_outputs); + //core_storage->get_db().get_output_key(in_key.amount, + // absolute_offsets, + // mixin_outputs); + get_output_key(in_key.amount, + absolute_offsets, + mixin_outputs); } catch (OUTPUT_DNE const& e) { @@ -2008,10 +2047,14 @@ show_ringmemberstx_jsonhex(string const& tx_hash_str) in_key.amount, absolute_offsets, indices); // get mining ouput info - core_storage->get_db().get_output_key( - in_key.amount, - absolute_offsets, - mixin_outputs); + //core_storage->get_db().get_output_key( + //in_key.amount, + //absolute_offsets, + //mixin_outputs); + + get_output_key(in_key.amount, + absolute_offsets, + mixin_outputs); } catch (exception const& e) { @@ -2524,9 +2567,13 @@ show_my_outputs(string tx_hash_str, if (are_absolute_offsets_good(absolute_offsets, in_key) == false) continue; - core_storage->get_db().get_output_key(in_key.amount, - absolute_offsets, - mixin_outputs); + //core_storage->get_db().get_output_key(in_key.amount, + //absolute_offsets, + //mixin_outputs); + + get_output_key(in_key.amount, + absolute_offsets, + mixin_outputs); } catch (const OUTPUT_DNE& e) { @@ -4687,9 +4734,13 @@ json_transaction(string tx_hash_str) if (are_absolute_offsets_good(absolute_offsets, in_key) == false) continue; - core_storage->get_db().get_output_key(in_key.amount, - absolute_offsets, - outputs); + //core_storage->get_db().get_output_key(in_key.amount, + //absolute_offsets, + //outputs); + + get_output_key(in_key.amount, + absolute_offsets, + outputs); } catch (const OUTPUT_DNE &e) { @@ -6363,9 +6414,13 @@ construct_tx_context(transaction tx, uint16_t with_ring_signatures = 0) // offsets seems good, so try to get the outputs for the amount and // offsets given - core_storage->get_db().get_output_key(in_key.amount, - absolute_offsets, - outputs); + //core_storage->get_db().get_output_key(in_key.amount, + //absolute_offsets, + //outputs); + + get_output_key(in_key.amount, + absolute_offsets, + outputs); } catch (const std::exception& e) { @@ -6575,8 +6630,11 @@ construct_tx_context(transaction tx, uint16_t with_ring_signatures = 0) if (core_storage->get_db().tx_exists(txd.hash, tx_index)) { - out_amount_indices = core_storage->get_db() - .get_tx_amount_output_indices(tx_index); + //out_amount_indices = core_storage->get_db() + //.get_tx_amount_output_indices(tx_index).front(); + get_tx_amount_output_indices( + out_amount_indices, + tx_index); } else { @@ -7080,9 +7138,45 @@ add_js_files(mstch::map& context) }}; } +template +typename std::enable_if< + HasSpanInGetOutputKeyT::value, void>::type +get_output_key(uint64_t amount, Args&&... args) +{ + core_storage->get_db().get_output_key( + epee::span(&amount, 1), + std::forward(args)...); +} + +template +typename std::enable_if< + !HasSpanInGetOutputKeyT::value, void>::type +get_output_key(uint64_t amount, Args&&... args) +{ + core_storage->get_db().get_output_key( + amount, std::forward(args)...); +} + +template +typename std::enable_if< + !OutputIndicesReturnVectOfVectT::value, void>::type +get_tx_amount_output_indices(vector& out_amount_indices, Args&&... args) +{ + out_amount_indices = core_storage->get_db() + .get_tx_amount_output_indices(std::forward(args)...); +} + +template +typename std::enable_if< + OutputIndicesReturnVectOfVectT::value, void>::type +get_tx_amount_output_indices(vector& out_amount_indices, Args&&... args) +{ + out_amount_indices = core_storage->get_db() + .get_tx_amount_output_indices(std::forward(args)...).front(); +} + }; } - #endif //CROWXMR_PAGE_H From 221fdbf8a88e1aebd188b75e79c8ebaefa4e72d1 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Tue, 2 Apr 2019 07:44:06 +0800 Subject: [PATCH 04/11] Fix: no viable conversion from 'cryptonote::difficulty_type https://github.com/moneroexamples/onion-monero-blockchain-explorer/issues/173 --- src/page.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/page.h b/src/page.h index 3f7d3d7..4871481 100644 --- a/src/page.h +++ b/src/page.h @@ -1291,7 +1291,8 @@ show_block(uint64_t _blk_height) // initalise page tempate map with basic info about blockchain string blk_pow_hash_str = pod_to_hex(get_block_longhash(blk, _blk_height)); - uint64_t blk_difficulty = core_storage->get_db().get_block_difficulty(_blk_height); + uint64_t blk_difficulty = core_storage->get_db() + .get_block_difficulty(_blk_height).convert_to(); mstch::map context { {"testnet" , testnet}, From d57980fc11b85d983c3b10849db2643ad4d71b2d Mon Sep 17 00:00:00 2001 From: stoffu Date: Fri, 29 Mar 2019 10:21:33 +0900 Subject: [PATCH 05/11] support 128 bit difficulty type --- src/page.h | 6 +++--- src/templates/block.html | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/page.h b/src/page.h index 4871481..737e6fc 100644 --- a/src/page.h +++ b/src/page.h @@ -1291,8 +1291,7 @@ show_block(uint64_t _blk_height) // initalise page tempate map with basic info about blockchain string blk_pow_hash_str = pod_to_hex(get_block_longhash(blk, _blk_height)); - uint64_t blk_difficulty = core_storage->get_db() - .get_block_difficulty(_blk_height).convert_to(); + cryptonote::difficulty_type blk_difficulty = core_storage->get_db().get_block_difficulty(_blk_height); mstch::map context { {"testnet" , testnet}, @@ -1313,7 +1312,8 @@ show_block(uint64_t _blk_height) {"delta_time" , delta_time}, {"blk_nonce" , blk.nonce}, {"blk_pow_hash" , blk_pow_hash_str}, - {"blk_difficulty" , blk_difficulty}, + {"blk_difficulty_lo" , (blk_difficulty << 64 >> 64).convert_to()}, + {"blk_difficulty_hi" , (blk_difficulty >> 64).convert_to()}, {"age_format" , age.second}, {"major_ver" , std::to_string(blk.major_version)}, {"minor_ver" , std::to_string(blk.minor_version)}, diff --git a/src/templates/block.html b/src/templates/block.html index 680199f..844eef5 100644 --- a/src/templates/block.html +++ b/src/templates/block.html @@ -32,7 +32,7 @@ PoW hash:{{blk_pow_hash}} - Difficulty:{{blk_difficulty}} + Difficulty (hi64, lo64):{{blk_difficulty_hi}}, {{blk_difficulty_lo}} From bb3a14ffb5fef7b8c7c2265c0bcd307196098c17 Mon Sep 17 00:00:00 2001 From: stoffu Date: Fri, 5 Apr 2019 15:24:41 +0900 Subject: [PATCH 06/11] turn off SSL when connecting to the daemon --- src/rpccalls.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpccalls.cpp b/src/rpccalls.cpp index c5ec95f..2293274 100644 --- a/src/rpccalls.cpp +++ b/src/rpccalls.cpp @@ -21,7 +21,7 @@ rpccalls::rpccalls(string _deamon_url, m_http_client.set_server( deamon_url, - boost::optional{}); + boost::optional{}, epee::net_utils::ssl_support_t::e_ssl_support_disabled); } bool From 86dea806594c059e952de3d041f3a592fb221286 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Sun, 12 May 2019 15:03:51 +0800 Subject: [PATCH 07/11] disable favicon --- src/templates/header.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/templates/header.html b/src/templates/header.html index 7c53e54..8abd353 100644 --- a/src/templates/header.html +++ b/src/templates/header.html @@ -2,6 +2,7 @@ + {{#refresh}} From 7fca3a5df71cb3e4c6691f519cc16c94d0126e83 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Wed, 22 May 2019 10:38:35 +0800 Subject: [PATCH 08/11] add domain_url --- src/page.h | 5 +++-- src/templates/my_outputs.html | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/page.h b/src/page.h index 737e6fc..a148821 100644 --- a/src/page.h +++ b/src/page.h @@ -2332,8 +2332,8 @@ show_my_outputs(string tx_hash_str, string pid_str = pod_to_hex(txd.payment_id); string pid8_str = pod_to_hex(txd.payment_id8); - string shortcut_url = domain - + (tx_prove ? "/prove" : "/myoutputs") + string shortcut_url = tx_prove + ? string("/prove") : string("/myoutputs") + '/' + tx_hash_str + '/' + xmr_address_str + '/' + viewkey_str; @@ -2367,6 +2367,7 @@ show_my_outputs(string tx_hash_str, {"payment_id8" , pid8_str}, {"decrypted_payment_id8", string{}}, {"tx_prove" , tx_prove}, + {"domain_url" , domain}, {"shortcut_url" , shortcut_url} }; diff --git a/src/templates/my_outputs.html b/src/templates/my_outputs.html index 41c399a..ea46014 100644 --- a/src/templates/my_outputs.html +++ b/src/templates/my_outputs.html @@ -78,7 +78,7 @@ {{/found_our_outputs}}

- link to this page + link to this page

From 2e328397406a5a1db9205fd5f60e5b4e62713887 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Mon, 27 May 2019 11:38:46 +0800 Subject: [PATCH 09/11] concurrency option added --- main.cpp | 12 ++++++++++-- src/CmdLineOptions.cpp | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 93fca21..8e969b9 100644 --- a/main.cpp +++ b/main.cpp @@ -75,6 +75,7 @@ main(int ac, const char* av[]) auto enable_json_api_opt = opts.get_option("enable-json-api"); auto enable_as_hex_opt = opts.get_option("enable-as-hex"); auto enable_tx_cache_opt = opts.get_option("enable-tx-cache"); + auto concurrency_opt = opts.get_option("concurrency"); auto enable_block_cache_opt = opts.get_option("enable-block-cache"); auto show_cache_times_opt = opts.get_option("show-cache-times"); auto enable_emission_monitor_opt = opts.get_option("enable-emission-monitor"); @@ -865,10 +866,17 @@ main(int ac, const char* av[]) else { cout << "Staring in non-ssl mode" << endl; - app.bindaddr(bindaddr).port(app_port).multithreaded().run(); + if (*concurrency_opt == 0) + { + app.bindaddr(bindaddr).port(app_port).multithreaded().run(); + } + else + { + app.bindaddr(bindaddr).port(app_port) + .concurrency(*concurrency_opt).run(); + } } - if (enable_emission_monitor == true) { // finish Emission monitoring thread in a cotrolled manner. diff --git a/src/CmdLineOptions.cpp b/src/CmdLineOptions.cpp index 3ff85c4..7dc7d72 100644 --- a/src/CmdLineOptions.cpp +++ b/src/CmdLineOptions.cpp @@ -67,6 +67,8 @@ namespace xmreg "maximum time, in milliseconds, to wait for mempool data for the front page") ("mempool-refresh-time", value()->default_value("5"), "time, in seconds, for each refresh of mempool state") + ("concurrency,c", value()->default_value(0), + "number of threads handling http queries. Default is 0 which means it is based you on the cpu") ("bc-path,b", value(), "path to lmdb folder of the blockchain, e.g., ~/.bitmonero/lmdb") ("ssl-crt-file", value(), From b81ba5f14dc3d1d39f48e52acf802ab8ad984271 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Sun, 16 Jun 2019 08:45:16 +0800 Subject: [PATCH 10/11] updated to monero v0.14.1 --- README.md | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 8d4110c..5744530 100644 --- a/README.md +++ b/README.md @@ -93,30 +93,17 @@ Note: `devel` branch of the explorer follows `master` branch of the monero. ## Compilation on Ubuntu 16.04/18.04 -##### Compile latest Monero version (0.14.0.2) -Download and compile recent Monero into your home folder: +#### Monero download and compilation -```bash -# first install monero dependecines -sudo apt update +To download and compile recent Monero follow instructions +in the following link: -sudo apt install git build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libcurl4-openssl-dev libgtest-dev libreadline-dev libzmq3-dev libsodium-dev libhidapi-dev libhidapi-libusb0 - -# go to home folder -cd ~ - -# download monero sourced for master branch -git clone --recursive https://github.com/monero-project/monero.git - -cd monero/ - -USE_SINGLE_BUILDDIR=1 make -``` +https://github.com/moneroexamples/monero-compilation/blob/master/README.md ##### Compile and run the explorer -Once the Monero is compiles, the explorer can be downloaded and compiled +Once the Monero compiles, the explorer can be downloaded and compiled as follows: ```bash From fcc4eec0b7385d68ebbc16c6d5bfd3750b80591a Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Sun, 16 Jun 2019 08:45:38 +0800 Subject: [PATCH 11/11] Update README.md --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 5744530..6628d57 100644 --- a/README.md +++ b/README.md @@ -122,12 +122,6 @@ mkdir build && cd build # create the makefile cmake .. -# altearnatively can use: cmake -DMONERO_DIR=/path/to/monero_folder .. -# if monero is not in ~/monero -# -# also can build with ASAN (sanitizers), for example -# cmake -DSANITIZE_ADDRESS=On .. - # compile make ```