-
Telodendria v0.3.0 Pre-Release
released this
2023-06-10 09:29:56 -04:00 | 112 commits to master since this releaseIntroducing 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.Matrix Specification
Added support for the following endpoints:
/_matrix/client/v3/account/whoami
/_matrix/client/v3/account/password
/_matrix/client/v3/account/deactivate
/_matrix/client/v3/profile/*
/_matrix/client/v3/capabilities
/_matrix/client/v3/auth/*/fallback/web
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
place.New Features
- Added a new
HttpClient
API 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
tools includehttp
, a command line tool for making HTTP requests, similar to
curl
,json
, a command line tool for working with JSON, similar tojq
, and
http-debug-server
, a simple HTTP server that just prints requests out to standard
output and returns an empty JSON object.http
andjson
are replacements for
curl
andjq
that build on theHttpClient
andJson
APIs. They exist mainly
to test those APIs, but also to reduce the number of dependencies that Telodendria
has.http-debug-server
exists to test theHttpServer
andHttpClient
APIs. - Replaced all usage of
jq
with the newjson
tool.jq
is no longer a development
dependency. - Replaced all usage of
curl
with the newhttp
tool.curl
is no longer a
required development dependency. - Added a new
tt
script for easily making Matrix requests against Telodendria
in development. - 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
Telodendria process. - 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 ofprintf
interpret it
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,
but theHttpServer
sets up I/O to be non-blocking, leading to occasional failures in
JSON parsing. - Abstracted all I/O into the new
Io
andStream
APIs, 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
code. - Remove all non-POSIX function calls, including the call to
chroot()
and, on
OpenBSD,pledge()
andunveil()
. 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
LDFLAGS
after 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,
pass the-v
flag. - Implemented a proper HTTP request router with POSIX regular expression support.
Previously, a series of nestedif
-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
Db
that were related to caching data. Caching should
now work as expected. - Fixed a major design flaw in
Db
that 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
SIGTERM
. - Did some general refactoring to make the source code more readable and easier
to maintain.
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 thehdoc
man 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
environment. - Updated the
Json
API to calculate the length of a JSON object. This is
used to set theContent-Length
header in HTTP requests and reponses. - Added some string functions, including
StrEquals()
, which replaced almost all
uses ofstrcmp()
, sincestrcmp()
is used almost exclusively for equality
checking.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)
vsstrcmp(str1, str2) == 0
).
... And many more!
Downloads