Commit Graph

460 Commits

Author SHA1 Message Date
Greg Heartsfield
19637d612e build: bump version to 0.3.1 2022-01-01 19:26:15 -06:00
Greg Heartsfield
afc9a0096a improvement: logging failed queries and timing 2022-01-01 19:25:09 -06:00
Greg Heartsfield
3d56262386 build: bump version to 0.3.0 2022-01-01 18:40:57 -06:00
Greg Heartsfield
6673fcfd11 feat: implement multi-valued filter searching
NIP-01 now uses arrays instead of scalars.

Fixes https://todo.sr.ht/~gheartsfield/nostr-rs-relay/17
2022-01-01 18:38:52 -06:00
Greg Heartsfield
b5da3fa2b0 docs: link to docker hub 2022-01-01 12:27:09 -06:00
Greg Heartsfield
850957213e build: bump version to 0.2.3 2022-01-01 09:13:13 -06:00
Greg Heartsfield
1aa5a5458d improvement: event signature validation is 100x faster
Switched to latest (git) release of secp256k1, which has more
efficient verification-only context for Schnorr.  Switched to single
pre-instantiated instance of the verifier.
2022-01-01 09:08:19 -06:00
Greg Heartsfield
620e227699 fix: connection issues with Firefox
This adds Hyper, and a 200 response code.  Prior to this, Firefox
would fail to connect.  There is also a text document displayed at the
root URL to indicate this is a Nostr relay.

Fixes https://todo.sr.ht/~gheartsfield/nostr-rs-relay/15
2022-01-01 08:11:20 -06:00
Greg Heartsfield
14e59ed278 build: bump version to 0.2.2 2021-12-31 16:34:52 -06:00
Greg Heartsfield
5ad383f257 fix: incorrect logic on empty filters for hidden events 2021-12-31 16:34:10 -06:00
Greg Heartsfield
9710ea27aa build: bump version to 0.2.1 2021-12-31 15:38:58 -06:00
Greg Heartsfield
783a6e1042 docs: fix docker examples 2021-12-31 15:28:26 -06:00
Greg Heartsfield
4171a8870e feat: reject events that are too large
A new configuration setting controls the maximum size of event
messages, and sends a notice to the client if they exceed it.

Fixes https://todo.sr.ht/~gheartsfield/nostr-rs-relay/14
2021-12-31 15:19:35 -06:00
Greg Heartsfield
8f3891c781 docs: docker and config updates 2021-12-31 14:08:04 -06:00
Greg Heartsfield
415d32299b fix: docker run references the correct database file 2021-12-31 14:05:11 -06:00
Greg Heartsfield
5a19a8876f feat: allow database directory configuration
Adds configuration options for database directory, either on command
line through (--db dir-name) or the config.toml file.

Fixes: https://todo.sr.ht/~gheartsfield/nostr-rs-relay/13
2021-12-31 11:51:57 -06:00
Greg Heartsfield
f7f12a7984 build: bump version to 0.2.0 2021-12-30 21:27:48 -06:00
Greg Heartsfield
20ee5a054c feat: rate limit event creation
A configuration option, `messages_per_sec`, imposes a global limit on
the rate for which new events can be stored.

Fixes https://todo.sr.ht/~gheartsfield/nostr-rs-relay/6
2021-12-30 21:07:21 -06:00
Greg Heartsfield
c60519de23 feat: hide older contact update events
Type 3 (NIP-02) contact lists are hidden when newer ones are submitted
for the same author.

Fixes https://todo.sr.ht/~gheartsfield/nostr-rs-relay/4
2021-12-30 15:45:03 -06:00
Greg Heartsfield
d72e7a57b6 feat: hide older metadata update events
This updates the database schema to support hiding events.  In this
case, we are hiding older metadata updates when an author provides an
updated event.

Fixes https://todo.sr.ht/~gheartsfield/nostr-rs-relay/11
2021-12-30 13:55:05 -06:00
Greg Heartsfield
6447ddd974 fix: compile error with missing import 2021-12-30 10:00:34 -06:00
Greg Heartsfield
079722ddd9 improvement: reduce logging level for rejected events 2021-12-30 06:35:36 -06:00
Greg Heartsfield
3302fb2e81 refactor: clippy suggestions 2021-12-29 22:49:46 -06:00
Greg Heartsfield
f415295184 feat: reject future-dated events
If configured, reject events than are more than N seconds in the
future.

