Compare commits


312 Commits

Author SHA1 Message Date
lda 2c6d5194d2 Set an error message with MatrixErrorCreate whenever applicable (#45)
Closes #6.

Co-authored-by: Jordan Bancino <>
Reviewed-on: #45
Co-authored-by: lda <>
Co-committed-by: lda <>
2023-12-02 10:24:08 -05:00
Jordan Bancino 0a91a0c40b Remove site files & update README with current site.
The website is now managed in Grav.
2023-11-21 09:16:50 -05:00
Jordan Bancino d3dcf334f0 Update change log. 2023-11-21 09:14:03 -05:00
lda 3dae19e82d Refactor code to comply with #8 (#39)
Reviewed-on: #39
Co-authored-by: lda <>
Co-committed-by: lda <>
2023-11-21 09:11:45 -05:00
Jordan Bancino 2d30719be4 Implement Registration Token Administrator API (#43)
This pull request fully implements and documents all of the registration token administrator API endpoints.

**NOTE:** There is a memory leak when listing all of the registration tokens. Debug this before merging.
~~Closes~~ Supersedes #37.

Closes #26.

This pull request is based off of #37, which addresses #26. This pull makes a number of improvements to the logic, organization, and behavior of the API endpoints.

Co-authored-by: hatkid <>
Co-authored-by: LoaD Accumulator <>
Co-authored-by: LoaD Accumulator <>
Co-authored-by: lda <>
Co-authored-by: Load Accumulator <>
Reviewed-on: #43
2023-11-10 09:30:53 -05:00
Jordan Bancino 503bfb6104 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.
2023-11-08 15:17:27 -05:00
Jordan Bancino 77800e4117 Housekeeping tasks with documentation and versioning. 2023-11-08 14:30:45 -05:00
Jordan Bancino db4ae0408c Fix admin endpoint names in documentation 2023-11-08 11:21:20 -05:00
Jordan Bancino edee1288d8 Remove unused global variables. 2023-11-08 09:45:49 -05:00
Jordan Bancino 4b90800a2b Fix leak in RouteConfig, update documentation.
Closes #15.
2023-11-07 01:26:26 -05:00
Jordan Bancino 6e7f170768 Start working on #15. 2023-11-06 20:42:39 -05:00
Jordan Bancino 1f02f3c2a2 Allow customization of compiler in configure. 2023-11-04 15:56:57 -04:00
Jordan Bancino 582c79b608 Schema are now generated out-of-tree.
Closes #40.
2023-11-04 15:28:20 -04:00
Jordan Bancino 42a901b7f5 Update docs/dev/ 2023-11-01 20:35:48 -04:00
Jordan Bancino 1fee47a628 Use `Makefile`s instead of a custom script (#38)
This pull request also requires the use of the external [Cytoplasm](/Telodendria/Cytoplasm) repository by removing the in-tree copy of Cytoplasm. The increased modularity requires a little more complex build process, but is overall better. Closes #19

The appropriate documentation has been updated. Closes #18


Please review the developer certificate of origin:

1. The contribution was created in whole or in part by me, and I have
the right to submit it under the open source licenses of the
Telodendria project; or
1. The contribution is based upon a previous work that, to the best of
my knowledge, is covered under an appropriate open source license and
I have the right under that license to submit that work with
modifications, whether created in whole or in part by me, under the
Telodendria project license; or
1. The contribution was provided directly to me by some other person
who certified (1), (2), or (3), and I have not modified it.
1. I understand and agree that this project and the contribution are
made public and that a record of the contribution&mdash;including all
personal information I submit with it&mdash;is maintained indefinitely
and may be redistributed consistent with this project or the open
source licenses involved.

- [x] I have read the Telodendria Project development certificate of
origin, and I certify that I have permission to submit this patch
under the conditions specified in it.

Reviewed-on: #38
2023-11-01 12:27:45 -04:00
Jordan Bancino 6377689a83 Update docs/ 2023-11-01 12:16:03 -04:00
Jordan Bancino 23237f97b5 Format source code and apply license. 2023-09-28 19:16:45 -04:00
Jordan Bancino 82ae2d4e41 Update 'docs/' 2023-09-25 16:18:35 -04:00
Jordan Bancino 7d3d84d969 Move Admin routes to /_telodendria/admin/v1 (with version number)
Closes #16.
2023-09-25 16:10:44 -04:00
Jordan Bancino bf1ce839d0 If HOST_NAME_MAX is undefined, use _POSIX_HOST_NAME_MAX.
Probably good enough. Closes #2
2023-09-25 16:02:09 -04:00
Jordan Bancino f8d3e54fec Use int instead of char in EvalExpr.
Closes #5
2023-09-25 15:58:43 -04:00
lda cb41716bf3 Implement #27 (#36)
Implements #27.

Co-authored-by: LoaD Accumulator <>
Co-authored-by: Jordan Bancino <>
Reviewed-on: Telodendria/telodendria#36
Co-authored-by: LoaD Accumulator <>
Co-committed-by: LoaD Accumulator <>
2023-09-25 09:39:21 -04:00
Jordan Bancino 6247085df1 Add change log entry for #35. 2023-09-11 11:01:50 -04:00
lda 0172fa083b Fixes issue #33 related to a memory issue, and format some code. (#35)
Fixes #33.

Co-authored-by: LoaD Accumulator <>
Reviewed-on: Telodendria/telodendria#35
Co-authored-by: LoaD Accumulator <>
Co-committed-by: LoaD Accumulator <>
2023-09-11 10:57:16 -04:00
Jordan Bancino 0b820b80f7 Convert configuration documentation. 2023-09-09 17:43:43 -04:00
Jordan Bancino 6dcfa7dc02 Remove `send-patch` and `tp`. See #20. 2023-09-09 16:58:47 -04:00
Jordan Bancino 024482d4e8 Put the finishing touches on ``. 2023-09-09 16:57:52 -04:00
Jordan Bancino 7a091c5b93 Add contributing documentation. 2023-09-09 16:50:38 -04:00
Jordan Bancino 9e8523d92e Fix issue config. 2023-09-09 15:39:12 -04:00
Jordan Bancino 419017bcc9 Don't allow blank issues. 2023-09-09 15:36:58 -04:00
Jordan Bancino 1a009e87c3 Fix a few small bugs in Gitea templates. 2023-09-09 15:32:43 -04:00
Jordan Bancino 08594e0fb1 Add Gitea issue templates. 2023-09-09 15:28:33 -04:00
Jordan Bancino 56508afe4c Merge branch 'master' of 2023-09-09 00:12:07 -04:00
Jordan Bancino ac3582ddeb Fix table rendering in 2023-09-09 00:12:00 -04:00
Jordan Bancino 61f7ab1040 Fix table rendering in 2023-09-09 00:11:32 -04:00
Jordan Bancino a672c05112 Finish moving over current Administrator API documentation. 2023-09-09 00:03:09 -04:00
Jordan Bancino 09023089f5 Another typo. 2023-09-08 23:27:55 -04:00
Jordan Bancino 6d6fd1645c Fix typo in 2023-09-08 23:27:14 -04:00
Jordan Bancino 043c2e9e33 Add privileges documentation. 2023-09-08 23:26:47 -04:00
Jordan Bancino 9e2f047e82 Fix typo in docs/user/admin/ 2023-09-08 17:23:06 -04:00
Jordan Bancino c78d075a93 Add admin documentation home page. 2023-09-08 17:22:24 -04:00
Jordan Bancino e4a217550f Add logo and center title. 2023-09-08 16:40:33 -04:00
Jordan Bancino d50372a91a Add technical rationale document. 2023-09-08 16:34:27 -04:00
Jordan Bancino fa3b5e95bd Add a nice README which will serve as the basis for the website. 2023-09-08 16:04:48 -04:00
Jordan Bancino 7033a1f0b1 Add repository structure documentation. 2023-09-08 12:12:07 -04:00
Jordan Bancino f6c54cbc7f Add setup documentation. 2023-09-08 11:58:54 -04:00
Jordan Bancino 3cb04417ff Add porting instructions. 2023-09-07 21:53:22 -04:00
Jordan Bancino 93e6582db5 Add usage and install documentation. 2023-09-07 21:10:46 -04:00
Jordan Bancino ee62d31c68 Add documentation home page. 2023-09-07 20:23:40 -04:00
Jordan Bancino 4bd527aa9a Remove old change log. 2023-09-07 20:06:12 -04:00
Jordan Bancino 79ce36c860 Add `` 2023-09-07 19:53:56 -04:00
Jordan Bancino be3ee54bd8 Merge pull request 'added git ignore and removed cvs ignore files' (#29) from array-in-a-matrix/telodendria:master into master
Reviewed-on: Telodendria/telodendria#29
2023-09-06 14:37:29 -04:00
array-in-a-matrix 5367ffca96 replaced .cvsignore with .gitignore 2023-09-06 11:45:44 -04:00
Jordan Bancino c5b2fcf586 Convert Cytoplasm README to markdown. 2023-09-05 22:10:33 -04:00
Jordan Bancino 2b43a93524 Break proposals/admin.7 into multiple issues.
Closes #17
2023-09-05 21:54:26 -04:00
Jordan Bancino fd28f97449 Finish remaining issues in TODO.txt and add docs/ 2023-09-05 21:30:09 -04:00
Jordan Bancino 745a208f14 Move over some more issues. 2023-09-05 19:31:46 -04:00
Jordan Bancino 8843b34ba6 Merge branch 'master' of 2023-09-05 17:11:13 -04:00
Jordan Bancino b059f966f1 Make progress toward migrating TODO.txt to issues.
Still have a ways to go, but wanted to save my progress.
2023-09-05 17:09:58 -04:00
Jordan Bancino 8bf8afd91d Merge pull request '[MOD] Make the README(Markdown) file reflect the current situation.' (#11) from lda/telodendria:lda-dev into master
Reviewed-on: Telodendria/telodendria#11
2023-09-05 16:34:04 -04:00
lda 6db3f3c612
[MOD] Make the README(Markdown) file reflect the current situation.
Signed-off-by: LoaD Accumulator <>
2023-09-05 22:25:39 +02:00
Jordan Bancino fd1172ff56 Summarize Matrix room activity in TODO.txt
I really want to get back to work on Telodendria. I need to find some
more time for it.
2023-09-04 13:35:28 +00:00
Jordan Bancino 468656eee6 Apply #72 2023-09-04 13:30:22 +00:00
Jordan Bancino b625655439 Fix memory leak in some generated code. 2023-08-17 18:09:53 +00:00
Jordan Bancino dab666c969 Update documentation on UtilServerTs(). 2023-08-17 18:09:20 +00:00
Jordan Bancino 36413b4dca Ignore special case in Int64Str. This is hack but good enough for now. 2023-08-13 12:33:18 +00:00
Jordan Bancino 1c32e18c74 Json now uses Int64 for integers.
This should fix all timestamp errors on 32-bit systems in Cytoplasm and
2023-08-13 03:11:40 +00:00
Jordan Bancino 2382638005 Make all timestamps use UInt64. 2023-08-12 23:02:06 +00:00
Jordan Bancino 38a303da91 Allow forcing the emulation mode for testing purposes. 2023-08-12 21:51:51 +00:00
Jordan Bancino 2f76d5b9ae Add signed 64-bit integer support. 2023-08-12 19:59:16 +00:00
Jordan Bancino 93c4b6bfc4 Add 64-bit emulation for platforms that don't have a native 64-bit type. 2023-08-12 16:30:24 +00:00
Jordan Bancino d565640455 Add schema for PDUs v1 and v3, the only unique PDU formats.
All other room versions use one of these two PDU formats.
2023-08-10 00:08:33 +00:00
Jordan Bancino bc71a7ec01 Add admin privilege to manage room aliases. 2023-08-09 15:50:03 +00:00
Jordan Bancino 69d28f39d1 Begin working on room aliases.
These endpoints will help me build out some functionality that will be
needed when actually implementing rooms.
2023-08-09 15:19:45 +00:00
Jordan Bancino e0af88145e Add RouteCreateRoom stub. 2023-08-08 15:11:50 +00:00
Jordan Bancino 6ef965d1e0 Apply patch to make MatrixErrorCreate() take a custom message. 2023-08-05 19:26:03 +00:00
Jordan Bancino 28d9e1cb3b Add RoomCreateRequest schema. 2023-08-05 15:00:52 +00:00
Jordan Bancino 78302d6320 Print admin registration token to configured log, not default stdout.
If Telodendria is started as a daemon and is logging to the syslog, we
want the token to show up in the syslog.
2023-08-05 14:12:02 +00:00
Jordan Bancino 6ec87b8d76 Properly exclude Schema directories from showing up in CVS. 2023-08-05 14:03:08 +00:00
Jordan Bancino 5f3220372e Implement filter validation by using j2s. 2023-08-05 13:46:23 +00:00
Jordan Bancino 77d71989df Don't install configuration files. 2023-08-04 21:15:49 +00:00
Jordan Bancino e9600a21e9 Add support for arrays of primitives. 2023-08-04 20:47:36 +00:00
Jordan Bancino 942d2aad18 Fix memory leaks and remove logging messages. 2023-08-01 22:36:52 +00:00
Jordan Bancino aeaa8487c3 Add leaky Cytoplasm JSON -> Struct code generator.
It is basically complete, I just have to finish cleaning up some of the
memory leaks and remove the log messages.
2023-08-01 20:23:19 +00:00
Jordan Bancino ed37afe564 Add [time] to interpolate dates and times using strftime(). 2023-07-29 18:27:35 +00:00
Jordan Bancino 2e193d4bcf Format code. 2023-07-29 18:27:17 +00:00
Jordan Bancino d22baf440f Update TODO. 2023-07-29 15:50:45 +00:00
Jordan Bancino c467d0913d Add tp, a simple but powerful text preprocessor.
I might rename it, and I have yet to document it in a man page, but I have
found this extremely useful so I thought I'd give it a home here.
2023-07-29 00:04:42 +00:00
Jordan Bancino 68b644a4f2 Add HashMapKeys() and HashMapValues() functions for convenience. 2023-07-18 00:15:29 +00:00
Jordan Bancino b65394ab50 Add basic Graph API.
This is going to be useful with state resolution and dependency ordering,
both of which will be crutial components of Telodendria.
2023-07-16 01:12:56 +00:00
Jordan Bancino a958c4a529 Apply #71: Add ArrayUnique() function. 2023-07-15 22:27:24 +00:00
Jordan Bancino c96ac30f28 Fix Unicode handling in Json, don't sign-extend bytes in Stream. 2023-07-15 17:57:21 +00:00
Jordan Bancino a4330123b9 Add EventRedact() prototype. 2023-07-09 23:18:18 +00:00
Jordan Bancino b1c23ee53a Begin prototyping state resolution API. 2023-07-07 03:15:13 +00:00
Jordan Bancino bc8283f844 Begin prototyping room API. 2023-07-07 02:56:09 +00:00
Jordan Bancino 5f34b846ee Fix stable release version scheme (more details in an upcoming newsletter) 2023-07-01 20:18:59 +00:00
Jordan Bancino 3054a80906 Fix Unicode handling. 2023-06-21 02:49:58 +00:00
Jordan Bancino 539fde773f Fix CanonicalJson and ArraySort. 2023-06-21 02:37:56 +00:00
Jordan Bancino 1fa07d2d3c Update TODO. 2023-06-18 03:25:03 +00:00
Jordan Bancino 80da024e4e Update change log. 2023-06-18 03:19:12 +00:00
Jordan Bancino e3badbd55c Format source code. 2023-06-18 02:53:52 +00:00
Jordan Bancino 861d4146c0 Add Filter API to validate filters and process events. 2023-06-18 02:53:06 +00:00
Jordan Bancino f9e1250d47 Begin working on filtering. 2023-06-17 19:09:06 +00:00
Jordan Bancino 4e184102cb Add Sha1 implementation. 2023-06-17 17:36:46 +00:00
Jordan Bancino 8bda70b1fb Refactor Sha API to return raw bytes, added Sha1() function. 2023-06-17 17:36:11 +00:00
Jordan Bancino 8f0d197480 Bump version: v0.3.0 -> v0.4.0 2023-06-16 16:01:19 +00:00
Jordan Bancino b9641e89d6 Update TODO 2023-06-13 14:06:05 +00:00
Jordan Bancino 1381a31cbd Update TODO. 2023-06-13 14:05:34 +00:00
Jordan Bancino c3287c1674 Update TODO. 2023-06-12 18:00:26 +00:00
Jordan Bancino 071a86114c Apply #70: Add StrLower() function. 2023-06-12 14:10:59 +00:00
Jordan Bancino 1f14169284 Apply #70: Fix warnings of unused variables. 2023-06-12 14:10:08 +00:00
Jordan Bancino 2f946848cb Telodendria Bot can now send messages again.
The problem here is that some Matrix homeservers reject requests that don't
have a Content-Length. http was not sending a Content-Length because it was
reading from standard input. By reading from an actual file, we can actually
easily get the size of the file to send as the Content-Length.
2023-06-12 14:01:56 +00:00
Jordan Bancino 2b3d0aaeaf Prepare for v0.3.0 release.
Not exactly as complete as I initially imagined, but I want to get something
out because I've been spending too much time on the same issues.
2023-06-10 13:29:56 +00:00
Jordan Bancino af15234799 Make the debug server more accurately mimic the actual server. 2023-06-10 13:16:41 +00:00
Jordan Bancino 971f099bb6 Fix potential race condition. 2023-06-09 19:27:49 +00:00
Jordan Bancino 96a1d3c3c4 Move stream assignment; this makes debugging easier. 2023-06-04 18:50:02 +00:00
Jordan Bancino 095e05e927 Make Memory use a recursive mutex.
This allows some additional operations to be performed inside the memory
hooks, although it's still a bad idea to allocate or free memory while
inside the hook.
2023-06-04 18:44:37 +00:00
Jordan Bancino c511ca9f0f Add a recipe to build the examples. 2023-05-30 13:20:23 +00:00
Jordan Bancino faaa12c51f Re-add memory bounds checking.
Also fixed a recursive lock error in some configurations, and replaced
a usage of strcpy() with strncpy().
2023-05-29 23:53:17 +00:00
Jordan Bancino 88f73a6131 Fix a few segfaults in http and json. 2023-05-29 22:48:50 +00:00
Jordan Bancino c206ec495d Format code. 2023-05-27 18:22:38 +00:00
Jordan Bancino 27e40135ad Log a message stating that TLS is disabled if the config requests it. 2023-05-27 17:55:49 +00:00
Jordan Bancino 5df684b609 Show human-readable thread ID in log messages.
This helps debug some multithreading issues.
2023-05-27 17:10:07 +00:00
Jordan Bancino b5b1a021d8 It appears that OpenSSL closes the socket descriptor for us.
When we close it again manually, we may actually be closing another thread's
file descriptor, which causes all kinds of problems.
2023-05-27 17:03:40 +00:00
Jordan Bancino 54924b9444 Fix potential write out of bounds. 2023-05-26 23:47:36 +00:00
Jordan Bancino 42526c95bb Remove memory bound checking logic.
While this was nifty and impressive, it seems like it is too easy to mess
up, and is too platform-specific.
2023-05-26 23:10:00 +00:00
Jordan Bancino 34f33a1c1b Fix SIGBUS on some platforms. Memory alignment matters!
This is a temporary fix; I'm not convinced it will work on all platforms,
so I will probably end up removing all of the memory boundary code
2023-05-26 23:05:35 +00:00
Jordan Bancino d24c1161f6 Add a Cytoplasm example, which I'll use to debug some stuff. 2023-05-26 22:25:03 +00:00
Jordan Bancino d81600d944 Fix more memory leaks in json.
By doing a little reference tracking, we can make sure we don't miss any
JsonValues that may be floating around by the time we're done.
2023-05-26 22:11:07 +00:00
Jordan Bancino efb27c9db8 Push Main return value into MainArgs.
This prevents weird things from happing on some architectures.
2023-05-26 21:05:06 +00:00
Jordan Bancino 3b659ce09e Adjust milestone requirements. I really want v0.3.0 out soon. 2023-05-26 19:21:25 +00:00
Jordan Bancino 34eb9ff670 Report memory hook issues as errors, segfault on error. 2023-05-25 18:26:17 +00:00
Jordan Bancino e87a0647e0 Fix incorrect block size. 2023-05-25 00:03:17 +00:00
Jordan Bancino 836229fd1a Don't log anything at the end of main; user may have redirected and closeed stream.
This would cause a segfault.
2023-05-24 23:32:53 +00:00
Jordan Bancino 2693b89598 Add sane default memory hook to Cytoplasm, fix more leaks in json. 2023-05-23 22:43:37 +00:00
Jordan Bancino e22cf38eac Fix leaks in json. 2023-05-23 20:34:27 +00:00
Jordan Bancino b1049a9a70 Fix leak in http. 2023-05-23 20:19:27 +00:00
Jordan Bancino 441599b088 Don't leak so much memory. 2023-05-23 17:53:19 +00:00
Jordan Bancino 42191ec03f Properly initialize and destroy logging mutex in LogConfigCreate() and
LogConfigFree(), respectively.
2023-05-23 17:42:08 +00:00
Jordan Bancino a4f369a0a9 Fix leak in HttpClient. 2023-05-21 13:55:49 +00:00
Jordan Bancino 4cc876eb10 Fix warning about integer size mismatch. 2023-05-21 13:35:56 +00:00
Jordan Bancino 51b9e2eaed Clean Cytoplasm when td clean is run. 2023-05-21 13:34:05 +00:00
Jordan Bancino e71ffec164 Add some basic heap memory bounds protection. 2023-05-21 13:24:00 +00:00
Jordan Bancino d38ec7cb38 Document hdoc 2023-05-21 00:21:39 +00:00
Jordan Bancino 896f561213 Apparently this expansion syntax only works on ksh. 2023-05-20 21:38:03 +00:00
Jordan Bancino f2f972bb9d Fix memory leaks in hdoc. 2023-05-15 22:38:52 +00:00
Jordan Bancino ff0a9f33b8 Update TODO. 2023-05-15 01:43:46 +00:00
Jordan Bancino 4043285413 Telodendria and all tools now use the Cytoplasm runtime stub.
This reduces the amount of manual work programs have to do, and gives us
some free features, like automatic leak reports in all tools.
2023-05-14 22:15:48 +00:00
Jordan Bancino 8021cff122 Make Telodendria use Cytoplasm.
This commit removes all the duplicate code and makes Telodendria use the
new Cytoplasm library.
2023-05-14 19:35:23 +00:00
Jordan Bancino 5c8a42117c Import new Cytoplasm library based off of code from Telodendria.
Telodendria doesn't use this library yet, but it will soon.
2023-05-13 17:30:09 +00:00
Jordan Bancino a1e3bd7d8e Clean up TODO 2023-05-11 12:00:44 +00:00
Jordan Bancino 4d9c907b58 Attach device ID to authenticated user.
Now RouteWhoAmI can use UserAuthenticate just like the other endpoints.
2023-05-11 03:03:40 +00:00
Jordan Bancino c1c57fd4cf Make RandState thread-specific. 2023-05-11 02:17:04 +00:00
Jordan Bancino 609890654e Fix handling of STATIC and broken compilation on GNU systems. 2023-05-10 03:32:56 +00:00
Jordan Bancino 31866a14b4 Remove some extraneous whitespace from Util.c, not sure how that got there. 2023-05-07 12:08:26 +00:00
Jordan Bancino e6dd20e2b2 Update changelog. 2023-05-07 03:21:52 +00:00
Jordan Bancino ebc3da9b23 Fix some compile warnings. 2023-05-06 23:06:13 +00:00
Jordan Bancino a2eec3946c I missed an instance of strcmp() 2023-05-06 23:02:46 +00:00
Jordan Bancino 0b11b97022 Add StrEquals(), as equality checking is the most common use for strcmp().
This allows us to get rid of the hideous MATRIX_PATH_PART_EQUALS macro,
and prevents inconsistent usage of strcmp() (for example, !strcmp() vs
strcmp() == 0).

StrEquals() also has sensible behavior for dealing with NULL strings (it
doesn't just segfault like strcmp()).
2023-05-06 22:34:36 +00:00
Jordan Bancino 0e69a12784 Register route. 2023-05-06 22:06:54 +00:00
Jordan Bancino 2a87583d2f Add /_matrix/client/v3/account/deactivate 2023-05-06 22:06:23 +00:00
Jordan Bancino 95ceba0645 Add length calculations to JsonEncode() so we can set Content-Length. 2023-05-06 19:23:13 +00:00
Jordan Bancino bbea55be6c Document http-debug-server, fixed typo in HttpServer docs. 2023-05-06 18:21:21 +00:00
Jordan Bancino 3d9a7664b1 Add support for building static and shared libraries. 2023-05-06 17:04:35 +00:00
Jordan Bancino cb7ee91908 Update telodendria(8) 2023-04-30 02:20:59 +00:00
Jordan Bancino f1f66c6331 Fix the Makefile by sourcing tools/ if TELODENDRIA_ENV is unset. 2023-04-30 01:47:27 +00:00
Jordan Bancino abbbfe4d7f Replace all usages of curl in tp, document tp and tt. 2023-04-29 23:28:33 +00:00
Jordan Bancino 872fa1aa66 More documentation. It never ends! 2023-04-29 19:52:51 +00:00
Jordan Bancino a08018870e Remove obsolete documentation. 2023-04-29 18:47:20 +00:00
Jordan Bancino e0c94d7bd2 Site now pulls built man pages. 2023-04-29 18:39:01 +00:00
Jordan Bancino f819093b7d Don't spew unknown expression warnings if @suppress-warnings is set. 2023-04-29 15:28:42 +00:00
Jordan Bancino 0b1b4a8b29 Cope with preprocessor macro usage at the top level of the header.
This workaround allows us to parse the Routes.h properly, although it
notably lacks support for multi-word unknown expressions.
2023-04-29 15:24:46 +00:00
Jordan Bancino a3cc06ff2a Fix line numbers when parsing multi-line macros. 2023-04-29 15:16:58 +00:00
Jordan Bancino 2d8d5244c4 Document some new headers. 2023-04-29 15:04:16 +00:00
Jordan Bancino b70c3f0bed Finish converting all existing documentation. Next up is writing new docs. 2023-04-29 02:54:49 +00:00
Jordan Bancino 71fa96d10d Format source code. 2023-04-27 20:05:08 +00:00
Jordan Bancino a00ded6d06 Add support for parsing global variables, not just function declarations. 2023-04-27 20:04:15 +00:00
Jordan Bancino 9292f1d9da Add docs recipe for generating documentation from the headers.
Note that since all the headers are not documented yet, this will fail
because an undocumented function is a fatal error in hdoc.
2023-04-27 18:39:05 +00:00
Jordan Bancino 9880aac674 Split format recipe into format and license.
Format formats only C source code. License applies the license file to
C source code *and* header files.
2023-04-27 18:03:32 +00:00
Jordan Bancino 24a03ba126 Added some more header documentation. 2023-04-27 18:00:26 +00:00
Jordan Bancino 95cb14213f Add support for return types that are const, structs, or enums. 2023-04-27 16:02:15 +00:00
Jordan Bancino 6e976a2b8d Fix line counts on syntax errors. 2023-04-27 15:54:21 +00:00
Jordan Bancino 72467f6503 Begin moving documentation to headers. 2023-04-27 03:08:39 +00:00
Jordan Bancino 3b06ab120b Add some flags to hdoc to make it more useful. 2023-04-27 02:30:44 +00:00
Jordan Bancino 2447bb63cc Add hdoc, a simple tool for generating documentation from a C header.
This is a very early prototype. It works, but it is probably not efficient
or reliable. However, the documentation format it parses is stable, so I
will begin moving the documentation into the headers.
2023-04-27 01:34:49 +00:00
Jordan Bancino fdcf7ec065 Update changelog, add LD_EXTRA variable in td. 2023-04-26 01:43:32 +00:00
Jordan Bancino 459b2e856f Format source code. 2023-04-25 22:13:28 +00:00
Jordan Bancino 96ca9a725d Finish up capabilities for now. 2023-04-25 22:11:34 +00:00
Jordan Bancino e1367d5bff Use snprintf() instead of sprintf().
All linker warnings should now be eliminated.
2023-04-25 22:01:58 +00:00
Jordan Bancino d83db35df0 Use strncpy() instead of strcpy().
The OpenBSD linker is complaining about it. Even though every single
case strcpy() was used is safe, strncpy() provides a little bit of extra
security, and makes the linker happy.
2023-04-25 21:54:51 +00:00
Jordan Bancino d933d12e1b Make Rand use a provided Mersenne Twister.
This implementation is loosely inspired by the original paper on the
Mersenne Twister, and borrows code from a public-domain implementation of
it, adapting it to fit the style of Telodendria's code, and fixing a few
bugs regarding the size of the data type used.

Neither C nor POSIX provide a good, thread-safe pseudorandom number
generator. The OpenBSD linker started complaining about the use of
rand_r(), and no standard alternative presented itself as worthy of
consideration, so I finally decided it was time to roll my own PRNG.
2023-04-25 21:28:55 +00:00
Jordan Bancino 098eed44a0 Fix bug in MatrixWellKnown(), begin /_matrix/client/v3/capabilities 2023-04-25 18:37:25 +00:00
Jordan Bancino 2ac08ad74d Clean out finished TODO items. 2023-04-25 01:54:03 +00:00
Jordan Bancino 3e4698bf72 Update porting documentation. 2023-04-24 22:24:32 +00:00
Jordan Bancino 38565d4aa6 Update changelog. 2023-04-24 21:21:25 +00:00
Jordan Bancino 05cf076ebc Begin debugging OpenSSL. 2023-04-24 17:05:59 +00:00
Jordan Bancino a525830b64 Telodendria now responds correctly to SIGTERM. 2023-04-24 16:23:50 +00:00
Jordan Bancino 279f261aed Fix race conditions that are possible in Db.
This is accomplished by locking the entire database, and keeping it locked
until the last reference is unlocked. We get rid of per-reference locks,
because those are what cause race conditions.
2023-04-24 16:19:17 +00:00
Jordan Bancino 313249ca88 Fixed some caching bugs in Db.
Note that Db has the potential to deadlock when caching is being used,
and when caching isn't being used, an inconsistent state can occur. Future
changes to Db will fix both of these issues.
2023-04-24 15:43:24 +00:00
Jordan Bancino 737e060243 Finish up Uia fallback. 2023-04-22 15:40:25 +00:00
Jordan Bancino 5431c2cd90 Fix double-free in UiaCleanup(). 2023-04-22 13:45:01 +00:00
Jordan Bancino 2bbe13aaf0 Fix error setting up UIA flows. 2023-04-22 02:06:22 +00:00
Jordan Bancino 866343071a Continued work on UIA fallback. 2023-04-22 00:59:03 +00:00
Jordan Bancino 6a5d89e14b Work on implementing user interactive authentication fallback. 2023-04-21 02:13:06 +00:00
Jordan Bancino fb24f93aaa Fix bug with TLS where cert and key files were used after freeing them. 2023-04-20 21:12:08 +00:00
Jordan Bancino 0b7282c36a Fix build errors on some compilers due to missing symbols. 2023-04-20 19:19:23 +00:00
Jordan Bancino ec09882dbe Fix warnings about memset() 2023-04-20 17:50:22 +00:00
Jordan Bancino 3b28af2031 Fix warning on some compilers. 2023-04-20 17:40:14 +00:00
Jordan Bancino 19b0dcac5a Don't build the routing tree until absolutely necessary.
Saves us a lot of time and memory in case of an error.
2023-04-20 17:37:18 +00:00
Jordan Bancino 4a5c7480aa Fix up a few small warnings. 2023-04-20 13:49:25 +00:00
Jordan Bancino 687b89a83a Add some more user documentation to clarify how configuration works. 2023-04-20 01:39:09 +00:00
Jordan Bancino 25b7c0d059 Begin documenting Admin API. 2023-04-19 21:45:15 +00:00
Jordan Bancino ffeb45375e Implement /_telodendria/admin/privileges
Note that it's not exactly as the proposal defines it; theres a bit more
nuance that will be documented soon.
2023-04-19 18:52:05 +00:00
Jordan Bancino ae38791df2 Format code, remove dataDir from sample production.conf 2023-04-19 02:07:38 +00:00
Jordan Bancino 0cca38115a Move configuration to database, add process control API, fix memory leaks. 2023-04-19 00:33:38 +00:00
Jordan Bancino ff4d265dcc Registration tokens now determine what privileges a user gets. 2023-04-16 18:32:22 +00:00
Jordan Bancino 582df63a31 Format source code. 2023-04-16 17:51:52 +00:00
Jordan Bancino 4ee66ae3c7 Begin implementing user privileges. 2023-04-16 17:51:03 +00:00
Jordan Bancino 768ecda41a Break up todo items into more milestones. 2023-04-15 13:31:08 +00:00
Jordan Bancino 6ca1265076 Begin working on User-Interactive authentication fallback. 2023-04-15 02:36:28 +00:00
Jordan Bancino e882693c78 Add route for requestToken endpoints. 2023-04-14 23:59:40 +00:00
Jordan Bancino b21d018daa Move router building function into a more sensible location. 2023-04-14 21:37:00 +00:00
Jordan Bancino 83971dfaff Refactor routing system to use HttpRouter. 2023-04-14 21:20:56 +00:00
Jordan Bancino a90f7c4b9e Apply #69 2023-04-14 17:50:14 +00:00
Jordan Bancino 3192063340 Fix broken tt script. 2023-04-07 14:20:22 +00:00
Jordan Bancino 1f8df737da Add HttpRouter API; still have to convert the code to use it. 2023-04-06 01:48:32 +00:00
Jordan Bancino 7c865d06fd Format code. 2023-04-01 02:46:59 +00:00
Jordan Bancino e0c8530b12 Clean up http client enough to replace curl in send-patch. 2023-04-01 02:46:07 +00:00
Jordan Bancino e592840c99 Clean up some HTTP client stuff. 2023-04-01 02:13:41 +00:00
Jordan Bancino 7b3d537175 Remove UtilStreamCopy() 2023-04-01 00:20:18 +00:00
Jordan Bancino f341fd2b6e Fix OpenSSL server accept call.
Apparently it can EAGAIN on non-blocking connections... I don't think
LibreSSL's TLS library does this, but something to keep in mind if it
doesn't work for somebody.
2023-03-31 23:10:52 +00:00
Jordan Bancino eef615fc9a Fix warnings in RouteChangePwd.c 2023-03-28 02:28:58 +00:00
Jordan Bancino 9b21e2460a Accept #67: Add the password modification endpoint. 2023-03-28 01:17:47 +00:00
Jordan Bancino c6f4a4a546 Fix leak of StreamStdout() when logging to a file. 2023-03-27 17:56:45 +00:00
Jordan Bancino a9da9fbca7 Update TODO 2023-03-27 17:52:20 +00:00
Jordan Bancino c37d3801b2 Fix warning about uninitialized variable. 2023-03-25 00:00:53 +00:00
Jordan Bancino a24c27bf4f Fix leak in TlsOpenSSL. 2023-03-24 17:37:44 +00:00
Jordan Bancino af776c64a7 Remove duplicate return line. 2023-03-24 14:18:29 +00:00
Jordan Bancino a25573063f Fix up TlsOpenSSL a little bit.
Server is still broken...
2023-03-24 03:05:12 +00:00
Jordan Bancino aeb49f80e5 Add support for OpenSSL. This is a good demo of how easy it is to support TLS libraries. 2023-03-24 02:41:01 +00:00
Jordan Bancino 007e639b0c Don't require the TLS_ in the environment variable.
It's redundant.
2023-03-24 00:25:44 +00:00
Jordan Bancino fe32c652cd Fix bug in HttpClient where it wouldn't retry on EAGAIN. 2023-03-24 00:23:49 +00:00
Jordan Bancino 20d41d794b Fix compile error. I had this in here at some point, not sure where it went. 2023-03-23 17:41:02 +00:00
Jordan Bancino b4e4263cea Remove my testing configuration from contrib/development.conf 2023-03-23 16:40:23 +00:00
Jordan Bancino e13442c122 Fix strange behavior in TlsLibreSSL.
tls_read() and tls_write() may return TLS_WANT_POLLIN or TLS_WANT_POLLOUT
if data isn't ready to be read or written yet. We have to account for this
by converting it to EAGAIN, which is how a typical read() or write()
function should behave.

Also installed a SIGPIPE handler; we do not want to be terminated by
SIGPIPE, and it's safe to ignore this signal because it should be
handled thoroughly in the code.
2023-03-23 16:39:15 +00:00
Jordan Bancino 2441f07848 Add support for spinning up multiple HTTP servers.
This is useful for having a TLS and a non-TLS version port, like Synapse.
I verified that the multiple-servers does in fact work as intended,
although the TLS server part is broken; I must be doing something
incorrectly with LibreSSL in setting up the server.
2023-03-23 02:12:45 +00:00
Jordan Bancino 2fab7b55fe Remove obsolete warning about setting root directory.
We don't use chroot() anymore.
2023-03-22 18:30:30 +00:00
Jordan Bancino 089d8d4d94 Only install the memory hook if -v is given.
This way, we can still set the debug level in the configuration, and not
see the log just absolutely flooded with memory allocations and whatnot.
This is helpful because I want debug messages to show up in development,
but not in production, but having all the memory logging makes it
almost impossible to pick anything else out of the log. I want the
feature available, just not on by default because it's useful in limited
2023-03-22 18:29:05 +00:00
Jordan Bancino 9ec330f40a Log once we get the response status, not right when we get the request. 2023-03-22 18:13:59 +00:00
Jordan Bancino fccd15b239 Don't unconditionally close standard input; it may have been used and
closed before. If it was never used, it was never opened.
2023-03-22 18:12:46 +00:00
Jordan Bancino 35f65a667d Update changelog. 2023-03-22 17:49:06 +00:00
Jordan Bancino 8faf6f2126 Delete TelodendriaConfig.c 2023-03-22 17:20:53 +00:00
Jordan Bancino fc975e6a93 TelodendriaConfig -> Config 2023-03-22 17:17:30 +00:00
Jordan Bancino 413c7ad803 Start building support for running multiple HTTP servers.
The standard use case for this is going to be running a TLS and a non-TLS
HTTP server. I can't see a need for *more* than two, but it is theoretically

We shouldn't have to change anything with the database or anything; it
should suffice to simply spin up more HTTP servers, and they should
interact with each other the same way a single HTTP server with multiple
threads will.
2023-03-22 17:00:48 +00:00
Jordan Bancino e30fa3ee33 Remove remnants of non-global LogConfig from TelodendriaConfig 2023-03-22 16:31:24 +00:00
Jordan Bancino e6f3dfad18 Add an ArraySet() method for replacing entries in an array.
This is much more efficient than using ArrayDelete() and ArrayInsert(),
and will serve us well in the future.
2023-03-22 16:31:06 +00:00
Jordan Bancino b8d00bc8bf Make td run warn if Memory.txt gets created. 2023-03-22 14:57:57 +00:00
Jordan Bancino f3c4c0ac65 Add a global log configuration.
This is the easiest and cleanest way to get logging into some of the
fundamental APIs, such as the database and TLS APIs. We don't want to
have to pass logging functions to those, but they can safely use the
global logging configuration.
2023-03-22 14:52:04 +00:00
Jordan Bancino 8782aa046d Fix compile error in Tls, work on getting certs and keys into HttpServer. 2023-03-22 02:18:31 +00:00
Jordan Bancino bdaea9872e Format source code. 2023-03-22 01:46:45 +00:00
Jordan Bancino b58ca7d22e Start working on adding TLS support to HttpServer. 2023-03-22 01:46:24 +00:00
Jordan Bancino 6561b5bae1 Add TLS build support to td. 2023-03-22 01:17:42 +00:00
Jordan Bancino 996356832e Define TLS API, update HttpClient to support optional TLS.
Also added a LibreSSL TLS implementation. Client is verified to work;
server has not been tested yet.
2023-03-22 00:41:21 +00:00
Jordan Bancino d1b4ecff48 Apparently the order of LDFLAGS matters to some compilers.
Also don't to -pg in debug mode, because that's not supported on all
compilers either.
2023-03-22 00:13:27 +00:00
Jordan Bancino 63d07365db Don't close standard output twice, that leads to a segfault! 2023-03-22 00:12:04 +00:00
Jordan Bancino 2a92d0de7e Fix bit flag check. 2023-03-22 00:11:24 +00:00
Jordan Bancino 4a27f50538 Remove calls to pledge(), unveil(), and chroot().
Not only does this make us more POSIX, it actually makes things a lot
easier because TLS implementations will need to be able to access the
trusted certificates file, which most likely will not live in the
data directory.
2023-03-20 19:23:37 +00:00
Jordan Bancino 6c9e939b9f Fix broken IoVprintf().
You can't call vsnprintf() on the same va_list more than once! I learned
this the hard way with StreamVprintf().
2023-03-18 14:55:04 +00:00
Jordan Bancino 5289c16e2b Convert all code to new Stream API.
Also made a number of improvmements to tt, making it compatible with more
2023-03-18 14:32:09 +00:00
Jordan Bancino a97a593f21 Format code. 2023-03-16 16:53:18 +00:00
Jordan Bancino 27b3b6cdc6 Add StreamPuts(), don't make StreamVprintf() defer to IoVprintf(). 2023-03-16 16:51:41 +00:00
Jordan Bancino 8539a03d5b Add StreamFile() convenience method. 2023-03-16 16:25:24 +00:00
Jordan Bancino e0a3760a37 Don't buffer in IoWrite(), indicate that fwrite() returns size_t, not ssize_t. 2023-03-16 14:17:04 +00:00
Jordan Bancino 6ee1857f5f Format source code. 2023-03-16 12:29:38 +00:00
Jordan Bancino 7d9770fc12 Add some convenience functions for working with Io and Stream.
Also broke out IoFd into it's own file, and did the same with IoFile.
2023-03-16 12:28:55 +00:00
Jordan Bancino 65f4c90df3 Rename HttpStream() to HttpServerStream() to match HttpClientStream() 2023-03-16 02:17:48 +00:00
Jordan Bancino ff52cc78dc Update TODO 2023-03-15 17:30:14 +00:00
Jordan Bancino ab4755240a Add IoCopy() and StreamCopy()
Both do buffered reads and writes, but IoCopy() uses IoRead() and
IoWrite() directly, whereas StreamCopy() relies on StreamGetc() and
StreamPutc(), which manipulate the stream buffers.
2023-03-15 17:14:16 +00:00
Jordan Bancino 92da3542a6 Move low-level fopencookie()/funopen() functionality to Io API.
The Stream API now provides the buffered I/O functionality analogous to
the C standard library.
2023-03-15 16:47:34 +00:00
Jordan Bancino 5dbaf3c223 Apply #65, remove printf() in Db, and make tt show login messages. 2023-03-15 13:36:49 +00:00
Jordan Bancino afc7667737 Begin prototyping Stream API. 2023-03-15 02:40:23 +00:00
Jordan Bancino ae97d8116c Apply #64: Registration tokens. 2023-03-14 00:37:24 +00:00
Jordan Bancino 76bfa120ee Fix CPU pin if clients don't shutdown() their socket properly.
If we haven't read any bytes yet, then we try a few times a few ms apart
to see if we get anything. If not, treat it as an EOF. Otherwise, read
bytes until we get an EOF or EAGAIN. EAGAIN after a consistent read of
bytes is treaded as an EOF immediately.
2023-03-12 15:08:50 +00:00
Jordan Bancino 62cd1cdc98 Misc changes. 2023-03-12 03:37:57 +00:00
Jordan Bancino 7fa982a16f Fix bug in Uia 2023-03-12 03:36:40 +00:00
Jordan Bancino aba1ef9251 Add some more documentation. 2023-03-12 03:36:19 +00:00
Jordan Bancino b4a394c44b Move send-patch and td to section one of the manual.
I think they fit there better.
2023-03-10 23:02:09 +00:00
Jordan Bancino 64add9c9ab Fix unused variable warning. 2023-03-10 20:12:25 +00:00
Jordan Bancino 3037f12907 Add tt and http-debug-server tools. 2023-03-10 18:48:52 +00:00
Jordan Bancino 2d9b706f38 Fix I/O in JsonConsumeWhitespace() and UtilStreamCopy().
These functions previously operated on the assumption that fgetc() would
block; however it will not block on HttpServer streams because those are
non-blocking. They now check error conditions properly before failing
2023-03-10 18:46:03 +00:00
Jordan Bancino fd12dee62e Make sure a newline is printed after JSON object is pretty-printed. 2023-03-10 04:30:56 +00:00
Jordan Bancino 8ead9cc93a Apply #63, make some general bug fixes. 2023-03-10 03:24:04 +00:00
Jordan Bancino 3af2d3d12b Format code, update TODO items. 2023-03-09 03:35:40 +00:00
Jordan Bancino 7344d4fa46 Apparently some shells interpret the - in a string as an argument delimiter??? 2023-03-09 02:49:14 +00:00
Jordan Bancino ca053a12b1 Break out main() into Main.c, fix some compile warnings on Cygwin. 2023-03-09 02:46:04 +00:00
Jordan Bancino 9a1300ff2e Make sure input is initialized. 2023-03-09 02:22:13 +00:00
Jordan Bancino c32c3abfd6 Update TODO 2023-03-09 00:10:32 +00:00
Jordan Bancino 012c334ee5 Make send-patch use json instead of jq. 2023-03-09 00:06:15 +00:00
Jordan Bancino 20ebeb9c32 Switch tp from using jq to json; format td 2023-03-08 22:47:40 +00:00
Jordan Bancino 76413f834e Make json use ^ for removing fields, instead of !
Room IDs start with '!', we want to be able to access these.
2023-03-08 22:47:07 +00:00
Jordan Bancino efdf168085 Allow encoding user-provided strings. 2023-03-08 20:31:49 +00:00
Jordan Bancino 50e599f1cd Implement a mostly-functional query language for JSON. 2023-03-08 19:49:06 +00:00
Jordan Bancino 7b22fb02a2 Implement pretty-printing option in Json.
Telodendria itself doesn't use it, but the json CLI tool does.
2023-03-08 17:15:43 +00:00
Jordan Bancino cb8c4fceb5 Begin working on JSON CLI tool.
This is a similar situation to the HTTP CLI tool: since we have the
Json API anyway, we might as well have a little command line tool to
replace jq.
2023-03-08 04:06:43 +00:00
Jordan Bancino 19e89110cd Bump version number to v0.3.0 2023-03-08 03:46:38 +00:00
Jordan Bancino 1a169d1a2e Fix usage message. 2023-03-08 03:31:34 +00:00
Jordan Bancino 8d75d8a023 Add simple HTTP CLI tool that uses the HttpClient API.
You might be asking why I would just write a simple curl replacement
when curl does the job just fine. Well, the most immediate reason is
to test the HttpClient API, but since Telodendria's goal is to not
be dependent on any third-party code if at all possible, it makes
sense to have a simple HTTP client to use not only for testing
Telodendria, but also for configuring it. When we move the
configuration to the database, we'll ship a script that uses this
tool to allow admins to easily submit API requests.

Do not be concerned that HttpClient does not support TLS yet. TLS
support is necessary for federation to work, so it is coming
2023-03-08 03:30:36 +00:00
Jordan Bancino 7e144ae488 Clean up a few bugs in HttpClient and Uri 2023-03-08 02:53:47 +00:00
Jordan Bancino 3e42da279c Make improvements to HttpClient, add Uri 2023-03-08 01:54:33 +00:00
Jordan Bancino 313f0e2e73 Add HttpClient API 2023-03-07 23:10:06 +00:00
Jordan Bancino fc8fbc9a70 I forgot to set the date in the changelog. 2023-03-07 00:51:16 +00:00
Jordan Bancino 7e41251f07 Update README 2023-03-07 00:50:59 +00:00
169 changed files with 9729 additions and 15009 deletions

View File

@ -1,6 +0,0 @@

View File

@ -0,0 +1,49 @@
name: Bug Report
about: File a bug report regarding Telodendria, its website, or its documentation.
- type: markdown
value: |
You are submitting a bug report. Please be sure to fill out the
title with a brief description of the bug.
- type: dropdown
label: Type
description: Select the type of issue.
- Memory Leak
- Crash
- Unexpected Error Message
- Documentation
- Website
- Other
required: true
- type: textarea
label: Description
description: |
Please give a thorough and detailed description of the bug you
are reporting. Provide all the information you have, and do
some investigating to ensure you are providing a legitimate
issue report that is well thought out. **Include details on
how to reproduce the issue, or explicitly state that you were
unable to reproduce it.**
required: true
- type: textarea
label: Log Output
description: |
Please copy and paste the relevant sections of the log output,
or the entire log if it is not unreasonably large. The logs
will be automatically formatted, no code block is necessary.
render: shell
required: true
- type: markdown
value: |
Please attach any additional files that may aid in our
investigation of this issue, including screenshots, debugging
session stack traces and dumps, etc.

View File

@ -0,0 +1,7 @@
blank_issues_enabled: false
- name: General Matrix Room
url: ""
about: |
General discussion on Telodendria happens in this Matrix room. You
may get quicker feedback from there.

View File

@ -0,0 +1,18 @@
name: Feature Request
about: Request a new feature or enhancement be added to Telodendria.
title: "[Feature] "
- type: markdown
value: |
You are submitting a feature request. Please be sure to fill
out the title with a brief description of the feature you are
- type: textarea
label: Description
description: |
Please give a thorough and detailed description of the feature
you are requesting.
required: true

View File

@ -0,0 +1,25 @@
Please review the developer certificate of origin:
1. The contribution was created in whole or in part by me, and I have
the right to submit it under the open source licenses of the
Telodendria project; or
1. The contribution is based upon a previous work that, to the best of
my knowledge, is covered under an appropriate open source license and
I have the right under that license to submit that work with
modifications, whether created in whole or in part by me, under the
Telodendria project license; or
1. The contribution was provided directly to me by some other person
who certified (1), (2), or (3), and I have not modified it.
1. I understand and agree that this project and the contribution are
made public and that a record of the contribution&mdash;including all
personal information I submit with it&mdash;is maintained indefinitely
and may be redistributed consistent with this project or the open
source licenses involved.
- [ ] I have read the Telodendria Project development certificate of
origin, and I certify that I have permission to submit this patch
under the conditions specified in it.

.gitignore vendored Normal file
View File

@ -0,0 +1,18 @@
# Telodendria .gitignore

View File

@ -1,7 +1,135 @@
# [Telodendria](
<h1 style="text-align: center;">Lightweight, Decentralized Chat.</h1>
**Telodendria** is an open source Matrix homeserver implementation written from scratch in ANSI C and designed to be lightweight and simple, yet functional.
**Telodendria** is an extremely powerful, yet lightweight and portable
chat server designed to be easy to install and configure. Powered by
the [Matrix]( protocol, Telodendria empowers
everyone to run their own chat server on ordinary hardware, including
old and embedded devices. Whether you want a simple chat server just
for you and your friends and family, or want to talk to users on other
Matrix homeservers but don't want to go through all the hastle of
hosting a complicated, high-maintenance homeserver or joining an
existing homeserver for privacy or other reasons, then Telodendria
might be for you.
**Important:** This project is not developed on GitHub, or even with Git. As such, GitHub Pull Requests are not accepted. But that doesn't mean we don't want your contribution! You're more than welcome to clone this repo and use Git to make changes to the project if you'd prefer it to CVS, but when it comes time to actually submit your changes to this project, use [git format-patch]( to generate patch files, then submit them to the official Matrix room: [](
!!!! **Note:** Telodendria still in development. See **Status** below.
Please see the `README.txt` file for the actual project `README`, which simply details the repository structure a little bit. All of **Telodendria**'s user and developer documentation is available as `man` pages, or online.
## What is Matrix?
Matrix is an **open standard** for *interoperable*, *decentralized*,
*secure*, and *real-time* communication over the internet.
Matrix can be thought of as the successor to email, but it works
very similar to iMessage, Discord, or direct messaging on most
social media networks. The primary difference between Matrix and these
other services, however, is that Matrix doesn't depend on one central
authority, and is designed in such a way to respect your privacy.
Matrix has proven itself over the last few
years to be a reliable communication tool, and has only gotten more
user-friendly over the course of its development. Matrix is capable
enough that it can&mdash;and should&mdash;totally replace any other
means of digital communication, and it offers a much higher degree
of security, simplicity, and functionality.
Strictly speaking, Matrix itself is just the *protocol* by which
clients and servers communicate. In order to use Matrix, we need
implementations of both clients and servers. Telodendria is a server
implementation of the Matrix protocol.
## Why Telodendria?
- **Lightweight:** Written in the C programming language, Telodendria
is automatically lighter and faster than other self-hosted chat servers.
It has very few external dependencies and is as self-contained as
- **Fully-Featured:** Most lightweight chat solutions compromise on
features. Telodendria is built on the fully-featured Matrix protocol,
which provides a chat experience that most normal users are familiar
- **Portable:** You can run Telodendria on just about everything,
including more traditional options like a personal home server or VPS,
but also more obscure platforms like Raspberry Pis or retro computers.
Telodendria can run on a broad number of operating systems, which means
that no matter which platform and OS you prefer, there is a good chance
you can add Telodendria without much difficulty. It is also extremely
easy to migrate a Telodendria instance between platforms; just copy the
data directory to a new device.
- **Simple:** Telodendria is designed to be a simple, no-frills
chat server. It is easy to install, easy to configure, and easy to
- **Stable:** Other Matrix homeservers develop at the pace of the
Matrix specification itself, which is to say quite rapidly. Changes are
always being made, and a version shipped 6 months ago is already
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 &rightarrow;](
## Get Started
Check out the [Documentation]( to get started with
## Status
Telodendria is in the very early stages of development. As such, it may
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 `v1.7.0-alpha4` by January of 2025. 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**
Telodendria or [getting involved](
## Sponsorship
Telodendria is maintained by a loosely-knit band of volunteers. The
project currently has no sponsors and thus no source of income to
pay for infrastructure costs and developer time. To ensure
Telodendria's long-term success, please consider sponsoring the
You can make a recurring donation to Telodendria using
[LiberaPay]( You can also make
one-time donations using
[Stripe]( If you would
like to make a recurring donation larger than that allowed by
LiberaPay, please contact Jordan Bancino over Matrix at
`` or email at ``.
### Benefits
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](../sponsors) page, the project `README`, or the
main website.
## License
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`]( 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:
- Where the MIT license states that the copyright notice and permission
notice shall be included in all copies or *substantial* portions of the
software, the Telodendria requires the copyright notice and
permission notice be included with *all* portions, regardless of the
size, by omitting the word *substantial*.
The Telodendria logo in all its forms, including the ASCII
representation, belongs solely to the Telodendria project. It must be
used only to represent the official Telodendria project. You are free
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

View File

@ -1,63 +0,0 @@
.= -=-
:.:+ .=:.
.=+-==. :.
.+- =.
.+ :+.
==. -+:
=++==--:: =+.
.:::--=+=: :+=
:==. -=:
===----=-. ... :+.
:==+=======: .-+-::-+-=+=
.==*%#======= :+- ..
.:--=-===+=========-. :+:
:+=: :=+-: .-=========-. .
=+++: .:=+-: .:--. .--:==:
::---:.. :=+: ==
++. .+-
=+ .+- ...:
+- -+-:-+=::+:
:=-....:-=: .--: =-
|_ _|__| | ___ __| | ___ _ __ __| |_ __(_) __ _
| |/ _ \ |/ _ \ / _` |/ _ \ '_ \ / _` | '__| |/ _` |
| | __/ | (_) | (_| | __/ | | | (_| | | | | (_| |
|_|\___|_|\___/ \__,_|\___|_| |_|\__,_|_| |_|\__,_|
Copyright (C) 2023 Jordan Bancino <>
This is the source code for Telodendria, a Matrix homeserver written
in C. All of the documentation is available as man pages in the
man/ directory, or online at
If information is missing from the documentation, please feel free
to reach out to on Matrix.
This file documents the directory structure of the source code
contrib/ - Supplemental files, such as example configs.
man/ - The official documentation as man pages.
proposals/ - Proposals for new features or fixes, as man pages.
site/ - The official website.
src/ - The C source code for Telodendria.
include/ - Header files for the source code.
Routes/ - Where Matrix API endpoints are implemented.
Static/ - Endpoints that just generate static HTML pages.
tests/ - Unit and integration tests will eventually go here.
tools/ - Development environment and tools.
To cut a new release for Telodendria, perform the following
steps. This is just a reference for me so I don't mess it up.
- Update tools/bin/td to declare the next version number.
- Make sure man/man7/telodendria-changelog.7 is up to date.
with the latest information.
- Commit all changes.
- Run the release recipe: td release
- Deploy the site: td site

Schema/ClientEvent.json Normal file
View File

@ -0,0 +1,58 @@
"header": "Schema/ClientEvent.h",
"types": {
"ClientEventUnsignedData": {
"type": "struct",
"fields": {
"age": {
"type": "integer"
"prev_content": {
"type": "object"
"redacted_because": {
"type": "object"
"transaction_id": {
"type": "string"
"ClientEvent": {
"type": "struct",
"fields": {
"content": {
"type": "object",
"required": true
"event_id": {
"type": "string",
"required": true
"origin_server_ts": {
"type": "integer",
"required": true
"room_id": {
"type": "string",
"required": true
"sender": {
"type": "string",
"required": true
"state_key": {
"type": "string"
"type": {
"type": "string",
"required": true
"_unsigned": {
"type": "ClientEventUnsignedData"

Schema/Filter.json Normal file
View File

@ -0,0 +1,121 @@
"header": "Schema\/Filter.h",
"types": {
"FilterRoom": {
"fields": {
"not_rooms": {
"type": "[string]"
"state": {
"type": "FilterRoomEvent"
"include_leave": {
"type": "boolean"
"timeline": {
"type": "FilterRoomEvent"
"account_data": {
"type": "FilterRoomEvent"
"rooms": {
"type": "[string]"
"ephemeral": {
"type": "FilterRoomEvent"
"type": "struct"
"FilterEventFormat": {
"fields": {
"federation": {
"client": {
"type": "enum"
"FilterEvent": {
"fields": {
"not_senders": {
"type": "[string]"
"limit": {
"type": "integer"
"senders": {
"type": "[string]"
"types": {
"type": "[string]"
"not_types": {
"type": "[string]"
"type": "struct"
"Filter": {
"fields": {
"event_format": {
"type": "FilterEventFormat"
"presence": {
"type": "FilterEvent"
"account_data": {
"type": "FilterEvent"
"room": {
"type": "FilterRoom"
"event_fields": {
"type": "[string]"
"type": "struct"
"FilterRoomEvent": {
"fields": {
"not_rooms": {
"type": "[string]"
"not_senders": {
"type": "[string]"
"limit": {
"type": "integer"
"senders": {
"type": "[string]"
"include_redundant_members": {
"type": "boolean"
"types": {
"type": "[string]"
"rooms": {
"type": "[string]"
"lazy_load_members": {
"type": "boolean"
"not_types": {
"type": "[string]"
"contains_url": {
"type": "boolean"
"unread_thread_notifications": {
"type": "boolean"
"type": "struct"

Schema/LoginRequest.json Normal file
View File

@ -0,0 +1,38 @@
"header": "Schema\/LoginRequest.h",
"types": {
"LoginRequestType": {
"fields": {
"m.login.password": { "name": "REQUEST_TYPE_PASSWORD" }
"type": "enum"
"LoginRequestUserIdentifier": {
"fields": {
"type": { "type": "string" },
"user": { "type": "string" }
"type": "struct"
"LoginRequest": {
"fields": {
"type": { "type": "LoginRequestType" },
"identifier": { "type": "object" },
"password": { "type": "string" },
"address": { "type": "string" },
"user": { "type": "string" },
"device_id": { "type": "string" },
"initial_device_display_name": { "type": "string" },
"medium": { "type": "string" },
"token": { "type": "string" },
"refresh_token": { "type": "boolean" }
"type": "struct"

Schema/PduV1.json Normal file
View File

@ -0,0 +1,81 @@
"header": "Schema/PduV1.h",
"types": {
"PduV1EventHash": {
"type": "struct",
"fields": {
"sha256": {
"type": "string",
"required": true
"PduV1UnsignedData": {
"type": "struct",
"fields": {
"age": {
"type": "integer"
"PduV1": {
"type": "struct",
"fields": {
"auth_events": {
"type": "array",
"required": true
"content": {
"type": "object",
"required": true