mirror of
https://github.com/matrix-construct/construct
synced 2024-11-04 21:08:57 +01:00
modules/console: Add eval option to fed auth cmd.
This commit is contained in:
parent
898f7980f6
commit
782635146b
1 changed files with 23 additions and 3 deletions
|
@ -14433,7 +14433,7 @@ console_cmd__fed__auth(opt &out, const string_view &line)
|
||||||
{
|
{
|
||||||
const params param{line, " ",
|
const params param{line, " ",
|
||||||
{
|
{
|
||||||
"room_id", "event_id", "remote", "ids_only"
|
"room_id", "event_id", "remote", "op", "oparg"
|
||||||
}};
|
}};
|
||||||
|
|
||||||
const auto room_id
|
const auto room_id
|
||||||
|
@ -14453,7 +14453,7 @@ console_cmd__fed__auth(opt &out, const string_view &line)
|
||||||
|
|
||||||
const string_view &ids_only
|
const string_view &ids_only
|
||||||
{
|
{
|
||||||
param["ids_only"]
|
param["op"]
|
||||||
};
|
};
|
||||||
|
|
||||||
m::fed::event_auth::opts opts;
|
m::fed::event_auth::opts opts;
|
||||||
|
@ -14487,7 +14487,7 @@ console_cmd__fed__auth(opt &out, const string_view &line)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param["ids_only"] == "raw")
|
if(param["op"] == "raw")
|
||||||
{
|
{
|
||||||
for(const string_view &event : auth_chain)
|
for(const string_view &event : auth_chain)
|
||||||
out << event << std::endl;
|
out << event << std::endl;
|
||||||
|
@ -14495,6 +14495,26 @@ console_cmd__fed__auth(opt &out, const string_view &line)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(param["op"] == "eval")
|
||||||
|
{
|
||||||
|
m::vm::opts vmopts;
|
||||||
|
vmopts.node_id = opts.remote;
|
||||||
|
vmopts.nothrows = -1;
|
||||||
|
vmopts.room_head = false;
|
||||||
|
vmopts.room_head_resolve = true;
|
||||||
|
vmopts.phase.set(m::vm::phase::FETCH_PREV, false);
|
||||||
|
vmopts.phase.set(m::vm::phase::FETCH_STATE, false);
|
||||||
|
vmopts.notify_servers = false;
|
||||||
|
vmopts.auth = !has(param["oparg"], "noauth");
|
||||||
|
vmopts.replays = has(param["oparg"], "replay");
|
||||||
|
m::vm::eval eval
|
||||||
|
{
|
||||||
|
auth_chain, vmopts
|
||||||
|
};
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<m::event> events(size(auth_chain));
|
std::vector<m::event> events(size(auth_chain));
|
||||||
std::transform(begin(auth_chain), end(auth_chain), begin(events), []
|
std::transform(begin(auth_chain), end(auth_chain), begin(events), []
|
||||||
(const json::object &event) -> m::event
|
(const json::object &event) -> m::event
|
||||||
|
|
Loading…
Reference in a new issue