0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

modules/console: Move crt to net listen crt.

modules/console: Move typing to user typing.

modules/console: Remove cruft.
This commit is contained in:
Jason Volk 2019-09-07 13:49:15 -07:00
parent 0a4cfc59be
commit 9e5a670b95

View file

@ -5367,6 +5367,59 @@ console_cmd__net__listen__unload(opt &out, const string_view &line)
return true;
}
bool
console_cmd__net__listen__crt(opt &out, const string_view &line)
{
const params param{line, " ",
{
"listener|path"
}};
string_view filename;
const string_view &targ
{
param.at("listener|path")
};
static mods::import<std::list<net::listener>> listeners
{
"m_listen", "listeners"
};
const auto &list{*listeners};
for(const auto &listener : list)
{
if(listener.name() != targ)
continue;
const json::object config
{
listener
};
filename = unquote(config.get("certificate_pem_path"));
}
if(!filename)
{
filename = targ;
return true;
}
const unique_buffer<mutable_buffer> buf
{
32_KiB
};
const std::string certfile
{
fs::read(filename)
};
out << openssl::printX509(buf, certfile, 0) << std::endl;
return true;
}
//
// client
//
@ -5599,59 +5652,6 @@ console_cmd__resource(opt &out, const string_view &line)
//
//
bool
console_cmd__crt(opt &out, const string_view &line)
{
const params param{line, " ",
{
"listener|path"
}};
string_view filename;
const string_view &targ
{
param.at("listener|path")
};
static mods::import<std::list<net::listener>> listeners
{
"m_listen", "listeners"
};
const auto &list{*listeners};
for(const auto &listener : list)
{
if(listener.name() != targ)
continue;
const json::object config
{
listener
};
filename = unquote(config.get("certificate_pem_path"));
}
if(!filename)
{
filename = targ;
return true;
}
const unique_buffer<mutable_buffer> buf
{
32_KiB
};
const std::string certfile
{
fs::read(filename)
};
out << openssl::printX509(buf, certfile, 0) << std::endl;
return true;
}
//
// key
//
@ -7369,17 +7369,6 @@ console_cmd__event__refs__auth(opt &out, const string_view &line)
// commit
//
bool
console_cmd__commit(opt &out, const string_view &line)
{
m::event event
{
json::object{line}
};
return true;
}
//
// eval
//
@ -11596,12 +11585,8 @@ console_cmd__users(opt &out, const string_view &line)
return true;
}
//
// typing
//
bool
console_cmd__typing(opt &out, const string_view &line)
console_cmd__user__typing(opt &out, const string_view &line)
{
m::typing::for_each([&out]
(const m::typing &event)