small html changes

pull/5/head
moneroexamples 7 years ago
parent 378d3c9619
commit 7747198cba

@ -1,6 +1,6 @@
var config = {
apiUrl: "http://127.0.0.1:1984/",
testnet: false,
testnet: true,
coinUnitPlaces: 12,
txMinConfirms: 10, // corresponds to CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE in Monero
txCoinbaseMinConfirms: 60, // corresponds to CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW in Monero

@ -87,12 +87,11 @@
</div>
</div>
<div class="w-row" style="margin-bottom: 15px;" ng-show="showing_tx_detail(tx)">
<div class="w-col w-col-5">
<div class="w-col w-col-11">
<div class="transaction-detail" style="font-size: 10px;" ng-show="!tx_is_unlocked(tx)">
{{tx_locked_reason(tx)}}
</div>
</div>
<div class="w-col w-col-7">
<div class="transaction-detail transaction-page move-text-div">
<div class="transaction-address">
<span class="bold">Block no:</span> &nbsp;&nbsp;{{tx_is_mempool(tx) ? 'N/A (tx in mempool)' : tx.height}}

@ -103,12 +103,11 @@
</div>
</div>
<div class="w-row" ng-show="showing_tx_detail(tx)">
<div class="w-col w-col-5">
<div class="w-col w-col-11">
<div class="transaction-detail transaction-left" style="font-size: 10px;" ng-show="!tx_is_unlocked(tx)">
{{tx_locked_reason(tx)}}
</div>
</div>
<div class="w-col w-col-7">
<div class="transaction-detail transaction-page move-text-div">
<div class="transaction-address transaction-page">
<span class="bold">Block no:</span> &nbsp;&nbsp;{{tx_is_mempool(tx) ? 'N/A (tx in mempool)' : tx.height}}

@ -40,8 +40,11 @@ bool do_not_relay = *do_not_relay_opt;
string address_str = address_opt ? *address_opt : "";
string viewkey_str = viewkey_opt ? *viewkey_opt : "";
auto port_opt = opts.get_option<string>("port");
auto bc_path_opt = opts.get_option<string>("bc-path");
auto port_opt = opts.get_option<string>("port");
auto bc_path_opt = opts.get_option<string>("bc-path");
auto frontend_url_opt = opts.get_option<string>("frontend-url");
//cast port number in string to uint16
uint16_t app_port = boost::lexical_cast<uint16_t>(*port_opt);
@ -105,10 +108,13 @@ xmreg::CurrentBlockchainStatus::start_monitor_blockchain_thread();
// create REST JSON API services
xmreg::YourMoneroRequests::show_logs = true;
// Open Monero frontend url. Frontend url must match this value in
// server. Otherwise CORS problems between frontend and backend can occure
xmreg::YourMoneroRequests::frontend_url = *frontend_url_opt;
xmreg::YourMoneroRequests your_xmr(
shared_ptr<xmreg::MySqlAccounts>(new xmreg::MySqlAccounts{}));
auto login = your_xmr.make_resource(
&xmreg::YourMoneroRequests::login,
"/login");

@ -18,7 +18,7 @@ namespace xmreg
p.add("txhash", -1);
options_description desc(
"yourmonero, start YourMonare backend service");
"openmonero, start Open Monero backend service");
desc.add_options()
("help,h", value<bool>()->default_value(false)->implicit_value(true),
@ -38,7 +38,10 @@ namespace xmreg
("bc-path,b", value<string>(),
"path to lmdb blockchain")
("deamon-url,d", value<string>()->default_value("http:://127.0.0.1:18081"),
"monero address string");
"monero address string")
("frontend-url,u", value<string>()->default_value("http://127.0.0.1:81"),
"URl of the Open Monero frotnend.");
store(command_line_parser(acc, avv)
.options(desc)

@ -13,25 +13,6 @@ namespace xmreg
{
multimap<string, string>
make_headers(const multimap<string, string>& extra_headers)
{
multimap<string, string> headers {
{"Date", get_current_time()},
{"Access-Control-Allow-Origin", "http://127.0.0.1:81"},
{"access-control-allow-headers", "*, DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Set-Cookie"},
{"access-control-max-age", "86400, 1728000"},
{"access-control-allow-methods", "GET, POST, OPTIONS"},
{"access-control-allow-credentials", "true"},
{"Content-Type", "application/json"}
};
headers.insert(extra_headers.begin(), extra_headers.end());
return headers;
};
handel_::handel_(const fetch_func_t& callback):
request_callback {callback}
{}
@ -659,7 +640,7 @@ YourMoneroRequests::import_wallet_request(const shared_ptr< Session > session, c
string xmr_address = j_request["address"];
// a placeholder for exciting or new account data
// a placeholder for existing or new payment data
xmreg::XmrPayment xmr_payment;
json j_response;
@ -808,6 +789,28 @@ YourMoneroRequests::generic_options_handler( const shared_ptr< Session > session
});
}
multimap<string, string>
YourMoneroRequests::make_headers(const multimap<string, string>& extra_headers)
{
multimap<string, string> headers {
{"Date", get_current_time()},
{"Access-Control-Allow-Origin", frontend_url},
{"access-control-allow-headers", "*, DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Set-Cookie"},
{"access-control-max-age", "86400, 1728000"},
{"access-control-allow-methods", "GET, POST, OPTIONS"},
{"access-control-allow-credentials", "true"},
{"Content-Type", "application/json"}
};
headers.insert(extra_headers.begin(), extra_headers.end());
return headers;
};
void
YourMoneroRequests::print_json_log(const string& text, const json& j)
{
@ -836,8 +839,11 @@ YourMoneroRequests::get_current_blockchain_height()
}
// define static variables
bool YourMoneroRequests::show_logs = false;
// define defai;t static variables
bool YourMoneroRequests::show_logs {false};
string YourMoneroRequests::frontend_url {"http://127.0.0.1:81"};
string YourMoneroRequests::service_url {"http://localhost:1984"};
}

@ -22,11 +22,6 @@ using namespace restbed;
using namespace nlohmann;
string
get_current_time(const char* format = "%a, %d %b %Y %H:%M:%S %Z");
multimap<string, string>
make_headers(const multimap<string, string>& extra_headers = multimap<string, string>());
struct handel_
{
@ -51,6 +46,9 @@ public:
static bool show_logs;
static string frontend_url;
static string service_url;
YourMoneroRequests(shared_ptr<MySqlAccounts> _acc);
/**
@ -94,10 +92,12 @@ public:
static void
generic_options_handler( const shared_ptr< Session > session );
static multimap<string, string>
make_headers(const multimap<string, string>& extra_headers = multimap<string, string>());
static void
print_json_log(const string& text, const json& j);
static inline string
body_to_string(const Bytes & body);

@ -282,7 +282,7 @@ get_human_readable_timestamp(uint64_t ts);
string
get_current_time(const char* format);
get_current_time(const char* format = "%a, %d %b %Y %H:%M:%S %Z");
}

Loading…
Cancel
Save