Telodendria v0.3.0 Pre-Release
2023-06-10 09:29:56 -04:00| 112 commits to master since this release
Introducing a new configuration API and Cytoplasm, a general-purpose C library that
supports source/sink-agnostic I/O, TLS, an HTTP client, and more! The third major
release of Telodendria packs a lot of architectural improvements on top of supporting
more of the Matrix specification.
Added support for the following endpoints:
There is also support for token-based user registration. Note that there is as of
yet no admin-facing way to create these registration tokens, but the APIs are in
- Added a new
HttpClientAPI for making HTTP requests. This will eventually be
used for federating with other Matrix homeservers.
- Added support for pretty-printing JSON in
Json. Telodendria itself does not
pretty-print JSON, but this is useful for debugging and building useful tools.
- Added a handful of new development tools built on the Telodendria APIs. New
http, a command line tool for making HTTP requests, similar to
json, a command line tool for working with JSON, similar to
http-debug-server, a simple HTTP server that just prints requests out to standard
output and returns an empty JSON object.
jsonare replacements for
jqthat build on the
JsonAPIs. They exist mainly
to test those APIs, but also to reduce the number of dependencies that Telodendria
http-debug-serverexists to test the
- Replaced all usage of
jqwith the new
jqis no longer a development
- Replaced all usage of
curlwith the new
curlis no longer a
required development dependency.
- Added a new
ttscript for easily making Matrix requests against Telodendria
- Added TLS support to both the HTTP client and server. Currently, Telodendria
supports LibreSSL and OpenSSL, but other TLS libraries should be extremely easy
to add support for.
- Added support for spinning up multiple HTTP servers. This is useful for having
a TLS port and a non-TLS port, for example.
- Moved all program configuration to the data directory and added an administrator
API endpoint to manage it. It is now no longer recommended to manually update the
configuration file. Consult the Administrator API documentation
and the Configuration documentation.
- Added an administrator API endpoint for process control. Telodendria can now be
restarted or shutdown via API endpoint.
- Added an administrator API endpoint for getting statistics about the running
- Added support for user privileges, a way to have fine-grained control over what
users are allowed to do with the administrator API. Administrator APIs for setting
and getting privileges is now supported, and registration tokens have privileges
associated with them so that users created with a token will automatically be given
the specified privileges.
Fixes & General Improvements
- Fixed a few warnings that were generated on some obscure compilers.
- Moved the
main()function to its own file to make it easier to link other
programs with the Telodendria APIs.
- Fixed the development tools environment script. Apparently using a hyphen as a bullet
point is not very portable, because some shell implementations of
as a flag. Switched to an asterisk.
- Fixed some intermittent I/O errors that would occur as a result of race conditions in
JsonConsomeWhitespace(). This function, and a few others, expect I/O to be blocking,
HttpServersets up I/O to be non-blocking, leading to occasional failures in
- Abstracted all I/O into the new
StreamAPIs, which provide an input- and
output- agnostic stream processing interface. This allows for a simple implementation of
proxies, TLS, and other stream filters without having to change any of the existing
- Remove all non-POSIX function calls, including the call to
unveil(). This may seem like a downgrade in security, but
these are platform-specific system calls that should be patched in by package maintainers
if they are desired. They also caused problems when implementing other features, because
some library calls need to be able to access files on the filesystem.
- Fixed the build script to supply
LDFLAGSafter the object files when linking.
Apparently the order in which libraries are passed matters to some compilers.
- Added the response status of a request to the log output. This means that requests are
logged after they have completed, not before they are started.
- Memory allocations, reallocations, and frees are no longer loged when the log level
is set to debug in the configuration file. To enable the logging of memory operations,
- Implemented a proper HTTP request router with POSIX regular expression support.
Previously, a series of nested
if-statements were used to route requests, but this
approach quickly becamse very messy. While the HTTP request router incurs a small memory
and runtime speed penalty, the code is now much more maintainable and easier to follow.
- Fixed some memory bugs in
Dbthat were related to caching data. Caching should
now work as expected.
- Fixed a major design flaw in
Dbthat would cause deadlock when multiple threads
request access to the same object. Database locking is now in a per-thread basis,
instead of a per-reference basis.
- Telodendria now shuts down cleanly in response to
- Did some general refactoring to make the source code more readable and easier
Fixed a number of memory-related issues, including switching out some unsafe
functions for safer versions, per the recommendations of the OpenBSD linker.
- Moved all code documentation into the C header files to make it more likely
that it will get updated. A simple header file parser and documentation generator
have been added to the code base. See the
hdocman pages for documentation.
- Updated the build script to provide static and shared libraries containing
the code for Telodendria to make it easier to statically and dynamically link to
other programs. The idea is that these libraries should be shipped with Telodendria,
or as a separate package, and can be used to provide a high-level programming
- Updated the
JsonAPI to calculate the length of a JSON object. This is
used to set the
Content-Lengthheader in HTTP requests and reponses.
- Added some string functions, including
StrEquals(), which replaced almost all
strcmp()is used almost exclusively for equality
StrEquals()provides a standard way to do so, because previously,
multiple different conventions could be found throughout the code base (for example:
strcmp(str1, str2) == 0).
... And many more!