From 582c79b6089227de421ca56031f19050aa02b24f Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Sat, 4 Nov 2023 15:28:20 -0400 Subject: [PATCH 1/8] Schema are now generated out-of-tree. Closes #40. --- configure | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/configure b/configure index 2dc0aec..c7887e0 100755 --- a/configure +++ b/configure @@ -14,7 +14,7 @@ INCLUDE="src/include" TOOLS="tools/src" SCHEMA="Schema" -CFLAGS="-Wall -Wextra -pedantic -std=c89 -O3 -pipe -D_DEFAULT_SOURCE -I${INCLUDE}" +CFLAGS="-Wall -Wextra -pedantic -std=c89 -O3 -pipe -D_DEFAULT_SOURCE -I${INCLUDE} -I${BUILD}" LIBS="-lm -pthread -lCytoplasm" @@ -112,8 +112,10 @@ compile_obj() { src="$1" obj="$2" - pref=$(cc -I${INCLUDE} -MM -MT "${obj}" "${src}") - echo "$pref $(collect ${SCHEMA}/ .json .h ${INCLUDE}/Schema/ print_obj)" + # TODO: Add a --cc flag to set the C compiler to use for + # Makefile generation. + pref=$(cc -I${INCLUDE} -I${BUILD} -MM -MT "${obj}" "${src}") + echo "$pref $(collect ${SCHEMA}/ .json .h ${BUILD}/Schema/ print_obj)" echo "${TAB}@mkdir -p $(dirname ${obj})" echo "${TAB}\$(CC) \$(CFLAGS) -fPIC -c -o \"${obj}\" \"${src}\"" } @@ -153,13 +155,19 @@ compile_schema() { src="$1" out="$2" - echo "${INCLUDE}/Schema/${out}.h:" - echo "${TAB}@mkdir -p ${INCLUDE}/Schema ${SRC}/Schema" - echo "${TAB}j2s -s \"${src}\" -h \"${INCLUDE}/Schema/${out}.h\" -c \"${SRC}/Schema/${out}.c\"" + obj="${BUILD}/Schema/${out}.o" - echo "${SRC}/Schema/${out}.c:" - echo "${TAB}@mkdir -p ${INCLUDE}/Schema ${SRC}/Schema" - echo "${TAB}j2s -s \"${src}\" -h \"${INCLUDE}/Schema/${out}.h\" -c \"${SRC}/Schema/${out}.c\"" + echo "${BUILD}/Schema/${out}.h:" + echo "${TAB}@mkdir -p ${BUILD}/Schema" + echo "${TAB}j2s -s \"${src}\" -h \"${BUILD}/Schema/${out}.h\" -c \"${BUILD}/Schema/${out}.c\"" + + echo "${BUILD}/Schema/${out}.c:" + echo "${TAB}@mkdir -p ${BUILD}/Schema" + echo "${TAB}j2s -s \"${src}\" -h \"${BUILD}/Schema/${out}.h\" -c \"${BUILD}/Schema/${out}.c\"" + + echo "${obj}: ${src} ${BUILD}/Schema/${out}.c" + echo "${TAB}@mkdir -p ${BUILD}/Schema" + echo "${TAB}\$(CC) \$(CFLAGS) -fPIC -c -o \"${obj}\" \"${BUILD}/Schema/${out}.c\"" } install_out() { @@ -185,15 +193,9 @@ uninstall_out() { echo "Generating Makefile..." -OBJS=$(collect ${SRC}/ .c .o ${BUILD}/ print_obj) +OBJS="$(collect ${SRC}/ .c .o ${BUILD}/ print_obj) $(collect ${SCHEMA}/ .json .o ${BUILD}/Schema/ print_obj)" TAB=$(printf '\t') -# If objects don't include the schema (this is the first configure), -# then include them manually. -if ! echo "${OBJS}" | grep "Schema" > /dev/null; then - OBJS="${OBJS} $(collect ${SCHEMA}/ .json .o ${BUILD}/Schema/ print_obj)" -fi - cat << EOF > Makefile .POSIX: From 1f02f3c2a290992d951ae9d83081cab9bc333c13 Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Sat, 4 Nov 2023 15:56:57 -0400 Subject: [PATCH 2/8] Allow customization of compiler in configure. --- configure | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/configure b/configure index c7887e0..966eaf9 100755 --- a/configure +++ b/configure @@ -19,7 +19,7 @@ LIBS="-lm -pthread -lCytoplasm" # Set default args for all platforms -SCRIPT_ARGS="--prefix=/usr/local --enable-ld-extra --bin-name=telodendria --version=0.4.0 --static $@" +SCRIPT_ARGS="--cc=cc --prefix=/usr/local --enable-ld-extra --bin-name=telodendria --version=0.4.0 --static $@" echo "Processing options..." echo "Ran with arguments: $SCRIPT_ARGS" @@ -27,6 +27,9 @@ echo "Ran with arguments: $SCRIPT_ARGS" # Process all arguments for arg in $SCRIPT_ARGS; do case "$arg" in + --cc=*) + CC=$(echo "$arg" | cut -d '=' -f 2-) + ;; --prefix=*) PREFIX=$(echo "$arg" | cut -d '=' -f 2-) ;; @@ -60,7 +63,7 @@ for arg in $SCRIPT_ARGS; do STATIC="" ;; *) - echo "Invalid argument: $1" + echo "Invalid argument: $arg" exit 1 ;; esac @@ -112,9 +115,7 @@ compile_obj() { src="$1" obj="$2" - # TODO: Add a --cc flag to set the C compiler to use for - # Makefile generation. - pref=$(cc -I${INCLUDE} -I${BUILD} -MM -MT "${obj}" "${src}") + pref=$(${CC} -I${INCLUDE} -I${BUILD} -MM -MT "${obj}" "${src}") echo "$pref $(collect ${SCHEMA}/ .json .h ${BUILD}/Schema/ print_obj)" echo "${TAB}@mkdir -p $(dirname ${obj})" echo "${TAB}\$(CC) \$(CFLAGS) -fPIC -c -o \"${obj}\" \"${src}\"" @@ -202,7 +203,7 @@ cat << EOF > Makefile # Generated by '$0' on $(date). # This file should generally not be manually edited. -CC = cc +CC = ${CC} PREFIX = ${PREFIX} CFLAGS = ${CFLAGS} LDFLAGS = ${LDFLAGS} From 6e7f170768914cb238d647c1fc3c0ec98a6aa99c Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Mon, 6 Nov 2023 20:42:39 -0500 Subject: [PATCH 3/8] Start working on #15. --- src/Routes/RouteConfig.c | 50 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/src/Routes/RouteConfig.c b/src/Routes/RouteConfig.c index 26a471e..1a31bb9 100644 --- a/src/Routes/RouteConfig.c +++ b/src/Routes/RouteConfig.c @@ -39,6 +39,7 @@ ROUTE_IMPL(RouteConfig, path, argp) HashMap *request = NULL; Config *newConf; + HashMap *newJson = NULL; (void) path; @@ -121,7 +122,54 @@ ROUTE_IMPL(RouteConfig, path, argp) JsonFree(request); break; case HTTP_PUT: - /* TODO: Support incremental changes to the config */ + request = JsonDecode(HttpServerStream(args->context)); + if (!request) + { + HttpResponseStatus(args->context, HTTP_BAD_REQUEST); + response = MatrixErrorCreate(M_NOT_JSON, NULL); + break; + } + + newJson = JsonDuplicate(DbJson(config->ref)); + JsonMerge(newJson, request); + + newConf = ConfigParse(newJson); + + /* TODO: Don't leak newJson. */ + + if (!newConf) + { + HttpResponseStatus(args->context, HTTP_INTERNAL_SERVER_ERROR); + response = MatrixErrorCreate(M_UNKNOWN, NULL); + break; + } + + if (newConf->ok) + { + if (DbJsonSet(config->ref, newJson)) + { + response = HashMapCreate(); + /* + * TODO: Apply configuration and set this only if a main + * component was reconfigured, such as the listeners. + */ + HashMapSet(response, "restart_required", JsonValueBoolean(1)); + } + else + { + HttpResponseStatus(args->context, HTTP_INTERNAL_SERVER_ERROR); + response = MatrixErrorCreate(M_UNKNOWN, NULL); + } + } + else + { + HttpResponseStatus(args->context, HTTP_BAD_REQUEST); + response = MatrixErrorCreate(M_BAD_JSON, newConf->err); + } + + ConfigFree(newConf); + JsonFree(request); + break; default: HttpResponseStatus(args->context, HTTP_BAD_REQUEST); response = MatrixErrorCreate(M_UNRECOGNIZED, NULL); From 4b90800a2bb41a31fc788b3e3cb9619a5cb785a2 Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Tue, 7 Nov 2023 01:26:26 -0500 Subject: [PATCH 4/8] Fix leak in RouteConfig, update documentation. Closes #15. --- docs/CHANGELOG.md | 2 ++ docs/user/admin/config.md | 22 +++++++++++++++++++++- src/Routes/RouteConfig.c | 5 ++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index b9b7a3a..6e8015c 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -31,6 +31,8 @@ Matrix clients. (#35) - Implemented `/_telodendria/admin/v1/deactivate/[localpart]` for admins to be able to 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 of the administrator API may break clients, so we want a way to give those breaking revisions new endpoints. diff --git a/docs/user/admin/config.md b/docs/user/admin/config.md index 0466403..8394f7b 100644 --- a/docs/user/admin/config.md +++ b/docs/user/admin/config.md @@ -4,7 +4,7 @@ As mentioned in [Setup](../setup.md), Telodendria's configuration is intended to be managed via the configuration API. Consult the [Configuration](../config.md) document for a complete list of supported configuration options. This document simply describes the API used to -update the configuration. +update the configuration described in that document. ## 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. +### **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. diff --git a/src/Routes/RouteConfig.c b/src/Routes/RouteConfig.c index 1a31bb9..5f0c91e 100644 --- a/src/Routes/RouteConfig.c +++ b/src/Routes/RouteConfig.c @@ -135,8 +135,6 @@ ROUTE_IMPL(RouteConfig, path, argp) newConf = ConfigParse(newJson); - /* TODO: Don't leak newJson. */ - if (!newConf) { HttpResponseStatus(args->context, HTTP_INTERNAL_SERVER_ERROR); @@ -169,10 +167,11 @@ ROUTE_IMPL(RouteConfig, path, argp) ConfigFree(newConf); JsonFree(request); + JsonFree(newJson); break; default: HttpResponseStatus(args->context, HTTP_BAD_REQUEST); - response = MatrixErrorCreate(M_UNRECOGNIZED, NULL); + response = MatrixErrorCreate(M_UNRECOGNIZED, "Unknown request method."); break; } From edee1288d8fd9aae7e44721cbf9354c50a34ad29 Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Wed, 8 Nov 2023 09:45:49 -0500 Subject: [PATCH 5/8] Remove unused global variables. --- src/Main.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Main.c b/src/Main.c index ecba436..4b25c9e 100644 --- a/src/Main.c +++ b/src/Main.c @@ -128,10 +128,6 @@ start: httpServers = NULL; restart = 0; - /* For getopt() */ - opterr = 1; - optind = 1; - /* Local variables */ exit = EXIT_SUCCESS; flags = 0; From db4ae0408c8b18fd82ee64d3525a3923b0ecdfa8 Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Wed, 8 Nov 2023 11:21:20 -0500 Subject: [PATCH 6/8] Fix admin endpoint names in documentation --- docs/user/admin/config.md | 6 +++--- docs/user/admin/privileges.md | 8 ++++---- docs/user/admin/proc.md | 4 ++-- docs/user/admin/stats.md | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/user/admin/config.md b/docs/user/admin/config.md index 8394f7b..6c18a03 100644 --- a/docs/user/admin/config.md +++ b/docs/user/admin/config.md @@ -8,7 +8,7 @@ update the configuration described in that document. ## API Endpoints -### **GET** `/_telodendria/admin/config` +### **GET** `/_telodendria/admin/v1/config` Retrieve the current configuration. @@ -20,7 +20,7 @@ Retrieve the current configuration. |---------------|-------------| | 200 | The current configuration was successfully retrieved.| -### **POST** `/_telodendria/admin/config` +### **POST** `/_telodendria/admin/v1/config` Installs a new configuration. This endpoint validates the request body, ensuring it is a proper configuration, then it replaces the existing @@ -40,7 +40,7 @@ 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. -### **PUT** `/_telodendria/admin/config` +### **PUT** `/_telodendria/admin/v1/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 diff --git a/docs/user/admin/privileges.md b/docs/user/admin/privileges.md index 8bbf143..9a8da06 100644 --- a/docs/user/admin/privileges.md +++ b/docs/user/admin/privileges.md @@ -41,7 +41,7 @@ this privilege level. The following API endpoints are implemented for managing privileges. -### **GET** `/_telodendria/admin/privileges/[localpart]` +### **GET** `/_telodendria/admin/v1/privileges/[localpart]` Retrieve the permissions for a user. If the localpart is omitted, then retrieve the privileges for the user that owns the access token being @@ -62,7 +62,7 @@ used. Note that the owner of the access token must have the |-------|------|-------------| | `privileges` | `Array` | An array of privileges, as described above. The privileges are encoded as JSON strings.| -### **POST** `/_telodendria/admin/privileges/[localpart]` +### **POST** `/_telodendria/admin/v1/privileges/[localpart]` Update the privileges of a local user by replacing the privileges array with the one specified in the request. Like the **GET** version of this @@ -89,7 +89,7 @@ owns the access token. |-------|------|-------------| | `privileges` | `Array` | An array of privileges, as described above. The privileges are encoded as JSON strings.| -### **PUT** `/_telodendria/admin/privileges/[localpart]` +### **PUT** `/_telodendria/admin/v1/privileges/[localpart]` Update the privileges of a local user by adding the privileges specified in the request to the users existing privileges. @@ -114,7 +114,7 @@ specified in the request to the users existing privileges. |-------|------|-------------| | `privileges` | `Array` | An array of privileges, as described above. The privileges are encoded as JSON strings.| -### **DELETE** `/_telodendria/admin/privileges/[localpart]` +### **DELETE** `/_telodendria/admin/v1/privileges/[localpart]` Update the privileges of a local user by removing the privileges specified in the request from the user's existing privileges. diff --git a/docs/user/admin/proc.md b/docs/user/admin/proc.md index 4db33ec..e4ad3d0 100644 --- a/docs/user/admin/proc.md +++ b/docs/user/admin/proc.md @@ -5,7 +5,7 @@ administrator to manage the Telodendria process itself. ## API Endpoints -### **POST** `/_telodendria/admin/restart` +### **POST** `/_telodendria/admin/v1/restart` Restart the Telodendria daemon cleanly. This endpoint will respond immediately after signaling to the daemon that it should be restarted @@ -26,7 +26,7 @@ starts over. On success, this endpoint simply returns an empty JSON object. -### **POST** `/_telodendria/admin/shutdown` +### **POST** `/_telodendria/admin/v1/shutdown` Shut down the Telodendria process cleanly. This endpoint will respond immediately after signalling to the daemon that it should be shut diff --git a/docs/user/admin/stats.md b/docs/user/admin/stats.md index bbebb7f..dc951a8 100644 --- a/docs/user/admin/stats.md +++ b/docs/user/admin/stats.md @@ -5,7 +5,7 @@ information about how the server process is performing. ## API Endpoints -### **GET** `/_telodendria/admin/stats` +### **GET** `/_telodendria/admin/v1/stats` Retrieve basic statistics about the currently running Telodendria process. From 77800e4117bb26133dc6ce1e5ebf3da9f4c672f5 Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Wed, 8 Nov 2023 14:30:45 -0500 Subject: [PATCH 7/8] Housekeeping tasks with documentation and versioning. --- README.md | 23 +++++++++++----------- configure | 2 +- docs/CHANGELOG.md | 40 +++++++++++++++++++++++++------------- src/Routes/RouteVersions.c | 7 ++++++- 4 files changed, 44 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index f8efe63..003b8c7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -

