Commit graph

145 commits

Author SHA1 Message Date
oxalica
bc6e6c2056 refactor(webapi,types)!: make challenge type extensive
We may allow more challenge types other than PoW in the future, eg.
captcha. So make the relevent types more generic.

Now the challenge is returned in JSON response as a individual top-level
field `register_challenge` instead of in HTTP headers.
2024-10-01 05:26:00 -04:00
oxalica
364e517b7d frontend: improve layout and registration 2024-09-30 19:34:22 -04:00
oxalica
76a9e501c5 doc: add server metadata API 2024-09-28 23:19:57 -04:00
oxalica
5f29b23f9d fix(blahd): fix error message formating 2024-09-28 21:41:34 -04:00
oxalica
458f4b163f test: test feed response and nonce invalidation 2024-09-28 21:40:14 -04:00
oxalica
31dc3e33c6 feat(types,blahd): allow using mock clock for testing 2024-09-28 21:30:42 -04:00
oxalica
1a4980ebba feat(blahd): set Cache-Control 2024-09-25 15:14:43 -04:00
oxalica
cd7d0f773f feat(blahd): impl ETag for server metadata 2024-09-25 14:08:12 -04:00
oxalica
70481e6c74 feat(blahd): impl ETag for feed 2024-09-25 14:04:58 -04:00
oxalica
fac146e859 build: validate CFG_SRC_URL and simplify CFG_RELEASE handling 2024-09-25 12:45:34 -04:00
oxalica
fa14844d0d feat(webapi): expose server metadata 2024-09-25 12:45:26 -04:00
oxalica
8551540798 refactor(types)!: blow up big lib.rs into submods 2024-09-25 11:15:31 -04:00
oxalica
066061e2ec feat(blahctl): add database commands to modify users and rooms 2024-09-24 22:59:32 -04:00
oxalica
a972477171 remove(blahctl): remove API request commands
They should be implemented by frontend and there is no need to send
self-request on the server. Privileged operations should be done by
directly manipulate the database.
2024-09-24 22:58:55 -04:00
oxalica
3cc6017ae0 refactor(blahctl)!: update to new id-desc and schema 2024-09-24 21:54:54 -04:00
oxalica
10dcc64fe9 build(deps): update cargo and flake lock 2024-09-24 20:39:27 -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
5f03a4ca03 doc: fix missed Atom feed endpoint 2024-09-24 19:12:56 -04:00
oxalica
487099474f feat(webapi): impl atom feed and use tag URI for feed id 2024-09-23 20:32:24 -04:00
oxalica
94e5913513 refactor(blahd),test: move feed generation into submod and add test 2024-09-23 20:32:24 -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
82f69eb96a bench: move to blah-types and add for sign/verify 2024-09-23 14:49:36 -04:00
oxalica
2fe8dfdab7 test: add more tests for register verification 2024-09-22 12:18:41 -04:00
oxalica
7ab1d4a935 build(deps): update flake lock 2024-09-22 12:18:41 -04:00
oxalica
dd940d5769 feat(types): impl Debug,From<{&,}VerifyingKey> for PubKey 2024-09-22 07:28:21 -04:00
oxalica
b93ff2882e fix(test/socket_activate): inherit env vars
This should fix coverage test.
2024-09-22 06:36:02 -04:00
oxalica
475bd59117 build(deps): update dependencies and omit minor version spec 2024-09-22 05:58:39 -04:00
oxalica
7384888128 feat(blahd): impl graceful shutdown 2024-09-22 05:16:10 -04:00
oxalica
5143e30fbe build(nix): add cargo-llvm-cov 2024-09-22 05:03:21 -04:00
oxalica
883fac02ae test: add for WS 2024-09-22 04:43:11 -04:00
oxalica
4bca196df3 fix(event): consistently use i64 for uid 2024-09-21 15:21:52 -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
9acf857781 refactor(test): use real RNG and simplify
We do not assert on the fake RNG and it should work well with any RNG.
2024-09-21 14:20:36 -04:00
oxalica
8f20aa0cf2 feat(types): add trait SignExt for easy chaining 2024-09-21 13:57:27 -04:00
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