Fixes https://todo.sr.ht/~gheartsfield/nostr-rs-relay/5
2021-12-29 22:47:31 -06:00
Greg Heartsfield
d730bf0c59 feat: add configuration through file
A file named `config.toml` can now be used to load the address, port,
and some websocket configuration settings.

Fixes https://todo.sr.ht/~gheartsfield/nostr-rs-relay/3
2021-12-29 22:13:02 -06:00
Greg Heartsfield
2e2e01203b build: bump version to 0.1.6 2021-12-23 21:44:12 -06:00
Greg Heartsfield
100f890284 feat: add until for request filters
This implements an additional filter criteria for selecting events
prior to some timestamp.

See https://github.com/fiatjaf/nostr/issues/39x
2021-12-23 21:38:32 -06:00
Greg Heartsfield
0e288fe678 feat: send messages in order of oldest to newest 2021-12-23 21:36:46 -06:00
Greg Heartsfield
bfc804e18c feat: debug protocol messages 2021-12-23 21:30:04 -06:00
Greg Heartsfield
8a8ee5c425 build: bump version to 0.1.5 2021-12-19 16:45:17 -06:00
Greg Heartsfield
55bb6bd440 feat: add resource limits for websocket messages 2021-12-19 16:26:32 -06:00
Greg Heartsfield
7933abaa48 fix: allow unknown fields, like author 2021-12-19 16:18:03 -06:00
Greg Heartsfield
9b959e1012 build: bump version to 0.1.4 2021-12-16 19:00:46 -06:00
Greg Heartsfield
5b6a20dfa6 feat: remove author from subscriptions (NIP-01 Spec)
The `authors` field is sufficient to represent all queries that
`author` could have been used in.  See
https://github.com/fiatjaf/nostr/issues/34 for the discussion leading
to this removal.
2021-12-16 18:53:53 -06:00
Greg Heartsfield
acf6231277 build: bump version to 0.1.3 2021-12-15 07:56:34 -06:00
Greg Heartsfield
49598b2c9e fix: subscription event filtering bugs
Subscriptions properly filter using the authors tag.  Petname/keys are
correctly filtered (previously the event tags were incorrectly used).
2021-12-14 21:38:26 -06:00
Greg Heartsfield
54e6e0e5ce build: bump version to 0.1.2 2021-12-12 20:36:11 -06:00
Greg Heartsfield
850064b871 fix: handle filters with no criteria 2021-12-12 14:52:55 -06:00
Greg Heartsfield
b3c7852b19 fix: correct SQL query for inserting pubkeys 2021-12-12 14:34:52 -06:00
Greg Heartsfield
6910b8d945 feat: add log for unique client connection count 2021-12-12 10:58:00 -06:00
Greg Heartsfield
531f6c4624 feat: improved NOTICE messages for events and subscriptions 2021-12-12 10:50:16 -06:00
Greg Heartsfield
1589268eba fix: use database to publish all events
This fixes a race condition where a publisher might send an event, and
immediately after issue a subscription for the same event ID.  Prior
to this change, that event would have been published on the broadcast
channel (and ignored by our publisher, because they had not yet issued
the subscription), but not yet committed to the database.  Their
subscription would trigger a database query which would return zero
results.  Therefore, they would never see the event they published.
The noscl tool is one client that would suffer from this.

Now, all events are broadcast only after they exist in the database,
so a late subscription will always return the event.
2021-12-12 10:20:23 -06:00
Greg Heartsfield
56c40f2be9 refactor: improve error messages 2021-12-12 10:03:28 -06:00
Greg Heartsfield
cacd1ccb36 docs: sample program output in README 2021-12-11 22:21:31 -06:00
Greg Heartsfield
ee8862be81 docs: README gives quickstart for docker 2021-12-11 22:19:49 -06:00
Greg Heartsfield
108938f709 feat: add data directory to Dockerfile 2021-12-11 22:18:05 -06:00
Greg Heartsfield
e732f918f9 refactor: clippy suggestions 2021-12-11 21:56:52 -06:00
Greg Heartsfield
ca0f01c94b docs: add rustdoc comments 2021-12-11 21:43:41 -06:00
Greg Heartsfield
04850506a8 build: upgrade dependencies 2021-12-11 16:58:18 -06:00
Greg Heartsfield
d79e0a59f5 config: change default websocket port 2021-12-11 16:57:55 -06:00