Compare commits

..

No commits in common. "a8a9bc57c693424d323a6f8bce6d6f9e5342ed1b" and "9899aadcd2b194e9ea53f49245eb1ee3874b7c69" have entirely different histories.

14 changed files with 60 additions and 154 deletions

View file

@ -1,4 +1,5 @@
<h1 style="text-align: center;">Telodendria</h1> <p align="center"><img src="https://telodendria.io/assets/Telodendria-500x500.png"></p>
<h1 align="center">Telodendria</h1>
Telodendria is an extremely powerful, yet lightweight and portable Telodendria is an extremely powerful, yet lightweight and portable
chat server designed to be easy to install and configure. Powered by chat server designed to be easy to install and configure. Powered by
@ -11,7 +12,7 @@ hosting a complicated, high-maintenance homeserver or joining an
existing homeserver for privacy or other reasons, then Telodendria existing homeserver for privacy or other reasons, then Telodendria
might be for you. might be for you.
!!!! **Note:** Telodendria still in development. See **Status** below. > **Note:** Telodendria still in development. See [Status](#status).
## What is Matrix? ## What is Matrix?
@ -63,13 +64,12 @@ incredibly outdated. Telodendria, on the other hand, aims to be stable.
It should *just work* for long periods of time between upgrades, and It should *just work* for long periods of time between upgrades, and
you should never feel like Telodendria is going to change significantly you should never feel like Telodendria is going to change significantly
between upgrades. 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 &rightarrow;](https://git.telodendria.io/Telodendria/Telodendria/src/branch/master/docs/dev/rationale.md) [Read Technical Rationale &rightarrow;](docs/dev/rationale.md)
## Get Started ## Get Started
Check out the [Documentation](https://git.telodendria.io/Telodendria/telodendria/src/branch/master/docs/README.md) to get started with Check out the [Documentation](docs/README.md) to get started with
Telodendria. Telodendria.
## Status ## 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 ready for end-users yet. While it features very basic user
authentication, it does not actually work as a chat server yet. authentication, it does not actually work as a chat server yet.
We are hoping to ship Telodendria `v1.7.0-alpha4` by May of 2024. This We are hoping to ship Telodendria `v0.4.0` by May of 2024. This
release should be usable for communication between **local users** release should be usable for communication between **local users**
only. Additional features, including federation with other Matrix only. Additional features, including federation with other Matrix
homeservers will be added in future releases. homeservers will be added in future releases.
You can help speed up development by **sponsoring** You can help speed up development by [sponsoring](#sponsorship)
Telodendria or [getting involved](https://git.telodendria.io/Telodendria/Telodendria/src/branch/master/docs/CONTRIBUTING.md). Telodendria or [getting involved](docs/CONTRIBUTING.md).
## Sponsorship ## Sponsorship
@ -96,7 +96,7 @@ Telodendria's long-term success, please consider sponsoring the
project. project.
You can make a recurring donation to Telodendria using You can make a recurring donation to Telodendria using
[LiberaPay](https://liberapay.com/Telodendria/donate). You can also make [LiberaPay](https://bancino.net/Telodendria/donate). You can also make
one-time donations using one-time donations using
[Stripe](https://donate.stripe.com/8wM29AfF5bRJc48eUU). If you would [Stripe](https://donate.stripe.com/8wM29AfF5bRJc48eUU). If you would
like to make a recurring donation larger than that allowed by 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 While there are no set sponsorship tiers at this time, sponsoring
Telodendria is a mutually beneficial relationship. Depending on the Telodendria is a mutually beneficial relationship. Depending on the
amount you donate, you can get your name, logo, and website links amount you donate, you can get your name, logo, and website links
on the [Sponsors](../sponsors) page, the project `README`, or the on the [Sponsors](docs/SPONSORS.md) page, the project `README`, or the
main website. main website.
## License ## License
@ -116,7 +116,7 @@ main website.
All of the code and documentation for Telodendria is licensed under a All of the code and documentation for Telodendria is licensed under a
modified MIT license. The MIT license is an extremely permissive modified MIT license. The MIT license is an extremely permissive
license that has very few restrictions. Please consult the license that has very few restrictions. Please consult the
[`LICENSE.txt`](https://git.telodendria.io/Telodendria/Telodendria/src/branch/master/LICENSE.txt) file for the actual license text. It is [`LICENSE.txt`](LICENSE.txt) file for the actual license text. It is
important to note that the Telodendria license text differs from the important to note that the Telodendria license text differs from the
original MIT license in the following ways: original MIT license in the following ways:
@ -133,3 +133,4 @@ 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 official project. If Telodendria is forked, the logo must be removed
completely from the project, and optionally replaced by a different completely from the project, and optionally replaced by a different
one. one.

41
configure vendored
View file

@ -14,12 +14,12 @@ INCLUDE="src/include"
TOOLS="tools/src" TOOLS="tools/src"
SCHEMA="Schema" SCHEMA="Schema"
CFLAGS="-Wall -Wextra -pedantic -std=c89 -O3 -pipe -D_DEFAULT_SOURCE -I${INCLUDE} -I${BUILD}" CFLAGS="-Wall -Wextra -pedantic -std=c89 -O3 -pipe -D_DEFAULT_SOURCE -I${INCLUDE}"
LIBS="-lm -pthread -lCytoplasm" LIBS="-lm -pthread -lCytoplasm"
# Set default args for all platforms # Set default args for all platforms
SCRIPT_ARGS="--cc=cc --prefix=/usr/local --enable-ld-extra --bin-name=telodendria --version=1.7.0-alpha4 --static $@" SCRIPT_ARGS="--prefix=/usr/local --enable-ld-extra --bin-name=telodendria --version=0.4.0 --static $@"
echo "Processing options..." echo "Processing options..."
echo "Ran with arguments: $SCRIPT_ARGS" echo "Ran with arguments: $SCRIPT_ARGS"
@ -27,9 +27,6 @@ echo "Ran with arguments: $SCRIPT_ARGS"
# Process all arguments # Process all arguments
for arg in $SCRIPT_ARGS; do for arg in $SCRIPT_ARGS; do
case "$arg" in case "$arg" in
--cc=*)
CC=$(echo "$arg" | cut -d '=' -f 2-)
;;
--prefix=*) --prefix=*)
PREFIX=$(echo "$arg" | cut -d '=' -f 2-) PREFIX=$(echo "$arg" | cut -d '=' -f 2-)
;; ;;
@ -63,7 +60,7 @@ for arg in $SCRIPT_ARGS; do
STATIC="" STATIC=""
;; ;;
*) *)
echo "Invalid argument: $arg" echo "Invalid argument: $1"
exit 1 exit 1
;; ;;
esac esac
@ -115,8 +112,8 @@ compile_obj() {
src="$1" src="$1"
obj="$2" obj="$2"
pref=$(${CC} -I${INCLUDE} -I${BUILD} -MM -MT "${obj}" "${src}") pref=$(cc -I${INCLUDE} -MM -MT "${obj}" "${src}")
echo "$pref $(collect ${SCHEMA}/ .json .h ${BUILD}/Schema/ print_obj)" echo "$pref $(collect ${SCHEMA}/ .json .h ${INCLUDE}/Schema/ print_obj)"
echo "${TAB}@mkdir -p $(dirname ${obj})" echo "${TAB}@mkdir -p $(dirname ${obj})"
echo "${TAB}\$(CC) \$(CFLAGS) -fPIC -c -o \"${obj}\" \"${src}\"" echo "${TAB}\$(CC) \$(CFLAGS) -fPIC -c -o \"${obj}\" \"${src}\""
} }
@ -156,19 +153,13 @@ compile_schema() {
src="$1" src="$1"
out="$2" out="$2"
obj="${BUILD}/Schema/${out}.o" 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\""
echo "${BUILD}/Schema/${out}.h:" echo "${SRC}/Schema/${out}.c:"
echo "${TAB}@mkdir -p ${BUILD}/Schema" echo "${TAB}@mkdir -p ${INCLUDE}/Schema ${SRC}/Schema"
echo "${TAB}j2s -s \"${src}\" -h \"${BUILD}/Schema/${out}.h\" -c \"${BUILD}/Schema/${out}.c\"" echo "${TAB}j2s -s \"${src}\" -h \"${INCLUDE}/Schema/${out}.h\" -c \"${SRC}/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() { install_out() {
@ -194,16 +185,22 @@ uninstall_out() {
echo "Generating Makefile..." echo "Generating Makefile..."
OBJS="$(collect ${SRC}/ .c .o ${BUILD}/ print_obj) $(collect ${SCHEMA}/ .json .o ${BUILD}/Schema/ print_obj)" OBJS=$(collect ${SRC}/ .c .o ${BUILD}/ print_obj)
TAB=$(printf '\t') 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 cat << EOF > Makefile
.POSIX: .POSIX:
# Generated by '$0' on $(date). # Generated by '$0' on $(date).
# This file should generally not be manually edited. # This file should generally not be manually edited.
CC = ${CC} CC = cc
PREFIX = ${PREFIX} PREFIX = ${PREFIX}
CFLAGS = ${CFLAGS} CFLAGS = ${CFLAGS}
LDFLAGS = ${LDFLAGS} LDFLAGS = ${LDFLAGS}

View file

@ -5,22 +5,12 @@ 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 reporting in the change log. As such, it changes frequently between releases. Final
change log entries are published as [Releases](releases). change log entries are published as [Releases](releases).
## v1.7.0-alpha4 ## v0.4.0
**Not Released Yet.** **Not Released Yet.**
This release brings filters, rooms, and events! The core of the Matrix This release brings filters, rooms, and events! The core of the Matrix protocol architecture
protocol architecture is now in place. is not 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&mdash;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 ### Matrix Specification
@ -31,23 +21,19 @@ The following endpoints were added:
### Bug Fixes & General Improvements ### Bug Fixes & General Improvements
- Fixed a double-free in `RouteUserProfile()` that would cause errors - Fixed a double-free in `RouteUserProfile()` that would cause errors with certain
with certain Matrix clients. (#35) Matrix clients. (#35)
- Improved compatibility with NetBSD on various platforms. - Improved compatibility with NetBSD on various platforms.
- Moved [Cytoplasm](/Telodendria/Cytoplasm) to its own repository. It - Moved [Cytoplasm](/Telodendria/Cytoplasm) to its own repository.
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.
- Use a `configure` script and `make` to build Telodendria instead of
custom scripts.
### New Features ### New Features
- Moved all administrator API endpoints to `/_telodendria/admin/v1`, - Implemented `/_telodendria/admin/v1/deactivate/[localpart]` for admins to be able to
because later revisions of the administrator API may break clients, so deactivate users.
we want a way to give those breaking revisions new endpoints. - Moved all administrator API endpoints to `/_telodendria/admin/v1`, because later revisions
- Implemented `/_telodendria/admin/v1/deactivate/[localpart]` for admins of the administrator API may break clients, so we want a way to give those breaking revisions
to be able to deactivate users. new endpoints.
- Added a **PUT** option to `/_telodendria/admin/v1/config` that gives
the ability to change only a subset of the configuration.
## v0.3.0 ## v0.3.0

View file

@ -4,11 +4,11 @@ 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 described in that document. update the configuration.
## API Endpoints ## API Endpoints
### **GET** `/_telodendria/admin/v1/config` ### **GET** `/_telodendria/admin/config`
Retrieve the current configuration. Retrieve the current configuration.
@ -20,7 +20,7 @@ Retrieve the current configuration.
|---------------|-------------| |---------------|-------------|
| 200 | The current configuration was successfully retrieved.| | 200 | The current configuration was successfully retrieved.|
### **POST** `/_telodendria/admin/v1/config` ### **POST** `/_telodendria/admin/config`
Installs a new configuration. This endpoint validates the request body, Installs a new configuration. This endpoint validates the request body,
ensuring it is a proper configuration, then it replaces the existing ensuring it is a proper configuration, then it replaces the existing
@ -40,23 +40,3 @@ 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/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
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.

View file

@ -41,7 +41,7 @@ this privilege level.
The following API endpoints are implemented for managing privileges. The following API endpoints are implemented for managing privileges.
### **GET** `/_telodendria/admin/v1/privileges/[localpart]` ### **GET** `/_telodendria/admin/privileges/[localpart]`
Retrieve the permissions for a user. If the localpart is omitted, then Retrieve the permissions for a user. If the localpart is omitted, then
retrieve the privileges for the user that owns the access token being 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.| | `privileges` | `Array` | An array of privileges, as described above. The privileges are encoded as JSON strings.|
### **POST** `/_telodendria/admin/v1/privileges/[localpart]` ### **POST** `/_telodendria/admin/privileges/[localpart]`
Update the privileges of a local user by replacing the privileges array 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 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.| | `privileges` | `Array` | An array of privileges, as described above. The privileges are encoded as JSON strings.|
### **PUT** `/_telodendria/admin/v1/privileges/[localpart]` ### **PUT** `/_telodendria/admin/privileges/[localpart]`
Update the privileges of a local user by adding the privileges Update the privileges of a local user by adding the privileges
specified in the request to the users existing 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.| | `privileges` | `Array` | An array of privileges, as described above. The privileges are encoded as JSON strings.|
### **DELETE** `/_telodendria/admin/v1/privileges/[localpart]` ### **DELETE** `/_telodendria/admin/privileges/[localpart]`
Update the privileges of a local user by removing the privileges Update the privileges of a local user by removing the privileges
specified in the request from the user's existing privileges. specified in the request from the user's existing privileges.

View file

@ -5,7 +5,7 @@ administrator to manage the Telodendria process itself.
## API Endpoints ## API Endpoints
### **POST** `/_telodendria/admin/v1/restart` ### **POST** `/_telodendria/admin/restart`
Restart the Telodendria daemon cleanly. This endpoint will respond Restart the Telodendria daemon cleanly. This endpoint will respond
immediately after signaling to the daemon that it should be restarted 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. On success, this endpoint simply returns an empty JSON object.
### **POST** `/_telodendria/admin/v1/shutdown` ### **POST** `/_telodendria/admin/shutdown`
Shut down the Telodendria process cleanly. This endpoint will respond Shut down the Telodendria process cleanly. This endpoint will respond
immediately after signalling to the daemon that it should be shut immediately after signalling to the daemon that it should be shut

View file

@ -5,7 +5,7 @@ information about how the server process is performing.
## API Endpoints ## API Endpoints
### **GET** `/_telodendria/admin/v1/stats` ### **GET** `/_telodendria/admin/stats`
Retrieve basic statistics about the currently running Telodendria Retrieve basic statistics about the currently running Telodendria
process. process.

View file

@ -28,7 +28,5 @@
HashMap * HashMap *
FilterApply(Filter * filter, HashMap * event) FilterApply(Filter * filter, HashMap * event)
{ {
(void) filter;
(void) event;
return NULL; return NULL;
} }

View file

@ -128,6 +128,10 @@ start:
httpServers = NULL; httpServers = NULL;
restart = 0; restart = 0;
/* For getopt() */
opterr = 1;
optind = 1;
/* Local variables */ /* Local variables */
exit = EXIT_SUCCESS; exit = EXIT_SUCCESS;
flags = 0; flags = 0;

View file

@ -42,8 +42,6 @@ struct Room
Room * Room *
RoomCreate(Db * db, RoomCreateRequest * req) RoomCreate(Db * db, RoomCreateRequest * req)
{ {
(void) db;
(void) req;
return NULL; return NULL;
} }

View file

@ -39,7 +39,6 @@ ROUTE_IMPL(RouteConfig, path, argp)
HashMap *request = NULL; HashMap *request = NULL;
Config *newConf; Config *newConf;
HashMap *newJson = NULL;
(void) path; (void) path;
@ -122,56 +121,10 @@ ROUTE_IMPL(RouteConfig, path, argp)
JsonFree(request); JsonFree(request);
break; break;
case HTTP_PUT: case HTTP_PUT:
request = JsonDecode(HttpServerStream(args->context)); /* TODO: Support incremental changes to the config */
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);
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);
JsonFree(newJson);
break;
default: default:
HttpResponseStatus(args->context, HTTP_BAD_REQUEST); HttpResponseStatus(args->context, HTTP_BAD_REQUEST);
response = MatrixErrorCreate(M_UNRECOGNIZED, "Unknown request method."); response = MatrixErrorCreate(M_UNRECOGNIZED, NULL);
break; break;
} }