-

Telodendria

+

Telodendria

Telodendria is an extremely powerful, yet lightweight and portable chat server designed to be easy to install and configure. Powered by @@ -12,7 +11,7 @@ hosting a complicated, high-maintenance homeserver or joining an existing homeserver for privacy or other reasons, then Telodendria might be for you. -> **Note:** Telodendria still in development. See [Status](#status). +!!!! **Note:** Telodendria still in development. See **Status** below. ## What is Matrix? @@ -64,12 +63,13 @@ incredibly outdated. Telodendria, on the other hand, aims to be stable. It should *just work* for long periods of time between upgrades, and you should never feel like Telodendria is going to change significantly between upgrades. +- **Well-Documented:** Telodendria places as much emphasis on documentation as on code, which means you can be sure that the documentation will always remain up-to-date, accurate, and most importantly, reasonably exhaustive. -[Read Technical Rationale →](docs/dev/rationale.md) +[Read Technical Rationale →](https://git.telodendria.io/Telodendria/Telodendria/src/branch/master/docs/dev/rationale.md) ## Get Started -Check out the [Documentation](docs/README.md) to get started with +Check out the [Documentation](https://git.telodendria.io/Telodendria/telodendria/src/branch/master/docs/README.md) to get started with Telodendria. ## Status @@ -79,13 +79,13 @@ not yet deliver on all of its promises. Currently, Telodendria is not ready for end-users yet. While it features very basic user authentication, it does not actually work as a chat server yet. -We are hoping to ship Telodendria `v0.4.0` by May of 2024. This +We are hoping to ship Telodendria `v1.7.0-alpha4` by May of 2024. This release should be usable for communication between **local users** only. Additional features, including federation with other Matrix homeservers will be added in future releases. -You can help speed up development by [sponsoring](#sponsorship) -Telodendria or [getting involved](docs/CONTRIBUTING.md). +You can help speed up development by **sponsoring** +Telodendria or [getting involved](https://git.telodendria.io/Telodendria/Telodendria/src/branch/master/docs/CONTRIBUTING.md). ## Sponsorship @@ -96,7 +96,7 @@ Telodendria's long-term success, please consider sponsoring the project. You can make a recurring donation to Telodendria using -[LiberaPay](https://bancino.net/Telodendria/donate). You can also make +[LiberaPay](https://liberapay.com/Telodendria/donate). You can also make one-time donations using [Stripe](https://donate.stripe.com/8wM29AfF5bRJc48eUU). If you would like to make a recurring donation larger than that allowed by @@ -108,7 +108,7 @@ LiberaPay, please contact Jordan Bancino over Matrix at While there are no set sponsorship tiers at this time, sponsoring Telodendria is a mutually beneficial relationship. Depending on the amount you donate, you can get your name, logo, and website links -on the [Sponsors](docs/SPONSORS.md) page, the project `README`, or the +on the [Sponsors](../sponsors) page, the project `README`, or the main website. ## License @@ -116,7 +116,7 @@ main website. All of the code and documentation for Telodendria is licensed under a modified MIT license. The MIT license is an extremely permissive license that has very few restrictions. Please consult the -[`LICENSE.txt`](LICENSE.txt) file for the actual license text. It is +[`LICENSE.txt`](https://git.telodendria.io/Telodendria/Telodendria/src/branch/master/LICENSE.txt) file for the actual license text. It is important to note that the Telodendria license text differs from the original MIT license in the following ways: @@ -133,4 +133,3 @@ to use the logo in any way as long as it represents or links to the official project. If Telodendria is forked, the logo must be removed completely from the project, and optionally replaced by a different one. - diff --git a/configure b/configure index 966eaf9..70e0aad 100755 --- a/configure +++ b/configure @@ -19,7 +19,7 @@ LIBS="-lm -pthread -lCytoplasm" # Set default args for all platforms -SCRIPT_ARGS="--cc=cc --prefix=/usr/local --enable-ld-extra --bin-name=telodendria --version=0.4.0 --static $@" +SCRIPT_ARGS="--cc=cc --prefix=/usr/local --enable-ld-extra --bin-name=telodendria --version=1.7.0-alpha4 --static $@" echo "Processing options..." echo "Ran with arguments: $SCRIPT_ARGS" diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 6e8015c..004aad1 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -5,12 +5,22 @@ It is intended to be updated with every commit that makes a user-facing change w reporting in the change log. As such, it changes frequently between releases. Final change log entries are published as [Releases](releases). -## v0.4.0 +## v1.7.0-alpha4 **Not Released Yet.** -This release brings filters, rooms, and events! The core of the Matrix protocol architecture -is not in place. +This release brings filters, rooms, and events! The core of the Matrix +protocol architecture is now in place. + +Note that the versioning scheme has changed from `v0.X.0` to +`v1.7.0-alphaX`. This is so that Telodendria releases correspond to the +Matrix specification that they implement, in accordance with +[this blog post](https://telodendria.io/blog/on-matrixs-release-cadence-and-state-resolution-v1). +This versioning scheme change does not indicate a drastic leap forward +in Telodendria's development—the `-alpha4` suffix indicates that +this is the 4th pre-release, with the target being a stable `v1.7.0`. +Note also that we still have a *long* way to go before we reach that +stable release. ### Matrix Specification @@ -21,21 +31,23 @@ The following endpoints were added: ### Bug Fixes & General Improvements -- Fixed a double-free in `RouteUserProfile()` that would cause errors with certain -Matrix clients. (#35) +- Fixed a double-free in `RouteUserProfile()` that would cause errors +with certain Matrix clients. (#35) - Improved compatibility with NetBSD on various platforms. -- Moved [Cytoplasm](/Telodendria/Cytoplasm) to its own repository. -- Use a `configure` script and `make` to build Telodendria instead of custom scripts. +- Moved [Cytoplasm](/Telodendria/Cytoplasm) to its own repository. It +will now be maintained separately and have its own releases as well. +- Use a `configure` script and `make` to build Telodendria instead of +custom scripts. ### New Features -- Implemented `/_telodendria/admin/v1/deactivate/[localpart]` for admins to be able to -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 -of the administrator API may break clients, so we want a way to give those breaking revisions -new endpoints. +- 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 new endpoints. +- Implemented `/_telodendria/admin/v1/deactivate/[localpart]` for admins +to be able to deactivate users. +- Added a **PUT** option to `/_telodendria/admin/v1/config` that gives +the ability to change only a subset of the configuration. ## v0.3.0 diff --git a/src/Routes/RouteVersions.c b/src/Routes/RouteVersions.c index c75321d..d4ff0a8 100644 --- a/src/Routes/RouteVersions.c +++ b/src/Routes/RouteVersions.c @@ -35,7 +35,12 @@ ROUTE_IMPL(RouteVersions, path, argp) (void) path; (void) argp; - ArrayAdd(versions, JsonValueString("v1.6")); +#define DECLARE_SPEC_VERSION(x) ArrayAdd(versions, JsonValueString(x)) + + DECLARE_SPEC_VERSION("v1.7"); + /* Declare additional spec version support here. */ + +#undef DECLARE_SPEC_VERSION HashMapSet(response, "versions", JsonValueArray(versions)); return response; From 503bfb610441c08988eea131d3f15e9a9acf6c2c Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Wed, 8 Nov 2023 15:17:27 -0500 Subject: [PATCH 8/8] Suppress warnings of unused variables. I will use them eventually when I implement all these functions. I'm probably going to start CI work here soon, so I don't want warnings showing up in the logs unless they're important. --- src/Filter.c | 2 ++ src/Room.c | 2 ++ src/Routes/RouteRoomAliases.c | 4 ++++ src/State.c | 2 ++ 4 files changed, 10 insertions(+) diff --git a/src/Filter.c b/src/Filter.c index b1e91bb..1ef4fed 100644 --- a/src/Filter.c +++ b/src/Filter.c @@ -28,5 +28,7 @@ HashMap * FilterApply(Filter * filter, HashMap * event) { + (void) filter; + (void) event; return NULL; } diff --git a/src/Room.c b/src/Room.c index c13441d..791c5d3 100644 --- a/src/Room.c +++ b/src/Room.c @@ -42,6 +42,8 @@ struct Room Room * RoomCreate(Db * db, RoomCreateRequest * req) { + (void) db; + (void) req; return NULL; } diff --git a/src/Routes/RouteRoomAliases.c b/src/Routes/RouteRoomAliases.c index ad288e6..44eadfe 100644 --- a/src/Routes/RouteRoomAliases.c +++ b/src/Routes/RouteRoomAliases.c @@ -37,6 +37,10 @@ ROUTE_IMPL(RouteRoomAliases, path, argp) Db *db = args->matrixArgs->db; DbRef *ref = NULL; + (void) roomId; + + /* TODO: Placeholder; remove. */ + goto finish; finish: DbUnlock(db, ref); JsonFree(request); diff --git a/src/State.c b/src/State.c index 7d2fe3a..66c69c0 100644 --- a/src/State.c +++ b/src/State.c @@ -33,12 +33,14 @@ static HashMap * StateResolveV1(Array * states) { + (void) states; return NULL; } static HashMap * StateResolveV2(Array * states) { + (void) states; return NULL; }