1
0
mirror of git://jb55.com/damus synced 2024-09-30 00:40:45 +00:00
Commit Graph

197 Commits

Author SHA1 Message Date
William Casarin
bb4fd75576 nostrdb: add profiles to nostrdb
This adds profiles to nostrdb

- Remove in-memory Profiles caches, nostrdb is as fast as an in-memory cache
- Remove ProfileDatabase and just use nostrdb directly

Changelog-Changed: Use nostrdb for profiles
2023-09-21 09:10:06 -04:00
Jon Marrs
aa4ecc2139 test: add test cases for ASCII and UTF-8 characters in hashtags
Closes: https://github.com/damus-io/damus/pull/1546
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-15 12:31:17 -05:00
Daniel D’Aquino
b1e0a62109 nwc: fix parsing issue with NIP-47 compliant NWC urls without double-slashes
Closes: https://github.com/damus-io/damus/issues/1547
Changelog-Fixed: Fix parsing issue with NIP-47 compliant NWC urls without double-slashes
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-13 12:59:21 -06:00
Jericho Hasselbush
8dad8e6703 posting: fix issue with username and multiple emojis
Fixes issue where username with multiple emojis would place cursor in
strange position. Now properly moves the cursor to space past the
multiple emoji user name.

Any amount would be great. Not a complex issue to fix!

Tipjar: lnbc1pj0eddtpp5km07jgrfm47nfswqqp33ngv374gzad2hshkra7zm3l0cmpusnp3qdqqcqzzsxqyz5vqsp5rklkzj9upf32z3c3nmc9xg4pdlz5p5mp3s332ygefexf79tq8ucs9qyyssqxfh4kz3sg9zczsnj49w23aw35z87jwyx9m5su8kkyxlspyjk4ajy7vhxuw2rzw4lz8vfutfakm2rggvpzhzs9ehfus4nl683dl99f4sqgm9zkq
Changelog-Fixed: Fixes issue where username with multiple emojis would place cursor in strange position.
Signed-off-by: Jericho Hasselbush <jericho@sal-et-lucem.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-11 07:48:36 -07:00
Grimless
f6f7d13f12 Properly implement top-level tests and fix one test using the wrong Block conversion property
Closes: https://github.com/damus-io/damus/pull/1528
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-03 18:02:32 -07:00
Grimless
6ee0be40e9 Create helper extensions for Block and update tests for the Block helper model
Closes: https://github.com/damus-io/damus/pull/1528
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-03 18:02:32 -07:00
Jon Marrs
dd29e87146 test: pass keypair instead of privkey for test cases
Tests were not building due to recent changes in the Damus source code that replaced privkey with keypair. This patch extends those changes to the test cases, allowing the tests to build and pass.

Signed-off-by: Jon Marrs <jdmarrs@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-08-31 08:52:28 -07:00
William Casarin
f30f93f65c Revert "Move the Block helper type to its own file"
This fixes the broken tests

