48 Commits

Author SHA1 Message Date
fiatjaf
80586c4573
update go-nostr to fix the OK envelope bug. 2023-11-04 17:31:39 -03:00
fiatjaf
6acf1b4366
update eventstore and badger/lmdb examples. 2023-11-02 20:16:17 -03:00
fiatjaf
bf2c9e4640
use eventstore release v0.0.1 2023-10-31 16:48:05 -03:00
fiatjaf
b6e7fabeb6
move storage plugins to eventstore module. 2023-10-31 16:38:32 -03:00
fiatjaf
bbe186494e
replace mutex-guarded maps with xsync/v2 maps. 2023-10-03 08:32:07 -03:00
fiatjaf
8968982b9a
relayer, second attempt, now much better. 2023-08-10 14:32:11 -03:00
fiatjaf
dc594ee32b
migrate to fasthttp/websocket. 2023-06-23 07:10:59 -03:00
fiatjaf
ebfff13b18 use envelopes everywhere. 2023-06-16 17:48:34 -03:00
fiatjaf
b2bf358789
update to go-nostr 0.18.3 2023-05-18 09:47:04 -03:00
Yasuhiro Matsumoto
2771d9b8ba fix(all): use v2 module 2023-05-08 12:49:11 -03:00
bndw
ae641fd24d refactor(postgres): make SQL generation testable
Decouples the postgresql sql generation from the query execution.
This allows the logic for building sql to be unit tested without
access to a database.

