mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
modules/console: Use pretty_detailed() for fed event cmd; minor reorg.
This commit is contained in:
parent
a507785f8f
commit
a8b02549db
1 changed files with 20 additions and 34 deletions
|
@ -13952,41 +13952,22 @@ console_cmd__fed__event(opt &out, const string_view &line)
|
||||||
request
|
request
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(has(op, "raw"))
|
||||||
|
{
|
||||||
|
out
|
||||||
|
<< string_view{response}
|
||||||
|
<< std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
m::event::id::buf _event_id;
|
m::event::id::buf _event_id;
|
||||||
const m::event event
|
const m::event event
|
||||||
{
|
{
|
||||||
_event_id, response
|
_event_id, response
|
||||||
};
|
};
|
||||||
|
|
||||||
out << pretty(event) << std::endl;
|
if(has(op, "eval"))
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
if(!verify(event))
|
|
||||||
out << "- SIGNATURE FAILED" << std::endl;
|
|
||||||
}
|
|
||||||
catch(const std::exception &e)
|
|
||||||
{
|
|
||||||
out << "- SIGNATURE FAILED: " << e.what() << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!verify_hash(event))
|
|
||||||
out << "- HASH MISMATCH: " << b64encode_unpadded(hash(event)) << std::endl;
|
|
||||||
|
|
||||||
const m::event::conforms conforms
|
|
||||||
{
|
|
||||||
event
|
|
||||||
};
|
|
||||||
|
|
||||||
if(!conforms.clean())
|
|
||||||
out << "- " << conforms << std::endl;
|
|
||||||
|
|
||||||
if(has(op, "raw"))
|
|
||||||
out << string_view{response} << std::endl;
|
|
||||||
|
|
||||||
if(!has(op, "eval"))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
m::vm::opts vmopts;
|
m::vm::opts vmopts;
|
||||||
vmopts.fetch_prev = has(op, "prev");
|
vmopts.fetch_prev = has(op, "prev");
|
||||||
vmopts.fetch_state = false;
|
vmopts.fetch_state = false;
|
||||||
|
@ -13996,6 +13977,11 @@ console_cmd__fed__event(opt &out, const string_view &line)
|
||||||
event, vmopts
|
event, vmopts
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
m::pretty_detailed(out, event, 0UL);
|
||||||
|
out << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue