forked from Telodendria/Telodendria
parent
6e7f170768
commit
4b90800a2b
3 changed files with 25 additions and 4 deletions
|
@ -31,6 +31,8 @@ Matrix clients. (#35)
|
||||||
|
|
||||||
- Implemented `/_telodendria/admin/v1/deactivate/[localpart]` for admins to be able to
|
- Implemented `/_telodendria/admin/v1/deactivate/[localpart]` for admins to be able to
|
||||||
deactivate users.
|
deactivate users.
|
||||||
|
- Added a **PUT** option to `/_telodendria/admin/v1/config` that gives the ability to change
|
||||||
|
only a subset of the configuration.
|
||||||
- Moved all administrator API endpoints to `/_telodendria/admin/v1`, because later revisions
|
- Moved all administrator API endpoints to `/_telodendria/admin/v1`, because later revisions
|
||||||
of the administrator API may break clients, so we want a way to give those breaking revisions
|
of the administrator API may break clients, so we want a way to give those breaking revisions
|
||||||
new endpoints.
|
new endpoints.
|
||||||
|
|
|
@ -4,7 +4,7 @@ As mentioned in [Setup](../setup.md), Telodendria's configuration is
|
||||||
intended to be managed via the configuration API. Consult the
|
intended to be managed via the configuration API. Consult the
|
||||||
[Configuration](../config.md) document for a complete list of supported
|
[Configuration](../config.md) document for a complete list of supported
|
||||||
configuration options. This document simply describes the API used to
|
configuration options. This document simply describes the API used to
|
||||||
update the configuration.
|
update the configuration described in that document.
|
||||||
|
|
||||||
## API Endpoints
|
## API Endpoints
|
||||||
|
|
||||||
|
@ -40,3 +40,23 @@ configuration with the new one.
|
||||||
|-------|------|-------------|
|
|-------|------|-------------|
|
||||||
| `restart_required` | `Boolean` | Whether or not the process needs to be restarted to finish applying the configuration. If this is `true`, then the restart endpoint should be used at a convenient time to apply the configuration.
|
| `restart_required` | `Boolean` | Whether or not the process needs to be restarted to finish applying the configuration. If this is `true`, then the restart endpoint should be used at a convenient time to apply the configuration.
|
||||||
|
|
||||||
|
### **PUT** `/_telodendria/admin/config`
|
||||||
|
|
||||||
|
Update the currently installed configuration instead of completely replacing it. This endpoint
|
||||||
|
validates the request body, merges it on top of the current configuration, validates the resulting
|
||||||
|
configuration, then updates it in the database. This is useful when only one or two properties
|
||||||
|
in the configuration needs to be changed.
|
||||||
|
|
||||||
|
| Requires Token | Rate Limited |
|
||||||
|
|----------------|--------------|
|
||||||
|
| Yes | Yes |
|
||||||
|
|
||||||
|
| Response Code | Description |
|
||||||
|
|---------------|-------------|
|
||||||
|
| 200 | The new configuration was successfully installed.|
|
||||||
|
|
||||||
|
#### 200 Response Format
|
||||||
|
|
||||||
|
| Field | Type | Description |
|
||||||
|
|-------|------|-------------|
|
||||||
|
| `restart_required` | `Boolean` | Whether or not the process needs to be restarted to finish applying the configuration. If this is `true`, then the restart endpoint should be used at a convenient time to apply the configuration.
|
||||||
|
|
|
@ -135,8 +135,6 @@ ROUTE_IMPL(RouteConfig, path, argp)
|
||||||
|
|
||||||
newConf = ConfigParse(newJson);
|
newConf = ConfigParse(newJson);
|
||||||
|
|
||||||
/* TODO: Don't leak newJson. */
|
|
||||||
|
|
||||||
if (!newConf)
|
if (!newConf)
|
||||||
{
|
{
|
||||||
HttpResponseStatus(args->context, HTTP_INTERNAL_SERVER_ERROR);
|
HttpResponseStatus(args->context, HTTP_INTERNAL_SERVER_ERROR);
|
||||||
|
@ -169,10 +167,11 @@ ROUTE_IMPL(RouteConfig, path, argp)
|
||||||
|
|
||||||
ConfigFree(newConf);
|
ConfigFree(newConf);
|
||||||
JsonFree(request);
|
JsonFree(request);
|
||||||
|
JsonFree(newJson);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
HttpResponseStatus(args->context, HTTP_BAD_REQUEST);
|
HttpResponseStatus(args->context, HTTP_BAD_REQUEST);
|
||||||
response = MatrixErrorCreate(M_UNRECOGNIZED, NULL);
|
response = MatrixErrorCreate(M_UNRECOGNIZED, "Unknown request method.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue