Commit Graph

118 Commits

Author SHA1 Message Date
William Casarin
47e0b0ed52 nostrdb: update to fix sub memleak 2024-12-17 09:19:35 -08:00
Ken Sedgwick
e1a55c6532 update nostrdb-rs for async stream support
Closes: https://github.com/damus-io/notedeck/pull/584
2024-12-17 08:56:48 -08:00
Ken Sedgwick
7da98b3c5c fix android build with cargo update num_enum@0.7.3
Compiling num_enum v0.7.3
error[E0463]: can't find crate for `num_enum_derive`

Closes: https://github.com/damus-io/notedeck/pull/584
2024-12-17 08:56:45 -08:00
William Casarin
e5ab8d5b9c nostrdb: update to fix profile queries
before profile queries were not working at the database level,
because there was no note_pubkey or note_pubkey_kind index. Now there
is! So profiles should be much faster to query now, and will actually
return results.

There still appears to be an issue with the profile NotesHolder which
is preventing it from updating, via the logic in poll_notes_into_view.
The original Timeline version of this function works fine, but it looks
like the NotesHolder one is broken.

Going to work on refactoring the notes holder next to fix.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-12-13 23:35:08 -08:00
William Casarin
ab829b45fc enostr: update ewebsock
This was using an ancient version of rustls, which in turn included
an old version of ring, which was the real reason of the windows
compile issues (i think)

Cc: kernelkind <kernelkind@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2024-12-13 11:01:09 -08:00
William Casarin
08a5ed1076 lockfile: update
Signed-off-by: William Casarin <jb55@jb55.com>
2024-12-13 10:01:53 -08:00
William Casarin
c3bbc6b977 android: fix issues due to rearchitecture 2024-12-13 09:36:10 -08:00
William Casarin
ec755493d9 Introducing Damus Notedeck: a nostr browser
This splits notedeck into:

- notedeck
- notedeck_chrome
- notedeck_columns

The `notedeck` crate is the library that `notedeck_chrome` and
`notedeck_columns`, use. It contains common functionality related to
notedeck apps such as the NoteCache, ImageCache, etc.

The `notedeck_chrome` crate is the binary and ui chrome. It is
responsible for managing themes, user accounts, signing, data paths,
nostrdb, image caches etc. It will eventually have its own ui which has
yet to be determined.  For now it just manages the browser data, which
is passed to apps via a new struct called `AppContext`.

`notedeck_columns` is our columns app, with less responsibility now that
more things are handled by `notedeck_chrome`

There is still much work left to do before this is a proper browser:

- process isolation
- sandboxing
- etc

This is the beginning of a new era! We're just getting started.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-12-12 20:08:55 -08:00
William Casarin
74c5f0c748 split notedeck into crates
This splits notedeck into crates, separating the browser chrome and
individual apps:

* notedeck: binary file, browser chrome
* notedeck_columns: our columns app
* enostr: same as before

We still need to do more work to cleanly separate the chrome apis
from the app apis. Soon I will create notedeck-notebook to see what
makes sense to be shared between the apps.

Some obvious ones that come to mind:

1. ImageCache

We will likely want to move this to the notedeck crate, as most apps
will want some kind of image cache. In web browsers, web pages do not
need to worry about this, so we will likely have to do something similar

2. Ndb

Since NdbRef is threadsafe and Ndb is an Arc<NdbRef>, it can be safely
copied to each app. This will simplify things. In the future we might
want to create an abstraction over this? Maybe each app shouldn't have
access to the same database... we assume the data in DBs are all public
anyways, but if we have unwrapped giftwraps that could be a problem.

3. RelayPool / Subscription Manager

The browser should probably maintain these. Then apps can use ken's
high level subscription manager api and not have to worry about
connection pool details

4. Accounts

Accounts and key management should be handled by the chrome. Apps should
only have a simple signer interface.

That's all for now, just something to think about!

Signed-off-by: William Casarin <jb55@jb55.com>
2024-12-11 11:24:29 -08:00
Ken Sedgwick
35138cd951 android: update to winit 0.30.5 2024-12-09 10:40:04 -08:00
William Casarin
1b31557b03 prevent users from running as debug
We give a friendly message now. If you need to run as debug,
use `cargo run -- --debug` or `./target/debug/notedeck --debug`

