Only lowercase and even-length tag values are stored as binary BLOBs.
Previously there was an error which search results from being returned
if the tag value was mixed-case and could be interpreted as hex.
A new database migration has been created to repair the `tag` table
for existing relays.
fixes: https://todo.sr.ht/~gheartsfield/nostr-rs-relay/37
The original implementation of subscription limit applied to the
entire query, instead of the specific filter. Now, each filter gets
its own query limit. When a limit is applied, the most recent N
events will be returned, otherwise the default is to return the
earliest events (in order), for all matching events.
This was quickly sneaked in by fiatjaf per my request[0], it makes many
queries more efficient and allows for paging when combined with until.
It is a bit weird to have multiple limits on each filter... for now we
just choose any or the last limit seen.
[0]: a4aea5337f
Signed-off-by: William Casarin <jb55@jb55.com>
This adds a new configurable feature to restrict event publishing to
only users with NIP-05 verified metadata. Domains can be whitelisted
or blacklisted. Verification expiration and schedules are
configurable.
This upgrades the database to add a table for tracking verification
records.
This is an experimental feature, outside of any NIP, that demonstrates
generic tag queries.
Instead of limiting subscription filters to just querying only "e" or
"p" tags (via `#e` or `#p` attributes), any tag can be queried.
As an example, consider an event which uses a tag "url". With this
modification, a subscription filter could add a top-level field
"#url", with an array of strings as the key. Exact matches would be
returned.
A NIP is forthcoming to formalize this.
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
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.
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.