Commit Graph

224 Commits

Author SHA1 Message Date
William Casarin
a04a401292 nscript: load script view
This allows you to open and run scripts for testing purposes, but only
from external links such as nostr:nscript...
2023-07-04 11:48:27 -07:00
640fbf23ea Fix UI bug with user search and fix race conditions on profiles NIP-05 cache
Signed-off-by: Terry Yiu <git@tyiu.xyz>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-07-04 09:09:14 -07:00
William Casarin
97f10e865f NostrScript
NostrScript is a WebAssembly implementation that interacts with Damus.
It enables dynamic scripting that can be used to power custom list views,
enabling pluggable algorithms.

The web has JavaScript, Damus has NostrScript. NostrScripts can be
written in any language that compiles to WASM.

This commit adds a WASM interpreter I've written as a mostly-single C
file for portability and embeddability. In the future we could
JIT-compile these for optimal performance if NostrScripts get large and
complicated. For now an interpreter is simple enough for algorithm list
view plugins.

Changelog-Added: Add initial NostrScript implementation
Signed-off-by: William Casarin <jb55@jb55.com>
2023-07-03 14:31:38 -07:00
6e964f71ff Add trie-based user search cache to replace non-performant linear scans
Changelog-Added: Speed up user search
Tested-by: William Casarin <jb55@jb55.com>
Fixes: #1219
Closes: #1342
2023-07-03 12:06:01 -07:00
William Casarin
c00746758e nozaps: disable donation star unless you're on freedom edition 2023-06-23 20:46:27 +02:00
William Casarin
c6a226fff8 Revert "ping: switch to async style"
This was causing crashes =/
2023-06-23 11:46:42 +02:00
William Casarin
b7b7d65612 perf: don't use string concat when calculing SeenEven hash
Profiler was complaining about this one
2023-06-20 17:00:48 +02:00
William Casarin
6eb548a0a9 Fix reconnect loop issues on iOS17
Changelog-Fixed: Fix reconnect loop issues on iOS17
2023-06-20 11:21:21 +02:00
William Casarin
bcaa1d2354 ping: switch to async style
because reasons
2023-06-20 11:21:07 +02:00
Bryan Montz
2901cc860f make RelayConnection's state observable 2023-06-20 10:18:34 +02:00
Bryan Montz
71bb9d6c92 Add text description to WebSocket for state logging 2023-06-10 12:39:25 +02:00
14977fe3dd Replace indexed mentions with NIP-27
Changelog-Fixed: Replace indexed mentions with NIP-27
Closes: #1213
2023-06-07 06:22:38 +02:00
Bryan Montz
fe4277e817 simplified call site usage of NostrFilter 2023-05-29 12:19:27 -07:00
Bryan Montz
e10dc93233 add damus_donation to profile data model and update tests 2023-05-26 07:02:14 -05:00
Bryan Montz
ea73c5252d Merge branch 'master' into user-cache 2023-05-26 06:46:47 -05:00
Bryan Montz
7e963c9025 synchronize access to network_pull_date_cache with a queue, writes with barrier flag 2023-05-26 06:38:20 -05:00
Bryan Montz
61ff7da2ae make database write async at the call site and update tests 2023-05-25 09:09:50 -05:00
Bryan Montz
7259641e26 speed optimizations: cache network_pull_date in memory and ensure writes on background queue 2023-05-25 08:20:41 -05:00
1769b08147 Fix reaction notification title to be consistent with ReactionView
Changelog-Fixed: Fix reaction notification title to be consistent with ReactionView
Closes: #1137
2023-05-24 15:20:02 -07:00
William Casarin
bffa42a13a Supporter Badges 2023-05-15 11:57:37 -07:00
William Casarin
8097cfdfb8 Include donation_amount on profile 2023-05-15 09:59:51 -07:00
William Casarin
a6745af519 Implement damus zap split donations using NWC 2023-05-15 09:41:26 -07:00
Bryan Montz
d58a1e0ba3 add ability to check the freshness of a PersistedProfile 2023-05-15 08:31:49 -05:00
Bryan Montz
3f7b0a4d6e add network pull date to PersistedProfile model for staleness checking 2023-05-15 08:29:06 -05:00
William Casarin
b1fee253b4 nwc: fix bug where private nwc zaps weren't getting tracked properly
It was using the wrapper zap request id instead of the inner id. Fix
this type error by creating a ZapRequestId wrapper that makes sure it
uses the proper request id.
2023-05-14 10:52:37 -07:00
William Casarin
03691d0369 Pending Zaps
A fairly large change that replaces Zaps in the codebase with "Zapping"
which is a tagged union consisting of a resolved Zap and a Pending Zap.
These are both counted as Zaps everywhere in Damus, except pending zaps
can be cancelled (most of the time).
2023-05-13 21:33:34 -07:00
Bryan Montz
6172347455 add ability to remove all cached Profiles in ProfileDatabase 2023-05-13 09:18:47 -05:00
Bryan Montz
31d327a085 add ability to retrieve count of cached Profiles 2023-05-13 09:18:23 -05:00
Bryan Montz
b5ae7df795 add ability to change ProfileDatabase's storage URL 2023-05-13 09:17:41 -05:00
Bryan Montz
3b0bb48dd4 integrate ProfileDatabase with existing Profiles caching class 2023-05-12 07:21:59 -05:00
Bryan Montz
4646f0e23c add ProfileDatabase class to read and write profiles to disk 2023-05-12 07:21:25 -05:00
Bryan Montz
7027b7016c add two-way translation between existing Profile class and new PersistedProfile CoreData class 2023-05-12 07:19:43 -05:00
Bryan Montz
76c57af548 add managed object class to match new Profile CoreData model 2023-05-12 07:18:12 -05:00
Bryan Montz
7983157c38 add CoreData model for Profile 2023-05-12 07:15:30 -05:00
William Casarin
bb32d72903 nwc: clear the zapper cache for our pubkey when we attach a new wallet 2023-05-10 14:07:24 -07:00
William Casarin
baed6adf49 refactor: ensure make_metadata_event has full keypair 2023-05-10 14:07:23 -07:00
William Casarin
1fe54380b8 relay: make RelayInfo encoding more flexible
So that we don't fail relay list decoding as easy
2023-05-10 13:25:46 -07:00
William Casarin
fe6d7e5118 relay: split descriptors to {our,all}_descriptors
Now that we have ephemeral relays, we don't want them used everywhere
2023-05-10 13:25:40 -07:00
William Casarin
32a1a24e39 pool: skip ephemeral relays by default
Also filter relays by read/write once we introduce that
2023-05-10 12:01:26 -07:00
William Casarin
7267662330 relay: introduce ephemeral relays
Epehmeral relays are relays that are connected in your relay pool but
not a part of your official relay list. This will be used by
nostr-wallet-connect to communicate with an NWC relay to pay invoices.
2023-05-10 12:01:26 -07:00
William Casarin
1da0a8ee52 nostr: add is_{read,write} helpers on requests
This will be handy in the future when we properly filter relay lists by
RelayInfo
2023-05-10 12:01:26 -07:00
Bryan Montz
ce599badee fix crash related to preloading events
Changelog-Fixed: fix crash related to preloading events
2023-05-09 23:39:41 -05:00
William Casarin
904fe2bc0a pool: ocd change
I'm not a fan of $0, etc
2023-05-09 18:57:04 -07:00
Bryan Montz
43017828e2 fix user notifications from old events immediately shown on install and login
Changelog-Fixed: Fix user notifications from old events immediately shown on install and login
Closes: #1106
2023-05-08 11:02:12 -07:00
Bryan Montz
9847f12c95 Remove unused code
Closes: #1105
2023-05-08 11:01:04 -07:00
William Casarin
9b99e00804 Reconnect on failed ping and remove reconnect timer
I think this does it
2023-05-07 12:00:37 -07:00
William Casarin
8c55f23ea8 Don't put reconnect logic in ping
It seems to be very bad
2023-05-07 11:28:33 -07:00
William Casarin
84174ef9ad Ping relays on resume, if there's an error then try to reconnect
This is an attempt to fix the fail-to-reconnect issues. Let's see if it works.
2023-05-07 10:28:36 -07:00
William Casarin
39a324fd1e Optimize json processing and preloading
- Preload events when added to the EventHolder queue
- Remove relative time formatting from preloader. Just do it when event appears
- Process incoming json in a background queue by default

Changelog-Fixed: Fix wrong relative times on events
Changelog-Changed: Preload events when they are queued
2023-05-03 10:36:10 -07:00
William Casarin
80ea37a102 Don't spam reconnects on error 2023-05-03 06:36:33 -07:00