Commit Graph

210 Commits

Author SHA1 Message Date
William Casarin
bc8a8d4a74 perf: coordinate unknown id lookups
This is a huge improvement over what it was before. Now all unknown id
lookups are debounced and happen through a central coordinator. This
ensures there is no duplication between timelines.

Fixes: https://github.com/damus-io/notedeck/issues/279
Signed-off-by: William Casarin <jb55@jb55.com>
2024-09-02 17:38:18 -07:00
William Casarin
ad244d48c0 fetch contact lists
If we don't have a contact list, make sure to fetch one

Signed-off-by: William Casarin <jb55@jb55.com>
2024-09-02 16:22:29 -07:00
William Casarin
db49cf3c4b tidy: move ColumnKind to its own file
timeline file is starting to get messy

Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-31 08:08:17 -07:00
William Casarin
9a9342ad35 tidy: remove some crate:: namespaces
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-31 07:17:45 -07:00
William Casarin
5de78cef21 docs: fix comment in the wrong spot
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-31 05:43:43 -07:00
William Casarin
2ea6473ae2 refactor: move args to its own file
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-31 05:43:43 -07:00
William Casarin
71259a8dd5 timeline: initial contact queries
This implements initial local contact queries. For testing you can
create contact list columns via:

Examples
--------

Make a contacts column from a specific npub:

	$ notedeck --column contacts:npub...

Use the current user's contacts:

	$ notedeck --column contacts --pub npub...

We also introduce a new ColumnKind enum which is used to describe the
column type.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-30 08:59:48 -07:00
William Casarin
11ede2086f cli: add --pub support for watchonly accounts
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-30 08:59:37 -07:00
William Casarin
ea547a3497 tidy: move parse_args to Args::parse
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-30 08:49:29 -07:00
William Casarin
ae6c05ab42 tidy: organize bools
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-30 07:17:56 -07:00
William Casarin
cf14c6dfd2 flag to disable since optimization
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-21 07:48:45 +03:00
William Casarin
973a7c780f thread: remote subscriptions working
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-19 21:22:58 -07:00
William Casarin
9328ef2dff remove duplicate filter types
only use nostrdb::Filter

Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-19 21:12:32 -07:00
William Casarin
8c458f8f78 Merge initial threads 2024-08-16 11:51:42 -07:00
William Casarin
51b4dfd3f3 temp fix crash due to race condition
we should fix the race condition though

Link: https://github.com/damus-io/nostrdb/issues/35
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-03 11:41:41 -07:00
William Casarin
be0efd57e5 bump ingester threads from 2 to 4
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-03 11:38:46 -07:00
William Casarin
3cbcd98dd4 arg: add dbpath argument
This is great for testing without using an existing DB

Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-03 11:38:38 -07:00
William Casarin
ce5142656e bump ingester threads from 2 to 4
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-03 11:33:40 -07:00
William Casarin
abd529e91b arg: add dbpath argument
This is great for testing without using an existing DB

Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-03 11:32:56 -07:00
William Casarin
6e27c34267 update nostrdb to fix note corruption bug
Changelog-Fixed: fix note content corruption bug with damus.io links
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-01 13:44:28 -07:00
William Casarin
20f0aed2ed doc: add docs for get_unknown_note_ids
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 14:21:47 -07:00
William Casarin
4b644bee32 restore unknown id fetching of root notes
still technically depends on the notebuf branch

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:55:22 -07:00
William Casarin
d44c4c2f9c make local sub log more explicit
was hard to tell if this meant remote or local sub

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:51:24 -07:00
William Casarin
dd9f41b04a threads: ensure we always handle bar results
We were not handling it in ThreadView, now we do.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:51:24 -07:00
William Casarin
593df9145b threads: check for new notes locally when thread is re-opened
We have a NoteRef cache for threads in memory, which is just a list of
NoteKeys and timestamps.

When reopening a thread, query the local DB to see if there are any new
notes that we might have missed because we weren't actively subscribed
to them.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:51:24 -07:00
William Casarin
5be6b1ca68 ui: move timeline view to its own file
Also add some thread methods for fetching new notes

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:51:24 -07:00
William Casarin
a28db5d330 local thread subscriptions
This adds local nostrdb thread subscriptions. When navigating to a
thread, we first check to see if we have any active nostrdb
subscriptions for that thread. If not, we create a new subscription. If
we do, we re-use that subscription.

This works by storing thread state in the Threads struct in the Damus
application state.

