mirror of
https://github.com/matrix-construct/construct
synced 2024-12-24 14:34:00 +01:00
modules/admin: Stub GET /federation.
This commit is contained in:
parent
fe1dfbce9b
commit
4abe844c72
3 changed files with 80 additions and 0 deletions
|
@ -182,6 +182,7 @@ ircd::m::module_names
|
|||
"admin_users",
|
||||
"admin_deactivate",
|
||||
"admin_server_version",
|
||||
"admin_federation",
|
||||
};
|
||||
|
||||
/// This is a list of modules that are considered "optional" and any loading
|
||||
|
|
|
@ -561,11 +561,13 @@ admin_moduledir = @moduledir@
|
|||
admin_admin_users_la_SOURCES = admin/users.cc
|
||||
admin_admin_deactivate_la_SOURCES = admin/deactivate.cc
|
||||
admin_admin_server_version_la_SOURCES = admin/server_version.cc
|
||||
admin_admin_federation_la_SOURCES = admin/federation.cc
|
||||
|
||||
admin_module_LTLIBRARIES = \
|
||||
admin/admin_users.la \
|
||||
admin/admin_deactivate.la \
|
||||
admin/admin_server_version.la \
|
||||
admin/admin_federation.la \
|
||||
###
|
||||
|
||||
###############################################################################
|
||||
|
|
77
modules/admin/federation.cc
Normal file
77
modules/admin/federation.cc
Normal file
|
@ -0,0 +1,77 @@
|
|||
// The Construct
|
||||
//
|
||||
// Copyright (C) The Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2023 Jason Volk <jason@zemos.net>
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice is present in all copies. The
|
||||
// full license for this software is available in the LICENSE file.
|
||||
|
||||
namespace ircd::m::admin
|
||||
{
|
||||
static resource::response handle_get_destinations(client &, const resource::request &);
|
||||
static resource::response handle_get(client &, const resource::request &);
|
||||
|
||||
extern resource::method get_method;
|
||||
extern resource federation_resource;
|
||||
};
|
||||
|
||||
ircd::mapi::header
|
||||
IRCD_MODULE
|
||||
{
|
||||
"Admin (undocumented) :Federation"
|
||||
};
|
||||
|
||||
decltype(ircd::m::admin::federation_resource)
|
||||
ircd::m::admin::federation_resource
|
||||
{
|
||||
"/_synapse/admin/v1/federation/",
|
||||
{
|
||||
"(undocumented) Admin Federation",
|
||||
resource::DIRECTORY
|
||||
}
|
||||
};
|
||||
|
||||
decltype(ircd::m::admin::get_method)
|
||||
ircd::m::admin::get_method
|
||||
{
|
||||
federation_resource, "GET", handle_get,
|
||||
{
|
||||
get_method.REQUIRES_OPER
|
||||
}
|
||||
};
|
||||
|
||||
ircd::m::resource::response
|
||||
ircd::m::admin::handle_get(client &client,
|
||||
const resource::request &request)
|
||||
{
|
||||
if(request.parv.size() < 1)
|
||||
throw m::NEED_MORE_PARAMS
|
||||
{
|
||||
"Command path parameter required"
|
||||
};
|
||||
|
||||
const auto &cmd
|
||||
{
|
||||
request.parv[0]
|
||||
};
|
||||
|
||||
if(cmd == "destinations")
|
||||
return handle_get_destinations(client, request);
|
||||
|
||||
throw m::NOT_FOUND
|
||||
{
|
||||
"/admin/federation command not found"
|
||||
};
|
||||
}
|
||||
|
||||
ircd::m::resource::response
|
||||
ircd::m::admin::handle_get_destinations(client &client,
|
||||
const resource::request &request)
|
||||
{
|
||||
return resource::response
|
||||
{
|
||||
client, http::NOT_IMPLEMENTED
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue