Commit graph

107 commits

Author SHA1 Message Date
oxalica
8876480732 test: add method to dump query plans 2024-09-21 09:23:32 -04:00
oxalica
5c4dfd4a96 fix(types): fix typo 2024-09-21 07:37:57 -04:00
oxalica
5a701b6a5e build: reduce debuginfo for dev build 2024-09-21 07:37:33 -04:00
oxalica
fafd2de2e3 refactor(database)!: decouple SQLs from backend logic and cache stmts
This decouples SQLs from handler logic, makes it easier for auditing and
caching. It also enables the possibility to switch or support multiple
database backends.
2024-09-21 07:37:06 -04:00
oxalica
b955d32099 fix(blahd): reject UNIX domain socket for now
It's too complex to bother with for the current `axum` API. Let's wait
for axum 0.8 release.

Ref: https://github.com/tokio-rs/axum/pull/2479
2024-09-19 09:04:50 -04:00
oxalica
ec7f428519 fix(webapi/register): fix shift overflow
This would make challenge always fail if difficulty is a multiple of 8.
2024-09-19 06:43:17 -04:00
oxalica
5afe6af11a feat(frontend): actually do register challenge 2024-09-19 06:42:36 -04:00
oxalica
ce38ff1be2 feat(blahctl): add identity update-profile 2024-09-19 06:05:37 -04:00
oxalica
0289164bd2 fix(nix): relax configuration type for now 2024-09-19 05:27:56 -04:00
oxalica
0c28c00c3d refactor(webapi)!: put all API under path /_blah 2024-09-19 05:12:42 -04:00
oxalica
ab756f78ab fix(frontend): fix parsing and validation of msgs 2024-09-19 05:11:48 -04:00
oxalica
023da5ecb2 feat(blahctl): add identity validate 2024-09-19 02:52:39 -04:00
oxalica
82ab7f7d2c refactor(types): move UserIdentityDesc verification into types crate 2024-09-19 02:37:03 -04:00
oxalica
fac380fe55 refactor(types,register): introduce IdUrl and related types into submod
- `IdUrl` does basic validation for identity URL. Server could enforce
  additional restrictions on their own need.

- single-label doamins are now rejected by default.

- More tests are added for `IdUrl` validation.
2024-09-19 01:44:09 -04:00
oxalica
25936cc4f7 refactor(blahctl)!: push down desc_file argument 2024-09-19 00:00:32 -04:00
oxalica
a04bff9f2f ci: drop magic-nix-cache-action since it's failing 2024-09-17 23:08:56 -04:00
oxalica
7b0ca8aa16 test,ci: validate version of sqlite and fix ci 2024-09-17 23:08:30 -04:00
oxalica
4108212f34 bench: bench register-pow for difficulty reference 2024-09-17 22:35:09 -04:00
oxalica
5252aa19ee feat(blahctl): add identity management commands 2024-09-17 21:44:36 -04:00
oxalica
a9ca9b976c feat(frontend): impl register and fix 2024-09-17 21:44:36 -04:00
oxalica
3af64f35a5 fix(register): fix CORS, nonce update and error reporting 2024-09-17 21:44:36 -04:00
oxalica
cb72d049e0 feat(types,webapi): impl id_key/act_key for all APIs and update docs 2024-09-17 21:44:36 -04:00
oxalica
fb76756482 feat(webapi): impl user registration and identity description format 2024-09-16 10:45:40 -04:00
oxalica
7f74d73c8c remove(webapi)!: remove auto user creation on joining or creating room
User must be explicitly created forehand using the registration API
(coming soon).
2024-09-16 06:41:26 -04:00
oxalica
985ea1d68a remove(types)!: remove members from CreateGroup
Now a group can only be created with the creator as the only initial
member. This forbids group creator from adding other members without
their consent. Additional members can join the group later at their own
will.
2024-09-16 06:39:10 -04:00
oxalica
93d779b615 feat(webapi): log backtrace on database errors 2024-09-16 06:13:14 -04:00
oxalica
2775068e49 refactor(config): split into subsections and verify on parsing 2024-09-13 07:20:48 -04:00
oxalica
93d1589730 refactor(types): WithSig -> Signed 2024-09-13 03:32:11 -04:00
oxalica
73eb441a26 refactor(*): use term msg to replace item
- `Msg` or `msg` is now the canonical term for the substructure in a
  room. It includes a `chat` subtype and (in the future) other
  administration subtypes like member joining or leaving.

