Commit graph

20 commits

Author SHA1 Message Date
oxalica
8551540798 refactor(types)!: blow up big lib.rs into submods 2024-09-25 11:15:31 -04:00
oxalica
a38b59da84 fix(types,blahd): reject timestamps > i64::MAX 2024-09-24 20:36:27 -04:00
oxalica
c4fbf1294b fix(blahd): merge queries for last-seen update 2024-09-24 19:37:50 -04:00
oxalica
0911d56e22 refactor(blahd,webapi)!: overhaul error type
Error types are now collected into a single place. Similar errors are
merged.

Request invariant violations are now all under 400 with type
"invalid_request" if it's a client mistake; and if it's caused by a
server restrction, under 403 with type "disabled".
2024-09-24 19:12:56 -04:00
oxalica
1e8c16888c refactor(blahd): use NonZero/u32 for page length
This avoids platform-dependent `usize` in configuration and webapi.
2024-09-23 18:04:26 -04:00
oxalica
a7f31e5fad refactor(webapi)!: avoid u64/i64 usage in types except timestamp
We do not need that many big numbers yet. This should simplify client
implementation without native u64 (eg. JavaScript).

Also put a hard limit on `unseen_cnt` query.
2024-09-21 15:14:50 -04:00
oxalica
ad3e422902 fix(webapi): reject mark-seen for future msgs 2024-09-21 14:58:51 -04:00
oxalica
bc856f6c62 feat(webapi): impl room deletion 2024-09-21 14:46:47 -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
7b0ca8aa16 test,ci: validate version of sqlite and fix ci 2024-09-17 23:08:30 -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
2775068e49 refactor(config): split into subsections and verify on parsing 2024-09-13 07:20:48 -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
4f0f1405dc Librarify blahd for testing 2024-09-10 01:29:21 -04:00
oxalica
e74da2812b Maintain room member's last seen item and fix docs 2024-09-06 03:33:21 -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
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