When we pop a route, we check to see if its a thread route. If it is,
then we try to unsubscribe, but only if that is the last remaining
subscriber for that thread, as there could be more than one.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:51:24 -07:00
William Casarin
33e5b6886b threads: add initial thread support
This is a really dumb and broken version of threads, but it will be our
foundation for future changes.

All it currently does is load whatever notes we have locally for a
thread in chronological order. It currently does not open any
subscriptions. It is not clear what is replying to what, but hey, its a
start.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:51:24 -07:00
William Casarin
b917d48015 log: reduce ping/pong verbosity
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-28 13:40:29 -05:00
William Casarin
86f87fa0a5 noteref: move to note.rs
This doesn't need to be in timeline

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-16 12:51:30 -07:00
William Casarin
f2c5978ba5 allow relay pool customization via -r/--relay argument
This allows you to use specific relays instead of some random
bootstrap ones we are currently using

Fixes: https://github.com/damus-io/notedeck/issues/154
Changelog-Added: Add -r/--relay cli option for customized relay pool
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-11 11:25:21 -07:00
William Casarin
cc734e2a66 logs: add relay string to relay connection errors
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-10 16:00:38 -07:00
William Casarin
5805df266a don't use an actual keystorage in Damus test apps
Reported-by: kernelkind <kernelkind@gmail.com>
Fixes: https://github.com/damus-io/notedeck/issues/150
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-05 07:38:58 -07:00
kernelkind
a890c9e970 select first account
closes: https://github.com/damus-io/notedeck/issues/119

Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-07-02 13:12:20 -04:00
William Casarin
e9da25266a enable nip10 replies
you can now reply to notes

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-01 19:22:43 -07:00
William Casarin
b31bd2470b keys: actually use the keystore
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-01 11:13:22 -07:00
William Casarin
4c490e1436 Merge 'impl linux credential storage' #115
From PR description:

See the test_basic() test in linux_key_storage.rs. I ran it successfully
on my MacOS machine and a linux VM. The BasicFileStorage impl just
stores each Keypair as a SerializableKeypair json object with the file
name as the public key hex in ~/.notedeck_credentials. The
SerializableKeypair uses the nip49 EncryptedSecretKey, but we just use
an empty string as the password for now.

The BasicFileStorage impl works in MacOS, but it only conditionally
compiles to linux for simplicity.

pub enum KeyStorageResponse<R> {
    Waiting,
    ReceivedResult(Result<R, KeyStorageError>),
}

This is used as a response so that it's possible for the storage impl to
be async, since secret_service is async. It seems that secret_service
would allow for a more robust linux key storage impl so I went ahead and
made the API compatible with an async impl.

* kernelkind (1):
      impl linux credential storage
2024-07-01 10:49:15 -07:00
William Casarin
6f6d5f05af always have some default timeline
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-01 10:35:47 -07:00
William Casarin
69a8438f33 cleanup some dead code
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-01 07:31:43 -07:00
William Casarin
2d10b20ae2 allow multiple invocations of --sec
for multi-account

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-01 07:02:22 -07:00
William Casarin
a04df88ff6 initial note posting
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-01 06:49:12 -07:00
William Casarin
8dc829791e cli: add --sec argument to quickly add an account
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-01 06:41:32 -07:00
William Casarin
3ed09dadf0 damus: make relay pool public
we will be using this for our post view

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-01 06:39:39 -07:00
William Casarin
307b8af8f1 enostr: rename Event to Note
we will likely replace Note with nostrdb::Note in the future,
this just helps with that transition

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-01 06:38:08 -07:00
kernelkind
2a47a66bbb impl linux credential storage
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-06-28 15:27:46 -04:00
William Casarin
26c4d90be3 initial postbox for testing
not sure if we want to put this here yet, but it matches the design
and will be useful for testing

Fixes: https://github.com/damus-io/notedeck/issues/110
Suggested-by: Rob
2024-06-25 14:08:56 -05:00
William Casarin
a6856867a9 Merge remote-tracking branch 'pr/107' 2024-06-25 13:20:56 -05:00
William Casarin
f8c8e48c26 postview: add vertical scroll
Suggested-by: kernelkind <kernelkind@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-24 16:19:06 -07:00
kernelkind
6afb618089 reintroduce account management
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-06-23 20:04:00 -04:00
William Casarin
0b3d6f7e37 initial post reply view
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-21 14:01:40 -07:00