From 5f0b98e5d14ebebf728575297ffa4037e16821fd Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 25 Apr 2023 17:51:18 -0700 Subject: [PATCH] modules/console: Add well_known matrix client diagnostic. --- modules/console.cc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/modules/console.cc b/modules/console.cc index 3c6e8e1be..b3af90f96 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -18476,6 +18476,35 @@ console_cmd__well_known__matrix__server(opt &out, const string_view &line) return true; } +bool +console_cmd__well_known__matrix__client(opt &out, const string_view &line) +{ + const params param{line, " ", + { + "remote" + }}; + + const fmt::bsprintf<512> url + { + "https://%s/.well-known/matrix/client", + param.at("remote"), + }; + + char buf[1024]; + const json::object response + { + rest::get + { + buf, string_view{url} + } + }; + + out + << string_view{response} + << std::endl; + return true; +} + // // bridge //