0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-28 09:42:37 +01:00

modules/console: Add raw override argument to fed user keys query and device cmds.

This commit is contained in:
Jason Volk 2023-04-25 15:13:27 -07:00
parent 55f332c821
commit e874e28473

View file

@ -17205,7 +17205,7 @@ console_cmd__fed__user__devices(opt &out, const string_view &line)
{
const params param{line, " ",
{
"user_id", "remote"
"user_id", "remote", "op"
}};
const m::user::id &user_id
@ -17218,6 +17218,11 @@ console_cmd__fed__user__devices(opt &out, const string_view &line)
param.at("remote", user_id.host())
};
const bool raw
{
has(param["op"], "raw")
};
m::fed::user::devices::opts opts;
opts.remote = remote;
@ -17242,6 +17247,14 @@ console_cmd__fed__user__devices(opt &out, const string_view &line)
request
};
if(raw)
{
out
<< string_view{response}
<< std::endl;
return true;
}
const string_view stream_id
{
unquote(response["stream_id"])
@ -17272,16 +17285,23 @@ console_cmd__fed__user__keys__query(opt &out, const string_view &line)
param.at("user_id")
};
const string_view &device_id
{
param.at("device_id", string_view{})
};
const string_view remote
{
param.at("remote", user_id.host())
};
const bool raw
{
param["device_id"] == "raw"
};
const string_view device_id
{
!raw?
param.at("device_id", string_view{}):
string_view{}
};
m::fed::user::opts opts;
opts.remote = remote;
@ -17306,6 +17326,14 @@ console_cmd__fed__user__keys__query(opt &out, const string_view &line)
request
};
if(raw)
{
out
<< string_view{response}
<< std::endl;
return true;
}
const json::object &device_keys
{
response["device_keys"]