Commit graph

182 commits

Author SHA1 Message Date
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
oxalica
e40ec6a324 Add tests for room join/leave and fix response status code 2024-09-10 01:29:21 -04:00
oxalica
5cd45232f4 Enable more local logging and disable dependencies' 2024-09-10 01:29:21 -04:00
oxalica
ff5b7e60a7 Add tests for room create/read and fix incorrect foreign keys 2024-09-10 01:29:21 -04:00
oxalica
c5263c607c Split out socket config and switch back to toml crate
basic-toml does not support externally-tagged enum yet.

See: https://github.com/dtolnay/basic-toml/issues/8
2024-09-10 01:29:21 -04:00
oxalica
4f0f1405dc Librarify blahd for testing 2024-09-10 01:29:21 -04:00
Shibo Lyu
a92f661003 doc: pin @stoplight/elements version & add sub-resource integrity 2024-09-09 11:26:59 +08:00
Shibo Lyu
8f0311c0d8 doc: openapi doc 2024-09-08 23:09:44 +08:00
Shibo Lyu
c2b8ef1a22 ci: publish openapi doc 2024-09-08 23:09:44 +08:00
oxalica
67ea6aaacc Impl untilToken for item_list to avoid over-fetching seen items 2024-09-06 04:01:06 -04:00
oxalica
8b096ba802 Impl room listing with filter=unseen 2024-09-06 04:00:08 -04:00
oxalica
e74da2812b Maintain room member's last seen item and fix docs 2024-09-06 03:33:21 -04:00
oxalica
e98c9f8b3c Derive Clone, PartialEq, Eq for data types 2024-09-06 02:29:58 -04:00
oxalica
51e2c8418b Include cid in item responses and update docs 2024-09-06 02:27:53 -04:00
oxalica
a7f260027d Use simplified Snowflake ID generation
This prevents leaking server information to client with little effort.
2024-09-06 02:06:44 -04:00
oxalica
59d51937da Switch room identifier from UUID to stringified i64 2024-09-06 02:06:14 -04:00
oxalica
236fb61832 Fix missed JSON error response and simplify 2024-09-06 02:05:32 -04:00
oxalica
4e78780569 Simplify frontend duplicated code 2024-09-06 02:05:32 -04:00
oxalica
d3c3961298 Use proper rejection type for Auth middleware 2024-09-06 02:05:32 -04:00
oxalica
99d1311d63 Avoid unnecessary unwrap 2024-09-06 02:05:32 -04:00
oxalica
81a566a097 Move database logic into submodule and do simple version check 2024-09-06 02:05:27 -04:00
oxalica
a37bc3f81e Return the latest message in room list for display 2024-09-03 15:09:54 -04:00
oxalica
2eb884766a Impl room leaving and fix frontend room combobox 2024-09-03 05:39:06 -04:00
oxalica
cc51d53575 Fix frontend 2024-09-03 04:39:36 -04:00
oxalica
57b17547ca Impl room listing for testing frontend 2024-09-03 04:31:32 -04:00
oxalica
6831c3d25a Fix missed attrs on room creation 2024-09-03 04:08:34 -04:00