We also remove the callstack feature because it doesn't seem
like you need it for widget callstacks.

Fixes: aafddf5acb ("debug: add crate features which enable egui DebugOptions")
Signed-off-by: William Casarin <jb55@jb55.com>
2024-12-07 20:56:14 -08:00
William Casarin
720230ca55 fix profiler
I updated puffin to egui v0.29.1 and now it works

Signed-off-by: William Casarin <jb55@jb55.com>
2024-12-07 19:53:32 -08:00
William Casarin
323d1bcd2c Migrate to egui v0.29.1
Not too many breaking changes. I updated egui-nav and egui-tabs as well.

Fixes: https://github.com/damus-io/notedeck/issues/315
Changelog-Fixed: Fixed crash when navigating in debug mode
Changelog-Changed: Migrated to egui v0.29.1
Signed-off-by: William Casarin <jb55@jb55.com>
2024-12-07 16:40:43 -08:00
William Casarin
be3edc02a4 nav: refactor title rendering for flexibility
Updated navigation to use a custom title renderer for more flexible
rendering of navigation titles. This change decouples the rendering
logic from predefined formats, enabling dynamic title compositions
based on application context and data.

This includes:
- Refactoring `NavResponse` to introduce `NotedeckNavResponse` for
  handling unified navigation response data.
- Adding `NavTitle` in `ui/column/header.rs` to handle rendering
  of navigation titles and profile images dynamically.
- Updating route and timeline logic to support new rendering pipeline.
- Replacing hardcoded title rendering with data-driven approaches.

Benefits:
- Simplifies navigation handling by consolidating title and action
  management.
- Improves scalability for new navigation features without modifying
  core logic.
- Enhances visual customization capabilities.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-12-05 10:58:59 -08:00
William Casarin
78210e8208 ui: fix quote repost hitbox
The response from the wide rendered note was incorrect, leading to and
incorrectly sized hitbox. This fixes that.

Additionally, we include note options and note parent into the hitbox
key, as this may influence the size of the note.

Before: https://cdn.jb55.com/s/b2464c22a65adb12.png
After: https://cdn.jb55.com/s/52545564d98d278e.png

Fixes: https://github.com/damus-io/notedeck/issues/519
Closes: https://github.com/damus-io/notedeck/pull/537
Changelog-Fixed: Fix broken quote repost hitbox
Signed-off-by: William Casarin <jb55@jb55.com>
2024-12-03 17:53:29 -08:00
Ken Sedgwick
aafddf5acb debug: add crate features which enable egui DebugOptions
--features debug-widget-callstack
  Show callstack for the current widget on hover if all modifier keys
  are pressed down

--features debug-interactive-widgets
  Show an overlay on all interactive widgets

Notes:
- debug-widget-callstack asserts `egui:callstack` feature when enabled
- Only works in debug builds, compile error w/ release builds
2024-12-03 09:09:02 -08:00
Ken Sedgwick
f00a67ab2c Update user relay-list via polling 2024-12-02 13:14:50 -08:00
William Casarin
8d59260935 windows: handle large mapsizes gracefully
Update nostrdb to gracefully handle mapsizes that
are too large and fail to create nostrdb files.

We now keep shrinking the mapsize until database creation
succeeds. We still use the default mapsize of 32GiB on
windows, which is a bit annoying until we have nostrdb
resizing like monero.

Fixes: https://github.com/damus-io/notedeck/issues/491
2024-11-28 16:52:00 -08:00
William Casarin
a1d8adfff3 deps: switch to windows nostrdb-rs
Signed-off-by: William Casarin <jb55@jb55.com>
2024-11-27 14:34:00 -08:00
William Casarin
3fb78ae01e nav: use id_source instead of show argument
Signed-off-by: William Casarin <jb55@jb55.com>
2024-11-13 16:14:56 -08:00
William Casarin
702f8ffca3 Merge a few relay fixes from ken
Pick a few fixes from #380