This reverts commit 286ae68fd6.
2023-08-25 19:05:34 -07:00
Daniel D’Aquino
dcb94635ea Fix text editing issues on characters added right after mention link
Changelog-Fixed: Fix text editing issues on characters added right after mention link
Closes: https://github.com/damus-io/damus/issues/1375
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Tested-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-08-20 17:25:06 -07:00
Daniel D‘Aquino
066b3cdde8 Fix image links appearing with escaped slashes
Changelog-Fixed: Fix images and links occasionally appearing with escaped slashes
Closes: https://github.com/damus-io/damus/issues/1468
Signed-off-by: Daniel D‘Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
Rewarded-sats: 50000
2023-08-18 08:41:21 -07:00
William Casarin
9e6fbeefcd url: smartparens hack
support urls like (https://jb55.com/something)
2023-08-06 14:16:43 -07:00
Joel Klabo
85930df8e3 tests: add url parens tests 2023-08-06 13:51:39 -07:00
William Casarin
cf3a9a576d test: move existing url tests to UrlTests 2023-08-06 13:50:20 -07:00
William Casarin
1a2ac976a3 Fix old notifications always appearing on first start
Revert "home: debounce last notified"

This is technically incorrect, as debouncing can prevent saving
important events.

The proper way to do this is to save it locally in memory, and then
debouncing the saving itself. Will do this soon.

Reverts: a9b4cfd424
Fixes: https://github.com/damus-io/damus/issues/1439
Changelog-Fixed: Fixed old notifications always appearing on first start
2023-08-06 09:22:28 -07:00
William Casarin
d4faacb99f relays: strip trailing / from relay urls
Fixes: https://github.com/damus-io/damus/issues/1443
Changelog-Fixed: Fix issue with slashes on relay urls causing relay connection problems
2023-08-06 09:07:33 -07:00
William Casarin
d489bcc586 test: add test for failing nostr report event 2023-08-06 06:56:24 -07:00
William Casarin
cebd1f48ca ndb: switch to nostrdb notes
This is a refactor of the codebase to use a more memory-efficient
representation of notes. It should also be much faster at decoding since
we're using a custom C json parser now.

Changelog-Changed: Improved memory usage and performance when processing events
2023-08-03 13:20:36 -07:00
William Casarin
55bbe8f855 disable nostrscript test for now 2023-08-03 13:15:32 -07:00
Daniel D‘Aquino
ef5a3030a6 Add unit tests surrounding creation of posts with non-latin hashtags, as well as the rendering of non-latin hashtag
Signed-off-by: Daniel D‘Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-08-03 12:17:32 -07:00
Daniel D‘Aquino
72b60573de Fix compilation error on test target in UserSearchCacheTests
Changelog-Fixed: Fix compilation error on test target in UserSearchCacheTests
Signed-off-by: Daniel D‘Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-08-03 12:17:32 -07:00
William Casarin
88306d00a3 key: generate a FullKeypair when generating new keys 2023-08-01 21:53:19 -07:00
William Casarin
a9b4cfd424 home: debounce last notified
Calling UserDefaults fast in a loop is not good
2023-07-31 05:38:19 -07:00
William Casarin
7040235605 refactor: add Pubkey, Privkey, NoteId string aliases
This is a non-behavioral change in preparation for the actual switchover
from Strings to Ids. The purpose of this kit is to reduce the size of
the switchover commit which is going to be very large.
2023-07-31 05:38:19 -07:00
William Casarin
f9d21ef901 test: rename test_event to test_note 2023-07-31 05:38:19 -07:00
William Casarin
2f8aa29e92 ndb: make NostrEvents immutable
Since we can't mutate NdbNotes, let's update the existing codebase to
generate and sign ids on NostrEvent constructions. This will allow us to
match NdbNote's constructor
2023-07-25 15:34:05 -07:00
William Casarin
e3c04465fc ndb: move to uint32 for kind and created_at 2023-07-25 15:24:26 -07:00
William Casarin
b3c87bdc07 test: remove unused var 2023-07-24 12:40:04 -07:00
William Casarin
1a33d639ed test: remove some unused perf tests 2023-07-23 11:54:58 -07:00
William Casarin
6d43754e71 ndb: add pubkey to NdbNote 2023-07-22 17:19:47 -07:00
William Casarin
ad0e1f28b7 test: fix build and tests 2023-07-21 15:26:03 -07:00
William Casarin
61051ee853 nostrdb: add initial swift integration 2023-07-21 15:02:01 -07:00
William Casarin
11b9062865 test: fix some warnings 2023-07-19 10:04:25 -07:00
William Casarin
ff70cb7ebf posting: don't prepad user tag if its a newline
This fixes one more edgecase with the tag prepend logic.
2023-07-17 10:45:05 -07:00
William Casarin
60a0c21272 test: add post composition tests
This adds post composition tests so that we can avoid composition bugs.
This still does not capture all of the dynamics of post composition,
because it ignores much of the mutable cursor position and related state
when editing posts.

We will need to make post editing more pure and less mutable in the
future to get test coverage on those.
2023-07-17 10:25:09 -07:00
William Casarin
ff654c4e11 test: add text attribute testing function
This will be used for testing attributed strings
2023-07-17 10:25:09 -07:00
William Casarin
fd59407171 test: fix old markdown tests 2023-07-17 10:25:09 -07:00
William Casarin
1135c19fea test: add setting property tests
Some initial UserSettingsStore property tests
2023-07-16 13:05:18 -07:00
William Casarin
8d14fdffb5 content: add utf8 char at url left boundary test 2023-07-16 11:46:23 -07:00
William Casarin
0c95071de7 project: rename parse_mentions to parse_note_content
This is more accurate
2023-07-16 11:46:23 -07:00
William Casarin
139be9eef2 Fix nostr: mention prefix bugs
The zero-width space was causing parsing issues. Not sure why we need
this so I just removed it.

Changelog-Fixed: Fix nostr:nostr:... bugs
2023-07-14 17:28:24 -07:00
Terry Yiu
8a9e3ea76b Fix localization issues and export strings for translation
Changelog-Fixed: Fix localization issues and export strings for translation
Signed-off-by: Terry Yiu <git@tyiu.xyz>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-07-14 09:34:29 -07:00
William Casarin
7fc270725f test: add newline mention test
This is currently passing but it shouldn't be. This is because we are
not testing the build_post function directly. We will do this soon.
2023-07-13 07:32:27 -07:00
William Casarin
db2ec0a00a Fix npub mention bugs, fix slowness when parsing large posts
Switch the post parser to use the same code as the content parser. This
was causing many issues, including performance issues.

Changelog-Fixed: Fix lag when creating large posts
Changelog-Fixed: Fix npub mentions failing to parse in some cases
Changelog-Added: Add r tag when mentioning a url
Changelog-Removed: Remove old @ and & hex key mentions
2023-07-11 09:15:13 -07:00
William Casarin
031c7823ae refactor: move hashtag tests to their own file 2023-07-11 07:21:16 -07:00
cr0bar
ac2b5b26bb Added non-latin test and amended emoji test to include emoji in hashtag 2023-07-11 06:39:12 -07:00
William Casarin
374610a21a artifacts: allow unseparated note artifacts
This is needed for longform events. Right now we treat unseparated note
artifacts as a list of blocks, but we will likely need to render these
blocks into lists of attributed texts with image blocks inbetween.
2023-07-10 18:24:43 -07:00
Terry Yiu
fcd7d2beab
Fix localization issues and export strings for translation 2023-07-09 15:33:15 -04:00
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
Terry Yiu
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
30e33a01c1 nostrscript: add a helper function 2023-07-03 16:59:50 -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
Terry Yiu
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
Terry Yiu
7cae61a86a Fix missing profile zap notification text
Changelog-Fixed: Fix missing profile zap notification text
Closes: #1332
2023-06-28 14:48:06 +02:00
Terry Yiu
cfe14fac23 Deduplicate users in group notifications
Changelog-Fixed: Deduplicate users in notifications
Closes: #1326
2023-06-26 11:31:36 +02:00
Terry Yiu
422167f7aa Add indication of followers you know in a profile
Changelog-Added: Add indication of followers you know in a profile
2023-06-25 09:38:57 +02:00
William Casarin
62bf767be5 nozaps: fix some tests 2023-06-23 20:46:27 +02:00
William Casarin
a5b2a5c8b9 tests: disable invalid tests 2023-06-23 20:46:27 +02:00
Terry Yiu
baa5454e2a Rename all usages of the term Post as a noun to Note to conform to the Nostr spec
Changelog-Fixed: Rename all usages of the term Post as a noun to Note to conform to the Nostr spec
2023-06-10 11:42:25 +02:00
Terry Yiu
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
61303f49ad fix zap test 2023-05-26 07:32:18 -05: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
61ff7da2ae make database write async at the call site and update tests 2023-05-25 09:09:50 -05:00
Terry Yiu
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
a30a79b1fc Fix tests 2023-05-14 11:20:28 -07:00
William Casarin
0091df8f77 nwc: fix broken test 2023-05-14 10:49:54 -07:00
Bryan Montz
32431096f5 add tests for ProfileDatabase 2023-05-13 09:20:01 -05:00
William Casarin
dafa1ba4de test: add nwc and ephemeral relay test
This ensures that when paying with nwc, we get an ephemeral relay added
and a request queued in the postbox.
2023-05-10 16:24:02 -07:00
Joshua Jiang
c439100a86 Fix parse mention without space in content
Changelog-Fixed: Fix parse mention without space in content
Closes: #936
Fixes: #992
2023-05-05 11:20:20 -07:00
Terry Yiu
34970b38bb Fix plurality on sats 2023-05-05 09:00:02 -07:00
Bryan Montz
e4860f3ba8 Replace Vault dependency with @KeychainStorage property wrapper
Changelog-Changed: replace Vault dependency with @KeychainStorage property wrapper
Closes: #1076
2023-05-04 15:57:02 -07:00
William Casarin
7940e6fd32 Fix tests 2023-04-23 04:36:16 -07:00
Terry Yiu
66641fc9ae Add setting to hide reactions
Changelog-Added: Add setting to hide reactions
2023-04-20 08:20:50 -07:00
Terry Yiu
bff3c0dd52 Improve sats numeric entry for zaps
Changelog-Changed: Add number formatting for sats entry and use selected zaps amount from picker as placeholder
Changelog-Fixed: Do not allow non-numeric characters for sats amount and fix numeric entry for other number systems for all locales
2023-04-17 15:20:14 -07:00
William Casarin
b5a3697d78 Refactor direct messages model
We can track the pubkey in the DirectMessageModel instead of having a
janky tuple.
2023-04-15 12:41:00 -07:00
William Casarin
e8d63768c1 Fix note mention test 2023-04-11 10:27:11 -07:00
William Casarin
1f648057d5 Add another bech32 test 2023-04-11 10:23:34 -07:00
William Casarin
0866c70346 Fix tests 2023-04-10 16:09:43 -07:00
William Casarin
8a230861bf remove broken test 2023-04-09 22:45:21 -07:00
William Casarin
13354b0eb5 Refactor NIP19 implementation and add tests
Closes: #837
2023-04-09 22:03:51 -07:00
William Casarin
b131c74ee3 Add prefix and suffix string trimming functions
This is needed to fix extraneous whitespace issues in image posts
2023-04-05 12:48:03 -07:00
Terry Yiu
08b7e50bd8
Fix localization issues and import translations 2023-03-31 10:10:26 -04:00
William Casarin
9091cb1aae Revert "Reduce battery usage by using exp backoff on connections"
This is causing pretty bad fail to reconnect issues

This reverts commit 252a77fd97, reversing
changes made to a611a5d252.
2023-03-17 07:54:29 -06:00
Swift
a574dcb27c Add image uploader
Changelog-Added: Add image uploader
2023-03-15 17:12:05 -06:00
Bryan Montz
252a77fd97 Reduce battery usage by using exp backoff on connections
Changelog-Changed: Reduce battery usage by using exp backoff on connections
2023-03-15 10:48:47 -06:00
William Casarin
a611a5d252 Fix tests 2023-03-15 09:43:48 -06:00
Bryan Montz
cabe584938 fix "Replying to..." issues and improve related tests 2023-03-14 11:44:40 -06:00
William Casarin
77f5268336 Private Zaps
This adds private zaps, which have messages and authors encrypted to
the target. Keys are deterministically generated so that both the
receiver and sender can decrypt.

Changelog-Added: Private Zaps
2023-03-01 09:56:25 -08:00
Bryan Montz
7c2e8a6cc5 Merge branch 'master' into exp-backoff 2023-02-27 06:23:38 -06:00
Terry Yiu
77bcd1b715
Fix localization and add tests for EventGroupView 2023-02-27 10:20:50 +13:00
Bryan Montz
6c63f8f22a add unit tests for RelayPool 2023-02-25 07:34:31 -06:00
Terry Yiu
5cd4c2d75e Fix localization issues, add tests, import translations, and add zh-CN and zh-TW
Closes: #689
2023-02-24 12:44:54 -08:00
Bryan Montz
603a5a1814 Refinements to RelayConnection plus tests for creating requests
Closes: #644
2023-02-19 08:36:03 -08:00
Bryan Montz
1b4e54582f fixed tests 2023-02-16 06:07:04 -08:00
Gert Goet
f0df4aa218 Strip common punctuations from URLs
Changelog-Fixed: Fix punctuation getting included in some urls
Closes: #575
2023-02-13 10:03:35 -08:00
Gert Goet
bb9fc6f905 Always stop at first whitespace 2023-02-13 10:03:17 -08:00
William Casarin
4f2bacfaab Configurable zap amount 2023-02-10 13:52:27 -08:00
William Casarin
d5b6d935e8 fix tests 2023-02-10 11:08:28 -08:00
William Casarin
10596ddb09 Relay Filters
wip
2023-02-09 14:23:18 -08:00