This work was motivated when a client was not receiving events as
expected. In debugging I found that if a tag's value was an empty array,
then no query would be executed - and to my surprised no error is
raised either. I wanted to get a better sense of the current constraints on
when queries are and are not executed, but I had a hard time keeping the
code in my head. This led me to extracting the sql generation into its
own function and writing the unit tests that document its current
behavior. This refactor makes no changes to the current logic. I have added
some REVIEW comments in the test cases where I thought some error handling
could be introduced but I wanted to first see if you were receptive to this
refactor before proposing any functional changes.
2023-05-02 12:41:51 -03:00
fiatjaf
4e15120111
migrate all built-in storage backends. 2023-05-01 19:41:17 -03:00
fiatjaf
e3d4655dba
v2 with breaking changes and a simpler API. 2023-05-01 19:21:09 -03:00
mattn
0e7c7f8abb
add sqlite3 storage (#40)
* add sqlite3 storage

* filter by content

* remove needless files

* update go.mod

* do not unquote Search
2023-02-26 14:57:47 -03:00
fiatjaf
eb0c6539b6
update go-nostr dependency and gitignore search binary. 2023-02-15 20:27:51 -03:00
Steve Perkins
a7a0bb6682 Use dsl builder for es query 2023-02-15 16:29:54 -05:00
Steve Perkins
0e18a49861 wip docker-compose setup 2023-02-13 20:44:06 -05:00
Steve Perkins
05600231b4 support search req a-la nip-50 2023-02-10 14:58:01 -05:00
Steve Perkins
d306c03369 basic elasticsearch storage example 2023-02-06 13:30:51 -05:00
fiatjaf
905a68cd91
update dependencies. 2023-01-26 20:03:50 -03:00
fiatjaf
fe91197d45
implement nip-42 AUTH and restrict DMs to authed users. 2023-01-15 22:38:24 -03:00
fiatjaf
e70a5601c7
update go-nostr and fix rss-bridge. 2023-01-02 14:31:28 -03:00
alex
627724f702 start: introduce Server type and Shutdown (breaking change)
the main motivation for this change is to be able to run tests.
before this commit, Start, Router and Log operated on global variables,
making automated testing unreasonably hard.

this commit puts all that a server needs in a new Server type,
which also made it possible for a Server.Shutdown - see ShutdownAware
doc comments.

BREAKING CHANGES:
- Relay.OnInitialized takes one argument now, *relayer.Server.
- relayer.Router is now replaced by relayer.Server.Router().
  package users can still hook into the router from OnInitialized
  for custom HTTP routing.
- relayer.Log is gone. apart from another global var, imho this was
  a too opinionated choice for a framework to build a custom relay upon.
  this commit introduces a Logger interface which package users can implement
  for zerolog to make it log like before. see Server.Log for details.

other notable changes: finally added a couple basic tests, for start up
and shutdown. doc comments now explain most of the essentials,
hopefully making it more approachable for newcomers and easier to understand
the relayer package.

the changes in handlers.go are minimal, although git diff goes crazy.
this is because most of the lines are simply shifted indentation back by one
due to go fmt.

before this commit:

    func handleWebsocket(relay Relay) func(http.ResponseWriter, *http.Request)
    func handleNIP11(relay Relay) func(http.ResponseWriter, *http.Request)

after:

    func (s *Server) handleWebsocket(w http.ResponseWriter, r *http.Request)
    func (s *Server) handleNIP11(w http.ResponseWriter, r *http.Request)
2022-12-24 20:41:02 -03:00
fiatjaf
9684033223
update go-nostr dependency and tag release. 2022-12-19 09:31:49 -03:00
fiatjaf
5f8908e028
update go-nostr dependency. 2022-11-26 09:27:08 -03:00
fiatjaf
d7aba0b21f
fix some dependencies and storage instantiation on example relays. 2022-11-11 09:46:18 -03:00
fiatjaf
eee9952fac base58 bad-coding session. 2022-08-12 17:02:40 -03:00
fiatjaf
396ca4d3a0 use updated lnsocket library. 2022-07-25 15:03:37 -03:00
fiatjaf
13d57303b5 support "limit" field on filters. 2022-07-24 19:58:34 -03:00
fiatjaf
fbb81c868c bring in and refactor rss bridge. 2022-07-24 19:52:25 -03:00
fiatjaf
aa96fa0a21 refactor framework interface, simplify basic and whitelisted, bring expensive on and rewrite it. 2022-07-24 17:41:00 -03:00
fiatjaf
d2ce4dbf54 implement nip-16 on closed and basic relays. 2022-07-24 11:48:34 -03:00
fiatjaf
440a64ef28 update go-nostr. 2022-07-24 11:35:49 -03:00
fiatjaf
42fee9cb1d update go-nostr. 2022-05-02 16:55:23 -03:00
fiatjaf
e50a298496 update go-nostr for a fix. 2022-02-13 20:37:51 -03:00
fiatjaf
f9d058a95a adapt to updated go-nostr. 2022-02-13 08:40:06 -03:00
fiatjaf
3e20e6c7cc renaming Equal -> FilterEqual 2022-01-02 09:08:05 -03:00
fiatjaf
629c9174eb update go-nostr. 2022-01-02 09:00:14 -03:00
fiatjaf
9a455b8db6 update go-nostr with new nip-01 slices of everything. 2022-01-01 21:36:56 -03:00
fiatjaf
b4f94b8fdd add .Until filtering to event query. 2021-12-26 07:11:19 -03:00
fiatjaf
0265be6d31 upgrade to go-nostr v0.2.0. 2021-12-16 20:54:57 -03:00
fiatjaf
5a797d2c65 fix jsonpath-based taq query. 2021-11-28 16:55:39 -03:00
fiatjaf
694eccd0c8 small fixes and guards. 2021-02-23 00:27:16 -03:00
fiatjaf
d4aa16f38a update go-nostr dependency. 2021-02-21 23:43:24 -03:00
fiatjaf
db384be3f9 fix some query bugs. 2021-02-17 16:59:56 -03:00
fiatjaf
d0c627968b update go-nostr dependency to reflect an actually published version. 2021-02-15 11:49:15 -03:00
fiatjaf
9c992c90dc adapt to new nip-01. 2021-02-14 21:08:02 -03:00
fiatjaf
e9cbff07a4 migrate off of main nostr repository. 2021-01-13 23:46:06 -03:00