Link: https://github.com/damus-io/notedeck/pull/380

Ken Sedgwick (5):
      build: Cargo.lock updates to mitigate num_enum_derive problem
      add .rustfmt.toml to specify edition
      Fix parsing of subscription id for RelayMessage::Event
      Skip adding relays that are already in the pool
      canonicalize relay urls to avoid false duplicates
2024-11-11 11:19:56 -08:00
Ken Sedgwick
ae4b7750cc Restore RUST_LOG filtering, default to INFO if absent 2024-10-30 10:39:51 -07:00
Ken Sedgwick
570d64c3cd canonicalize relay urls to avoid false duplicates 2024-10-29 13:42:29 -07:00
Ken Sedgwick
2baf9dfed0 build: Cargo.lock updates to mitigate num_enum_derive problem 2024-10-29 13:42:26 -07:00
kernelkind
503b7edeb5 use open instead of egui OpenUrl for mailto link
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-10-28 17:02:40 -04:00
kernelkind
309477dca4 support view
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-10-25 15:23:35 -04:00
kernelkind
03bfb34172 app window size persists on app close
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-10-25 15:23:35 -04:00
kernelkind
d3b4a9efc1 write log files to disk daily and on panic
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-10-25 15:23:35 -04:00
kernelkind
4f86e9604f file storage
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-10-25 15:23:35 -04:00
William Casarin
f7c6e2774e update to use upstream egui-nav branch
Signed-off-by: William Casarin <jb55@jb55.com>
2024-10-11 12:54:49 +02:00
kernelkind
b1549a52c7 tmp: kernelkind/egui-nav
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-10-08 21:43:31 -04:00
kernelkind
983640b85a tmp: kernelkind/egui-nav
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-10-08 21:37:16 -04:00
kernelkind
0a22210c89 tmp use kernelkind egui-nav
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-10-07 12:42:51 -04:00
William Casarin
b3f065fd2e nostrdb: update to support fast kind6 repost ingest
Signed-off-by: William Casarin <jb55@jb55.com>
2024-09-17 15:28:01 -07:00
William Casarin
37fbde1566 fix some rebase issues
Signed-off-by: William Casarin <jb55@jb55.com>
2024-09-11 16:24:43 -07:00
kernelkind
7fa7529a1d cargo update
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-09-11 16:14:57 -07:00
William Casarin
00091c5088 Switch to Columns
Also refactor damus app usage to only pass in things that we need in views.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-09-11 15:49:34 -07:00
Ken Sedgwick
085c6f1992 build: updated num_enum to get around build problem
Problem:
```
error[E0463]: can't find crate for num_enum_derive
  --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num_enum-0.7.2/src/lib.rs:10:11
   |
10 | pub use ::num_enum_derive::{
   |           ^^^^^^^^^^^^^^^ can't find crate
```
2024-09-02 17:54:49 -07:00
William Casarin
036c257379 update image to 0.25
Signed-off-by: William Casarin <jb55@jb55.com>
2024-09-02 17:54:49 -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
21fd57f2c5 nostrdb: bump version
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-30 07:17:56 -07:00
William Casarin
9b4093cd41 update to latest nostrdb version
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-21 06:59:27 +03: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
f769ddad09 fix threads
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-06 14:38:21 -07:00
William Casarin
c3fc4e09e8 thread: fix ordering and duplication bugs
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:55:06 -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
06028ba66e deps: update deps for thread-needed changes
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-16 12:54:45 -07:00
William Casarin
6b634646d5 fix nostrdb crash
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-15 12:39:42 -07:00
William Casarin
239a2cb701 Switch to egui master to fix wgpu issues
There are some wgpu issues that are fixed in egui-master, so
let's switch to that.

This fixes notedeck so that it runs on both my intel graphics laptop
and amdgpu desktop.

Fixes: https://github.com/damus-io/notedeck/issues/28
Fixes: https://github.com/damus-io/notedeck/issues/42
Fixes: https://github.com/damus-io/notedeck/issues/141
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-02 17:48:18 -07:00
William Casarin
9eea457bda switch to glow for now
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-02 16:12:04 -07:00