- `Message` or `message` can used in human oriented context like docs
  and comments, but only when it is unambiguous.

- `message` is not chosen in code because it's hard to type (at least
  for me!), and have ambiguous meaning of:
  - "Human readable text" in context of `ApiError`'s field.
  - "A unit of data transfer, datagram" in context of WebSocket Message.

- `item` is not chosen because it is overly generic.
2024-09-13 03:32:11 -04:00
oxalica
4acc103afa ci: enable all non-webapi tests on stable rustc 2024-09-11 13:19:24 -04:00
oxalica
98b2df2fdf feat(blahd): impl socket activation integration
This also allows arbitrary listening fd include UNIX domain sockets, via
environment variables as sd_listen_fds(3).
2024-09-11 13:17:52 -04:00
oxalica
87c8acd5b2 fix(module.nix): update config option definitions 2024-09-10 16:39:53 -04:00
oxalica
348fdc2498 fix(config): set default value of database.in_memory 2024-09-10 16:34:50 -04:00
oxalica
ab4812e101 fix: deny room_admin on peer chat room 2024-09-10 12:46:47 -04:00
oxalica
1e944ead31 feat: impl basic peer chat 2024-09-10 12:26:37 -04:00
oxalica
9e96927693 doc: fix missed docs of member_permission 2024-09-10 12:16:48 -04:00
oxalica
4f48b390f7 feat(webapi): include member_permission in RoomMetadata
This is currently only included by `room_list` endpoint with
authentication.
2024-09-10 09:33:59 -04:00
oxalica
5eeb12c294 test(webapi): test last seen item 2024-09-10 09:20:32 -04:00
oxalica
74c6fa6f6a refactor(webapi): hoist RoomMetadata to blah_types and rename last_chat to last_item 2024-09-10 09:19:15 -04:00
oxalica
c0ec429c24 test(webapi): test room item posting and listing 2024-09-10 08:19:44 -04:00
oxalica
1a0347337c feat(webapi): differentiate no-room-permission from not-a-member error
- If a user is not a room member, HTTP 404 code=not_found will be
  returned. This also happen for posting into not-joined public rooms,
  and it can be interpreted as "room member is not found".

- If a user is a member but lacks the member permission to perform an
  action, HTTP 403 code=permission_denied will be returned.
2024-09-10 08:19:44 -04:00
oxalica
35b5aace08 refactor(tests): simplify and rename 2024-09-10 08:19:44 -04:00
oxalica
2759891b7b ci: skip documenting dependencies 2024-09-10 06:57:24 -04:00
oxalica
199985c6a2 build(toolchain),ci: switch to rust 1.82-beta for now
`precise_capturing` has no workaround but we need it in tests. The main
crate should still compile under stable rustc, which is enforced by CI.
2024-09-10 06:56:08 -04:00
oxalica
7160e5adbd refactor: reorganize docs and aux files 2024-09-10 03:59:31 -04:00
oxalica
0ac841e6fa refactor: move types crate into blahd-types subpackage 2024-09-10 03:47:41 -04:00
oxalica
0a0a4aefa9 doc: document WebSocket API 2024-09-10 03:33:21 -04:00
oxalica
8bca2ebddc doc: update and fix errors 2024-09-10 03:18:52 -04:00
oxalica
3bb6d1456d Enforce lint reasons 2024-09-10 01:29:21 -04:00
oxalica
61850aa1ed Make mock rng a fixture to allow dyn Rng 2024-09-10 01:29:21 -04:00