0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 15:04:10 +01:00

ircd:Ⓜ️:fed::event_auth: Use single endpoint w/ auth_chain_ids instead of state_ids.

This commit is contained in:
Jason Volk 2020-12-10 05:30:30 -08:00
parent 736a6d320c
commit 20204d5917
3 changed files with 11 additions and 3 deletions

View file

@ -42,5 +42,9 @@ struct ircd::m::fed::event_auth
struct ircd::m::fed::event_auth::opts
:request::opts
{
/// Receive fast auth_chain_ids from construct; or auth_chain from synapse.
bool ids {false};
/// Receive slower auth_chain_ids; supported by all servers.
bool ids_only {false};
};

View file

@ -573,9 +573,12 @@ ircd::m::fed::event_auth::event_auth(const m::room::id &room_id,
else
json::get<"uri"_>(opts.request) = fmt::sprintf
{
buf, "/_matrix/federation/v1/event_auth/%s/%s",
buf, "/_matrix/federation/v1/event_auth/%s/%s%s",
url::encode(ridbuf, room_id),
url::encode(eidbuf, event_id),
opts.ids?
"?auth_chain=0&auth_chain_ids=1"_sv:
string_view{},
};
consume(buf, size(json::get<"uri"_>(opts.request)));

View file

@ -15330,14 +15330,15 @@ console_cmd__fed__auth(opt &out, const string_view &line)
param.at(2, event_id.host())
};
const string_view &ids_only
const string_view &op
{
param["op"]
};
m::fed::event_auth::opts opts;
opts.remote = remote;
opts.ids_only = ids_only == "ids";
opts.ids = op == "ids";
opts.ids_only = op == "ids_only";
const unique_buffer<mutable_buffer> buf
{
16_KiB