speed up all_in_one.js generation.

master
moneroexamples 7 years ago
parent d3120c73dc
commit e3c732eaa2

@ -551,22 +551,12 @@ main(int ac, const char* av[])
CROW_ROUTE(app, "/js/all_in_one.js") CROW_ROUTE(app, "/js/all_in_one.js")
([&](const crow::request& req) { ([&](const crow::request& req) {
// /js/all_in_one.js file does not exist. it is generated on the fly
string all_in_one = xmrblocks.get_js_file("jquery.min.js") + // from the above real files.
xmrblocks.get_js_file("crc32.js") + return xmrblocks.get_js_file("all_in_one.js");
xmrblocks.get_js_file("biginteger.js") +
xmrblocks.get_js_file("config.js") +
xmrblocks.get_js_file("nacl-fast-cn.js") +
xmrblocks.get_js_file("crypto.js") +
xmrblocks.get_js_file("base58.js") +
xmrblocks.get_js_file("cn_util.js") +
xmrblocks.get_js_file("sha3.js");
return all_in_one;
}); });
} } // if (enable_js)
if (enable_json_api) if (enable_json_api)
{ {
@ -738,7 +728,7 @@ main(int ac, const char* av[])
return r; return r;
}); });
} } // if (enable_json_api)
if (enable_autorefresh_option) if (enable_autorefresh_option)
{ {

@ -393,16 +393,25 @@ namespace xmreg
if (enable_js) { if (enable_js) {
// JavaScript files // JavaScript files
template_file["jquery.min.js"] = xmreg::read(JS_JQUERY); template_file["jquery.min.js"] = xmreg::read(JS_JQUERY);
template_file["crc32.js"] = xmreg::read(JS_CRC32); template_file["crc32.js"] = xmreg::read(JS_CRC32);
template_file["crypto.js"] = xmreg::read(JS_CRYPTO); template_file["crypto.js"] = xmreg::read(JS_CRYPTO);
template_file["cn_util.js"] = xmreg::read(JS_CNUTIL); template_file["cn_util.js"] = xmreg::read(JS_CNUTIL);
template_file["base58.js"] = xmreg::read(JS_BASE58); template_file["base58.js"] = xmreg::read(JS_BASE58);
template_file["nacl-fast-cn.js"] = xmreg::read(JS_NACLFAST); template_file["nacl-fast-cn.js"] = xmreg::read(JS_NACLFAST);
template_file["sha3.js"] = xmreg::read(JS_SHA3); template_file["sha3.js"] = xmreg::read(JS_SHA3);
template_file["config.js"] = xmreg::read(JS_CONFIG); template_file["config.js"] = xmreg::read(JS_CONFIG);
template_file["biginteger.js"] = xmreg::read(JS_BIGINT); template_file["biginteger.js"] = xmreg::read(JS_BIGINT);
template_file["all_in_one.js"] = template_file["jquery.min.js"] +
template_file["crc32.js"] +
template_file["biginteger.js"] +
template_file["config.js"] +
template_file["nacl-fast-cn.js"] +
template_file["crypto.js"] +
template_file["base58.js"] +
template_file["cn_util.js"] +
template_file["sha3.js"];
// need to set "testnet: false," flag to reflect // need to set "testnet: false," flag to reflect
// if we are running testnet or mainnet explorer // if we are running testnet or mainnet explorer
@ -425,6 +434,8 @@ namespace xmreg
js_html_files += "<script src=\"/js/cn_util.js\"></script>"; js_html_files += "<script src=\"/js/cn_util.js\"></script>";
js_html_files += "<script src=\"/js/sha3.js\"></script>"; js_html_files += "<script src=\"/js/sha3.js\"></script>";
// /js/all_in_one.js file does not exist. it is generated on the fly
// from the above real files.
js_html_files_all_in_one = "<script src=\"/js/all_in_one.js\"></script>"; js_html_files_all_in_one = "<script src=\"/js/all_in_one.js\"></script>";
} }

Loading…
Cancel
Save