View file

@ -37,10 +37,6 @@ ROUTE_IMPL(RouteRoomAliases, path, argp)
Db *db = args->matrixArgs->db; Db *db = args->matrixArgs->db;
DbRef *ref = NULL; DbRef *ref = NULL;
(void) roomId;
/* TODO: Placeholder; remove. */
goto finish;
finish: finish:
DbUnlock(db, ref); DbUnlock(db, ref);
JsonFree(request); JsonFree(request);

View file

@ -35,12 +35,7 @@ ROUTE_IMPL(RouteVersions, path, argp)
(void) path; (void) path;
(void) argp; (void) argp;
#define DECLARE_SPEC_VERSION(x) ArrayAdd(versions, JsonValueString(x)) ArrayAdd(versions, JsonValueString("v1.6"));
DECLARE_SPEC_VERSION("v1.7");
/* Declare additional spec version support here. */
#undef DECLARE_SPEC_VERSION
HashMapSet(response, "versions", JsonValueArray(versions)); HashMapSet(response, "versions", JsonValueArray(versions));
return response; return response;

View file

@ -33,14 +33,12 @@
static HashMap * static HashMap *
StateResolveV1(Array * states) StateResolveV1(Array * states)
{ {
(void) states;
return NULL; return NULL;
} }
static HashMap * static HashMap *
StateResolveV2(Array * states) StateResolveV2(Array * states)
{ {
(void) states;
return NULL; return NULL;
} }