1474 Commits

Author SHA1 Message Date
ekzyis
bc569be34a
Fix spacing if no badges (#2376) 2025-07-31 18:04:12 -05:00
Edward Kung
0299bbe4bc
fix hashtag links opening in new tabs (#2373) 2025-07-31 12:58:58 -05:00
soxa
1aeb206842
fix: prevent GET_NEW_COMMENTS query from running in-between renders (#2345) 2025-07-30 12:35:38 -05:00
ekzyis
0968c77bdf
Fix missing reuse of nav.module.css (#2349)
* Fix autoprefixer warning

* Fix missing reuse of nav.module.css
2025-07-28 17:10:30 -05:00
soxa
a4a0fdb060
Fix live comments behavior on paginated comments and threads (#2334)
* livecomments: patches for paginated comments; broader ViewMoreReplies component

live comments:
- don't show the thread button for thread comments that are shown as full items (top level)
- don't try to count/inject on paginated comments, just show the live comments dot
- dedupe new comments being fetched with already existing comments, useful for just showing the dot, but not the button

comments:
- live comments dot now appears on both paginated and bottomed out comments
-- merge ViewAllReplies with ReplyToAnotherPage

* fix thread comment recognition, now based on depth
2025-07-26 18:06:22 -05:00
ekzyis
0155946d74
Fix carousel dropdown (#2326)
Co-authored-by: brymut <mutaiwork@gmail.com>
2025-07-24 14:18:19 -05:00
soxa
9e2c35c641
Fix non-thread live comments recursion logic (#2324)
* fix: recurse through existing comments only if we're in the newComments subtree or if it's the start of a thread

* cleanup: better comment

* cleanup: re-order parameters, comment touchup
2025-07-24 12:28:26 -05:00
ekzyis
160b04ceaa
Carousel cleanup (#2325)
* Remove unused carousel args

* Remove unused export

* Remove unnecessary ref in dependencies
2025-07-24 18:07:22 +02:00
soxa
ecac519efb
Fix clear new comments on route change (#2319) 2025-07-23 23:47:53 -05:00
ekzyis
7c10ded8a6
Fix footer visible through dropdown (#2323) 2025-07-23 23:47:16 -05:00
soxa
9092d90797
Enhancements to live comments (#2269)
* check new comments every 10 seconds

* enhance: clear newComments on child comments when we show a topLevel new comment; cleanup: resolvers, logs

* handle comments of comments, new structure to clear newComments on childs

* use original recursive comments data structure

* correct comment structure after deduplication

* faster newComments query deduplication, don't need to know how many comments are there

* cleanup: comments on newComments fetches and dedupes

* cleanup, use correct function declarations

* stop polling after 30 minutes, pause polling if user is not on the page

* ActionTooltip indicating that the user is in a live comment section

* handleVisibilityChange to control polling by visibility

* paused polling styling, check activity on 1 minute intervals and visibility change, light cleanup

* user can resume polling without refreshing the page

* better naming, straightforward dedupeComment on newComment arrival

* cleanup: better naming, get latest comment creation, correct order of comment injection

* cleanup: refactor live comments related functions to use-live-comments.js

* refactor: clearer naming, optimized polling and date retrieval logic, use of constants, general cleanup

* ui: place ShowNewComments in the bottom-right corner of nested comments

* fix: make updateQuery sort-aware to correctly inject the comment in the correct Item query

* cleanup: better naming; fix: usecallback on live comments component; fix leak on useEffect because of missing sort
atomic apollo cache manipulations; manage top sort not being present in item query cache
queue nested comments without a parent, retry on the next poll
fix commit messages

* fix: don't show unpaid comments; cleanup: compact cache merge/dedupe, queue comments via state

* fix: read new comments fragments to inject fresh new comments, fixing dropped comments;

ui: show amount of new comments

refactor: correct function positioning;

cleanup: useless logs

* enhance: queuedComments Ref, cache-and-network fetch policy; freshNewComments readFragment fallback to received comment

* cleanup: detailed comments and better ShowNewComment text

* fix: while showing new comments, also update ncomments for UI and pagination

* refactor: ShowNewComments is its own component; cleanup: proven useless dedupe on ShowNewComments, count nested ncomments from fresh new comments

* enhance: direct latest comment createdAt calc with reduce

* cleanup queue on unmount

* feat: live comments indicator for bottomed-out replies, ncomments updates; fix: nested comment structures

- new comments indicator for bottomed-out replies
- ncomments sync for parent and its ancestors
- limited comments fragment for comments that don't have CommentsRecursive
- reduce cache complexity by removing useless roundtrips

ux: live comments indicator on bottomedOut replies

fix: dedupe newComments before displaying ShowNewComments to avoid false positives

enhance: store ids of new comments in the cache, instead of carrying full comments that would get discarded anyway

hotfix: newComments deduplication ID mismatch, filter null comments from freshNewComments

fix: ncomments not updating for all comment levels; refactor: share Reply update ancestors' ncomments function with ShowNewComments

cleanup: better naming to indicate the total number of comments including nested comments

fix: increment parent comment ncomments

cleanup: Items that will have comments will always have a structure where item.comments is true

cleanup: reduce code complexity checking the nested comment update result instead of preventively reading the fragment

cleanup: avoid double-updating ncomments on parent

fix: don't use CommentsRecursive for bottomed-out comments

cleanup: better fragment naming; add TODO for absolute bottom comments

* enhance: give the possibility to show all new comments of a thread, even nested

* enhance: change favicon on new comments; warn: prop-drilling

* refactor: merge ShowAllNewComments with ShowNewComments, better usage of props

* hotfix: isThread should be recognized when an item has 2 items in its path

* fix regression: topLevel comments not showing

* fix: avoid trying to show new comments even after the depth limit; todo: two recursive counts might be too much

* favicon-new-comment, fix favicon showing also when there aren't new comments

* enhance: highlight new comments when shown; nit-fixes and cleanups

fixes:
- sync local commentsViewedAt on comment injection, to avoid double outline on item re-visit
- avoid double highlighting when client-side visiting an item and injecting a new comment

cleanups:
- move ShowNewComments functions to dedicated lib/comments.js
- bust auto-show enhancement due to bad useEffect usage

todos:
- two recursive counts might be too much

* cleanup: move cache manipulation functions, comments for comments.js

- lib/comments.js explanations for its functions
- itemUpdateQuery, commentUpdateFragment, getLatestCommentCreatedAt on comments.js
- format too many imports from comments.js

todo:
- we're not deduping comments for isThread, which forces us at this state, to dedupe twice

* enhance: highlight new comment with injected field, recursive injection in every case but top level; cleanups

cleanups:
- better separation of concerns for lib/comments.js
- don't show new comment count, avoiding useless complexity
- simpler topLevel/nested logic
- add comments

* backport live comments logic enhancements

use-live-comments:
- remove useless dedupe against already present comments
- check newComments.comments length to tell if there are new comments
- code reordering

show-new-comments:
- show all new comments recursively for nested comments
- get always the newest comments to inject also their own child new comments
- update local storage commentsViewedAt on comment injection
- respect depth on comment injection

comments.js
- apollo cache manipulations now live here

* hotfix: handle undefined item.comments.comments on dedupe

* hotfix: fix lint after merge

* hotfix: limited fragment for recursive comment collection; protect from null fragments; add missing deps to memoization

* merge: missing memo deps, limited fragment for non-recursive comments; fix: don't highlight injected comments with classic outline; cleanup: comments

* docs: clarify ncomments updates

* cleanup: remove unused export

* count and show only the direct new comments and recursively their children

enhance: dedupe against existing comments only in the component
enhance: recursive count/injection share the same logic

* fix regression on top level counting

* hotfix: introduce readNestedCommentsFragment in lib/comments.js

* fix: count also existing comments of a new comment; cleanup: use readCommentFragment also for prepareComments; reduce freshNewComments usage

* add support for comments at the deepest level

fixes:
- client-side navigation re-fetched all new comments because 'after' was cached, now the latest new comment time persists in sessionStorage

enhancements:
- use CommentWithNewMinimal fragment fallback for comments at the deepest level
- tweak ReplyOnAnotherPage to show also how many direct new comments are there

cleanup:
- queue management is not needed anymore, therefore it has been removed

* cleanup: remove logs

* revert counting on ReplyOnAnotherPage, TODO for enhancements PR

* move ShowNewComments to CommentsHeader for top level comments

* fix: update commentsViewedAfterComment to support ncomments

* fix typo, lint

* cleanup: remove old CSS

* enhance: inject topLevel and its children new comments, simplify injection logic

- top-level and nested comment handling share the same recursion logic
- ShowNewComments references the item object for every type of comments
— note: item from item-full.js is passed to comments.js
- depth now starts at 0 to support top level comments
- injection and counting now reach the deepest level, updating also the deepest comment

* cleanup: remove unused topLevel prop

* fix: deepest comments don't have CommentsRecursive structure, don't access it on injection

* move top level ShowNewComments above CommentsHeader; preserve space to avoid vertical layout shifting

* cleanup: remove unused item on CommentsHeader

* enhance: scroll and load new comments via a floating button using IntersectionObserver API; fix merge: restore injected field for outlining

* style: transparent and animated floating button, new comment dot color aligned to new comments accent color

* cleanup: less redundancy between the two types of buttons; enhance: show the floating button only if we're past the element, not only if it's not visible

* enhance: outline newly injected comments using root item's lastCommentAt

* cleanup: remove transparency of floating comments button, remove other traces of the injected field

* adapt and restore showing all new comments of a thread

* fix: respect deepest comments structure on injection, adjust depth limit; cleanup: consistent naming

* fix: avoid double outlines because of all conditions being met

* cleanup: remove favicon, dedicate space for useVisibility, correct comments

* ux: show all new comments of a thread only if its children have them

* mark injected comments in the cache for reliable outlining

* cleanup: clearer structure, more explaining

* optimize: better closure usage, remove duplicate code, immutable payloads

- ncomments count logic shared with injection and counting
- don't re-create and persist closures for every injection, rather temporarily on injection
- access item hierarchy once, avoid creating new arrays
- don't create and mutate payloads, rather know what to return

fixes:
- fix wrong parameters on traverseNewComments recursion

* cleanup: further clarifications

* safer rootLastCommentAt usage for injected comments outlining

* hotfix: ignore nDirectComments server updates when the item being updated has pending newComments, fixes CommentEdit consequences

* simpler show all new comments text for thread comments, regardless of how many

* fix: reference the correct Item for newComments reading, during nDirectComments apollo merge

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2025-07-23 11:57:36 -05:00
ekzyis
3f74279f29
Fix useMemo returns new component on change (#2315)
This fixes setting the input value on scan if the component remounts while the scanner is open.

No need to use useRef to close the scanner on remount.
2025-07-23 11:50:39 -05:00
ekzyis
e1162b815a
Close passphrase scanner on unmount (#2313) 2025-07-23 09:32:45 -05:00
k00b
f63d40196d fix variable input icon alignment 2025-07-22 18:26:29 -05:00
k00b
276bb94eb9 rerender textarea on accordian show for autoresizer 2025-07-22 17:04:08 -05:00
soxa
6b440cfdf3
Live updates to comment threads (#2115)
* check new comments every 10 seconds

* enhance: clear newComments on child comments when we show a topLevel new comment; cleanup: resolvers, logs

* handle comments of comments, new structure to clear newComments on childs

* use original recursive comments data structure

* correct comment structure after deduplication

* faster newComments query deduplication, don't need to know how many comments are there

* cleanup: comments on newComments fetches and dedupes

* cleanup, use correct function declarations

* stop polling after 30 minutes, pause polling if user is not on the page

* ActionTooltip indicating that the user is in a live comment section

* handleVisibilityChange to control polling by visibility

* paused polling styling, check activity on 1 minute intervals and visibility change, light cleanup

* user can resume polling without refreshing the page

* better naming, straightforward dedupeComment on newComment arrival

* cleanup: better naming, get latest comment creation, correct order of comment injection

* cleanup: refactor live comments related functions to use-live-comments.js

* refactor: clearer naming, optimized polling and date retrieval logic, use of constants, general cleanup

* ui: place ShowNewComments in the bottom-right corner of nested comments

* fix: make updateQuery sort-aware to correctly inject the comment in the correct Item query

* cleanup: better naming; fix: usecallback on live comments component; fix leak on useEffect because of missing sort
atomic apollo cache manipulations; manage top sort not being present in item query cache
queue nested comments without a parent, retry on the next poll
fix commit messages

* fix: don't show unpaid comments; cleanup: compact cache merge/dedupe, queue comments via state

* fix: read new comments fragments to inject fresh new comments, fixing dropped comments;

ui: show amount of new comments

refactor: correct function positioning;

cleanup: useless logs

* enhance: queuedComments Ref, cache-and-network fetch policy; freshNewComments readFragment fallback to received comment

* cleanup: detailed comments and better ShowNewComment text

* fix: while showing new comments, also update ncomments for UI and pagination

* refactor: ShowNewComments is its own component; cleanup: proven useless dedupe on ShowNewComments, count nested ncomments from fresh new comments

* enhance: direct latest comment createdAt calc with reduce

* cleanup queue on unmount

* feat: live comments indicator for bottomed-out replies, ncomments updates; fix: nested comment structures

- new comments indicator for bottomed-out replies
- ncomments sync for parent and its ancestors
- limited comments fragment for comments that don't have CommentsRecursive
- reduce cache complexity by removing useless roundtrips

ux: live comments indicator on bottomedOut replies

fix: dedupe newComments before displaying ShowNewComments to avoid false positives

enhance: store ids of new comments in the cache, instead of carrying full comments that would get discarded anyway

hotfix: newComments deduplication ID mismatch, filter null comments from freshNewComments

fix: ncomments not updating for all comment levels; refactor: share Reply update ancestors' ncomments function with ShowNewComments

cleanup: better naming to indicate the total number of comments including nested comments

fix: increment parent comment ncomments

cleanup: Items that will have comments will always have a structure where item.comments is true

cleanup: reduce code complexity checking the nested comment update result instead of preventively reading the fragment

cleanup: avoid double-updating ncomments on parent

fix: don't use CommentsRecursive for bottomed-out comments

cleanup: better fragment naming; add TODO for absolute bottom comments

* backport live comments logic enhancements

use-live-comments:
- remove useless dedupe against already present comments
- check newComments.comments length to tell if there are new comments
- code reordering

show-new-comments:
- show all new comments recursively for nested comments
- get always the newest comments to inject also their own child new comments
- update local storage commentsViewedAt on comment injection
- respect depth on comment injection

comments.js
- apollo cache manipulations now live here

* hotfix: handle undefined item.comments.comments on dedupe

* hotfix: limited fragment for recursive comment collection; protect from null fragments; add missing deps to memoization

* docs: clarify ncomments updates

* cleanup: remove unused export

* count and show only the direct new comments and recursively their children

enhance: dedupe against existing comments only in the component
enhance: recursive count/injection share the same logic

* fix regression on top level counting

* hotfix: introduce readNestedCommentsFragment in lib/comments.js

* fix: count also existing comments of a new comment; cleanup: use readCommentFragment also for prepareComments; reduce freshNewComments usage

* add support for comments at the deepest level

fixes:
- client-side navigation re-fetched all new comments because 'after' was cached, now the latest new comment time persists in sessionStorage

enhancements:
- use CommentWithNewMinimal fragment fallback for comments at the deepest level
- tweak ReplyOnAnotherPage to show also how many direct new comments are there

cleanup:
- queue management is not needed anymore, therefore it has been removed

* cleanup: remove logs

* revert counting on ReplyOnAnotherPage, TODO for enhancements PR

* move ShowNewComments to CommentsHeader for top level comments

* fix: update commentsViewedAfterComment to support ncomments

* fix typo, lint

* cleanup: remove old CSS

* enhance: inject topLevel and its children new comments, simplify injection logic

- top-level and nested comment handling share the same recursion logic
- ShowNewComments references the item object for every type of comments
— note: item from item-full.js is passed to comments.js
- depth now starts at 0 to support top level comments
- injection and counting now reach the deepest level, updating also the deepest comment

* cleanup: remove unused topLevel prop

* fix: deepest comments don't have CommentsRecursive structure, don't access it on injection

* move top level ShowNewComments above CommentsHeader; preserve space to avoid vertical layout shifting

* cleanup: remove unused item on CommentsHeader

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2025-07-21 15:38:15 -05:00
ekzyis
74ef0076fa
Request persistent storage on wallet save (#2302)
* Also request persistent storage on wallet save

* Request persistent storage on push subscription
2025-07-21 12:46:06 -05:00
soxa
d4efacadc0
Fix count of viewed comments of a post (#2297)
* fix: parse existingRootComments as Number to correctly add new comments to the count

* return commentsViewedAt and commentsViewedNum parsed as Number

* hotfix: commentsViewedNum accepts itemId directly

* consistently receive itemId on new-comments functions that only uses IDs
2025-07-18 13:02:39 -05:00
ekzyis
56a185d477
Fix passphrase scanner (#2292)
* Fix passphrase scanner

* Fix scanner trying to play sound on scan
2025-07-17 17:06:58 -05:00
ekzyis
d89a4a429a
Wallet v2 (#2169)
* Migrate vault entries to new schema (#2092)

* Migrate existing vault entries to new schema

* Read+write new vault schema

* Drop VaultEntry table

* Refactor vaultPrismaFragments

* Remove wrong comment

* Remove TODO

* Fix possible race condition on update of vault key

* Remove lib/object.js

* Wallet schema v2 (#2146)

* Add wallet-v2 TODOs

* Update checkWallet

* Wallet list

* Delete almost all wallet v1 code

and add some code for wallet protocol forms

* Define protocol display name in JSON

* Show form per protocol

* Increase max-height of image in form

* Add JSdoc for protocols, form validation

* Use wallet cards again

My wallet list was quite ugly and I couldn't look at it anymore.

* Refactor hooks in wallet provider

* Fix PasswordInput not used

* Read encrypted wallets

* Decrypt wallets

* useWalletQuery now returns decrypted wallets
* Refactor useIndexedDB because its only purpose will be to store the key, so no need for pagination code etc.
* There is still a bug: if the wallet is not decrypted on first render, the form will not see the decrypted value. See TODO.

* Rename protocolJson to protocol

it no longer uses a JSON file

* Fix form not updated with decrypted API key

* Fix wallet template forms

* Fix optional shown as hint

* Rename to mapUserWalletResolveTypes

* Save LNbits send and recv

TODO:

* implement resolvers for other protocols
* fix double update required for trigger?
* add missing validation on server
* add missing network tests
* don't import from wallets/client on server

* Move definitions to lib/wallets.json and lib/protocols

* Fix ProtocolWallet.updated_at not updated by trigger

* Move wallet fragments into wallets/client/fragments/

* move invoice fragments to fragments/invoice.js
* remove some unused fragments that I don't think I also will not use
* move fragments that will be generated in own file

* Move wallet resolvers into wallets/server/resolvers

* Fix missing authorization check on wallet update

* Run all shared code in generic wallet update function

* Fix 'encrypt' flag not set for blink send currency

* Add mutations for all protocols

* Fix macaroon validation

* Fix CLN socket value not set

* Add server-side schema validation

* Fix JSDoc typedef for protocols

* Don't put JSDoc into separate file

* Create test invoices on save

* Also move type resolvers into wallets/server/resolvers

* Fix unconfigured protocols of UserWallet not found

* Fix Blink API key in wallet seed

* Test send payment on save (except LNC)

This does not include LNC because LNC cannot be saved yet

* Check if window.webln is defined on save

* Create new wallets from templates

* Separate protocols in wallets/lib into individual files

* Use justify-content-start for protocol tabs

and larger margin at the top

* Add LNC to client protocols

* Only return wallets from useWallets

* Query decrypted wallets

* Payments with new wallets

* More wallet logos

* Fix TypeError in useIndexedDB

* Add protocol attach docs

* Fix undefined useWalletRecvPrompt import

* Remove outdated TODOs

* First successful zap to new wallets

* Fix walletLogger imports

* Fix sequences

* the sequences for InvoiceForward and DirectPayment were still starting at 1
* when using setval() with two arguments, nextval() will return the second argument+1 (see https://www.postgresql.org/docs/current/functions-sequence.html)

* Rename ProtocolWallet columns

* Remove more outdated TODOs

* Update wallet indicator

* Fix page reset on route change

* Refactor __typename checks into functions

* Refactor protocol selection into own hook

* Add button to detach protocol

* Refetch wallet on save and detach

* Refetch wallets on change

* Always show all templates

* Refactor WalletLink component

* Also put wallet into forms context

* Remove outdated TODOs

* Use useMemo in wallets hooks

* Passphrase modals

* prompt for password if decryption failed
* add button to reveal passphrase on wallet page

TODO:
* remove button if passphrase was revealed or imported
* encrypt wallets with new key on passphrase reveal

* Fix protocol missing as callback dependency

* Encrypt wallets with new key on passphrase export

* Update 'unlock wallets' text

* Rename wallet mutation hooks

* Remove 'removeWallet' mutation

Wallets are automatically deleted when all protocols are deleted

* Passphrase reset

* Use 110px as minimum width for bip39 words

longest bip39 words are 8 characters and they fit into 103px so I rounded up to 110px.

* Also disable passphrase export on save

* Wallet settings

* Fix wallet receive prompt

* Remove unused parameters from postgres function

* Rename UserWallet to Wallet, ProtocolWallet to WalletProtocol

* Use danger variant for button to show passphrase

* Fix inconsistent imports and exports

* Remove outdated TODOs

* wallet logs

* Remove outdated comment

* Make sure wallets are used in priority order

* Separate wallets from templates in reducer

* Fix missing useCallback dependencies

* Refactor with useWalletLogger hook

* Move enabled to WalletProtocol

* Add checkbox to enable/disable protocol

* Fix migration with prod db dump

* Parse Coinos relay URLs

* Skip network tests if only enabled changed

* Allow IndexedDB calls without session

* Add code to migrate old CryptoKey

* first try to use existing CryptoKey before generating a new one
* bump IDB version to delete old object stores and create new ones
* return IDB callbacks with useMemo
* don't delete old IDB right away, wait until next release

* Fix ghost import error

*Sometimes*, I get import errors because it tries to resolve @/wallets/server to wallets/server.js instead of wallets/server/index.js.

For the files in wallets/server, it kind of makes sense because it's a circular import.

But I don't know why the files in worker/ have this problem.

Interestingly, it only seems to happen with walletLogger imports, so I guess its related to its import chain.

Anyway, this commit should make sure this never happens again ...

* Skip wallets queries if not logged in

* Split CUSTOM wallet into NWC and LN_ADDR

* Migrate local wallets

* Link to /wallets/:id/receive if send not supported

* Hide separator if there are no configured wallets

* Save LNC

* Add one-liner to attach LNC

* Update wallet priorities via DnD

* Wallet logs are part of protocol resolvers

* Fix logging to deleted protocol

* Fix trying to fetch logs for template

* also change type to Int so GraphQL layer can catch trying to fetch string IDs as is the case for templates

* Fix embedded flag for wallets logs not set

* Remove TODO

* Decrease max-height for embedded wallet logs on big screens

* Fix missing refetch on wallet priority update

* Set priorities of all wallets in one tx

* Fix nested state update

* Add DragIcon

* DnD mobile support and refactor

* Add CancelButton to wallet settings

* Remount form if path changes

This fixes the following warning in the console:

"""
Warning: A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component.
"""

* Support string and object for wallet.image JSON

* Append domain to lightning address inputs

* Remove outdated TODOs

* Add template IDs to wallet JSON

* Fix missing callback dependency

* Implement lightning address save in receive prompt

* Update TODOs

* Fix missing check for enabled

* Pay QR codes with WebLN as anon

* Add logo for NWC

* Fix trying to save logs for template

* Add template logs

* Fix inconsistent margin

* Always throw on missing key

* Remove misleading comment

Wallets are returned even if decryption fails so we can show the unlock page if a wallet is stored as encrypted in the context.

Maybe I should rethink this.

* Check for existing wallets on local wallet migration

* Fix local wallet migration causing duplicates

* Fix protocol reattached on detach due to migration

* Fix form not centered

* Fix ZEUS lightning address domain

* Add placeholder, help, hints etc. to wallet form inputs

* Fix wallet badges not updated

* Remove unused declared variables

* Rename to ATTACH_PAGE

* Fix 500 error if no amount was given to LNURLp endpoint

* Tag log messages with wallet name

* Only skip network tests if we're disabling the wallet

* Rename var to networkTests

* Continue to store key hash in IndexedDB

* Rethink wallet state management

If decryption failed, the function to decrypt the wallets didn't throw but simply returned wallets that were still encrypted.

This was bad because it meant we could not rely on the wallets in the state being decrypted, even though this was the original idea behind the query hooks: hide the details of encryption and decryption inside them.

Because of this, we had to check if the wallets were still encrypted before we ran the wallet migration since we want to check if a protocol already exists.

This commit fixes this by making encryption and decryption always throw (and catching the errors), as well as returning a ready state from hooks. A hook might not be ready because it still needs to load something (in the case of the crypto hooks, it's loading the key from IndexedDB). Callers check that ready state before they call the function returned by the hook.

So now, the wallet migration hook can itself simply check if the hook to encrypt wallets is ready and if the wallets are no longer loading to let callers know if it itself is ready.

Since we also relied on wallets stored as encrypted in the context to show the unlock page, this was also changed by comparing the local and remote key hash.

* Add empty line

* Save new key hash during wallet reset

* Only receive protocol upserts require networkTests param

* Compare key hashes on server on each save

* Delete old code

* Fix card shows attach instead of configure

* Fix empty wallets created during migration

The old schema can contain '' instead of NULL in the columns of wallets for receiving.

* Update reset passphrase text

* Wrap passphrase reset in try/catch

* Fix migrate called multiple times

* Update key hash on migration if not set

* Fetch local wallets in migrate

* Fix missing await on setKey

* Let first device set key hash

* Fix indicator not shown if wallets locked

* Check if IndexedDB is available

* Fix inconsistent WebLN error message

* Disable WebLN if not available

* Remove outdated TODO

* Cursor-based pagination for wallet logs

* Fix log message x-overflow

* Add context to wallet logs

* Wrap errors are warnings in logs

* Rename wallet v2 migrations

* Update wallet status during logging

* Fix wallet logs loading state

The loading state would go from false -> true -> false because it's false when the lazy query wasn't called yet.

* Add wallet search

* Add Alby Go wallet

* Revert "Add Alby Go wallet"

This reverts commit 926c70638f1673756480c848237e52d5889dc037.

* Fix wallet logs sent by client don't update protocol status

* Fix mutation name

* put drag icon on opposite corner

* Add wallets/README.md

* Fix inconsistent case in wallets/README.md

* Fix autoprefixer warning about mixed support

This warning was in the app logs:

app     | Warning
app     |
app     | (31:3) autoprefixer: end value has mixed support, consider using flex-end instead
app     |
app     | Import trace for requested module:
app     | ./styles/wallet.module.css
app     | ./wallets/client/hooks/prompt.js
app     | ./wallets/client/hooks/index.js
app     | ./wallets/client/context/hooks.js
app     | ./wallets/client/context/provider.js
app     | ./wallets/client/context/index.js

* fix effect of wallet indicators on logo

* Fix deleting wallet template logs

* Use name as primary key of WalletTemplate

* Fix wallet_clear_vault trigger not mentioned in README

* Fix wallet receive prompt

Also remove no longer needed templateId from wallets.json and helper functions

* Use findUnique since name is now primary key

* Merge Alby wallets into one

* Remove unused name parameter from WalletsForm component

* Fix number check to decide if wallet or template

* Update wallet encryption on click, not as effect

* add cashu.me and lightning address logos

* add images

* Use recommended typeof to check if IDB available

* Also check if IDB available on delete

* Use constraint triggers

* Add indices on columns used for joins

* Fix inconsistent CLEAR OR REPLACE TRIGGER

* Attach wallet_check_support trigger to WalletProtocol table

* Update wallets/README.md

* Remove debugging code

* Refactor reducer: replace page with status

* Show 'wallets unavailable' if device does not support IndexedDB

* Remove duplicate ELSIF condition

* Fix hasSendWallet

The useSendWallets hook was not checking if the returned send wallets are enabled.

Since the components that used that hook only need to know if there is a send wallet, I replaced the useSendWallets hook with a useHasSendWallet hook.

* Add Cash App wallet

* fix changes loglevel enum

* Fix key init race condition in strict mode if no key exists yet

* Formatting

* Fix key init race condition via transactions in readwrite mode

* Replace Promise.withResolvers with regular promises

* replace generic spinner with our usual

---------

Co-authored-by: k00b <k00b@stacker.news>
2025-07-15 16:36:43 -05:00
ekzyis
b1a0abe32c
Service Worker rewrite (#2274)
* Convert all top-level arrow functions to regular functions

* Refactor webPush.sendNotification call

* Refactor webPush logging

* Rename var to title

* Rewrite service worker

This rewrite simplifies the service worker by removing

* merging of push notifications via tag property
* badge count

These features weren't properly working on iOS. We concluded that we don't really need them.

For example, this means replies will no longer get merged to "you have X new replies" but show up as individual notifications.

Only zaps still use the tag property so devices that support it can still replace any previous "your post stacked X sats" notification for the same item.

* Don't use async/await in service worker

* Support app badge count

* Fix extremely slow notificationclick

* Fix serialization and save in pushsubscriptionchange event
2025-07-10 11:54:23 -05:00
ekzyis
17aada6dbc
Fix missing dependency in snow callback (#2270) 2025-07-07 15:18:15 -05:00
ekzyis
ec902ebc55
Remove unnecessary service worker message types (#2268)
* Remove service worker logger

* Use async/await for togglePushSubscription

* Remove commented out logger calls in service worker

* Remove message channel between service worker and app

The listener for messages from the service worker was removed in a previous commit.

* Remove unused OS detection for service worker

* Formatting

* Remove unnecessary service worker message types

These messages types were meant to debug or fix push notifications getting lost.

We figured out the issue: push notifications were lost because of silent pushes.

So these message types are no longer needed.

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2025-07-07 14:43:20 -05:00
k00b
8382dda231 back to lightning animation 2025-07-07 14:35:16 -05:00
ekzyis
18a38d8363
Refactor animations (#2261)
* Fix fireworks not checking localStorage flag

* Refactor animations

* Don't import unused animations

* Remove unused hook

---------

Co-authored-by: k00b <k00b@stacker.news>
2025-07-07 14:34:37 -05:00
ekzyis
3a27057781
Remove service worker logger (#2265)
* Remove service worker logger

* Use async/await for togglePushSubscription

* Remove commented out logger calls in service worker

* Remove message channel between service worker and app

The listener for messages from the service worker was removed in a previous commit.

* Remove unused OS detection for service worker
2025-07-07 14:15:26 -05:00
ekzyis
1eea0a3ae0
Fix fireworks not checking localStorage flag (#2260) 2025-07-05 10:41:16 -05:00
Keyan
96fd271573
add fireworks (#2258)
* add fireworks

* fix weird search background color due to canvas overlay

* prevent going off small screens
2025-07-04 01:14:45 -05:00
ekzyis
089fe4d57b
Remove unused injected amount param (#2241) 2025-06-19 11:54:55 -05:00
Bryan Mutai
6d50f7c9fc
fix embed list bullet to render at top of embed (#2221)
* fix embed list bullet to render at top of embed

* make it work for images/video

* fix tweet skeleton and list horizontal scroll

---------

Co-authored-by: k00b <k00b@stacker.news>
2025-06-17 18:33:42 -05:00
Axel Vyrn
16da50733c
Lnurl UI update (#2220)
* Update index.js

added info tooltip for LNURL-auth button

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* use existing lightning explainer

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-06-13 23:10:32 -05:00
Edward Kung
524b1b97f3
user and territory autocomplete in search bar (#2217)
* autocomplete in the search bar

* update some naming conventions

* create dual autocomplete

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-06-13 21:42:28 -05:00
Bryan Mutai
dc01ebdb26
Add Territory Sub management tab in Subscriptions (#2191)
* Add Territory Sub management tab in Subscriptions

* don't use queryRawUnsafe

* auto width on select

* separate into pages for browser nav

* fix multiple separators

* simplify queries

---------

Co-authored-by: k00b <k00b@stacker.news>
2025-06-13 15:01:25 -05:00
ekzyis
874694eb10
Add zines to socials in footer (#2223) 2025-06-13 13:03:50 -05:00
m0wer
0edf68cab9
feat: Territory autocomplete (#2124)
* feat: Territory autocomplete

Closes #992.

* refactor: refactor UserSuggest and TerritorySuggest components

* style: lint

* refactor: unify user and territory autocomplete logic

* simplify a bit and fix unrelated onSelect re-query

* fix skipping empty string on forward draft population

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-05-12 17:59:47 -05:00
Bryan Mutai
586cb86ec2
Add check to prevent Markdown Heading links from rendering in notifcations (#2152)
* Prevent Markdown Heading links in notifications from being clickable

* make it more explicit and work on other pages

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-05-12 15:46:34 -05:00
ekzyis
a1bc6dc217
Remove 'originally posted at' (#2148) 2025-05-05 09:56:41 -05:00
ekzyis
9fc819ec37
Also unsubscribe from any children (#2120) 2025-04-22 08:02:36 -05:00
Abhi Shandilya
5965b3d090
set boost max (#2109)
* set boost max

* reduce max and apply to boost act

* make boost position aware paid action state

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-04-21 19:31:18 -05:00
Bryan Mutai
984790ed5c
feat(Poll): add option to randomize poll choices (#2082)
* feat(Poll): add option to randomize poll choices

* improve

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-04-15 17:19:14 -05:00
soxa
b6f6cc821c
Crop avatars with Imgproxy (#2074)
* cropPhoto mutation, crop avatars with Imgproxy

* cropjob logging, conditional uploads url

* comment typo

* use public Imgproxy URL to re-upload cropped pic

* fix avatar in dev

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-04-15 15:41:33 -05:00
soxa
22e4f8acf5
show sats on full view pinned comments (#2071)
* show sats on full view pinned comments; simplify conditions; pass topLevel as full status for comments

* comment view: show Pin instead of Boost also for own items

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2025-04-15 14:57:01 -05:00
ekzyis
719cb2d507
Prompt to attach receive wallet on post (#2059)
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2025-04-14 19:40:43 -05:00
ekzyis
d3b81e4346
Change wallet badges order (#2102) 2025-04-14 15:33:00 -05:00
ekzyis
7be94dcfed Move wallet components into wallets/ 2025-04-13 00:50:29 +02:00
ekzyis
66d7eef617
Fix wallet indicator blink via wallet loading state (#2091)
* Fix wallet indicator blink via wallet loading state

* Fix 'attach wallet' button not showing up on page refresh
2025-04-12 14:26:30 -05:00
soxa
bc0be4f92a
enhance: helpful error message on login (#2094)
* enhance: helpful error message on login

* better message, don't edit original message

* fix comment placement
2025-04-12 14:23:08 -05:00
ekzyis
a7245930c2
Use wallets instead of wallets.length as useZap dependency (#2088)
* Potential fix for stale useZap wallet dependency

* Memoize context value for wallets
2025-04-09 15:53:31 -05:00
ekzyis
52365c32ed
Wallet badges (#2040)
* Remove gun+horse streak

* Add wallet badges

* Fix empty recv wallet detected as enabled

* Resolve badges via columns and triggers

* Fix backwards compatibility by not dropping GQL fields

* Gun+horse notifications as streaks via triggers

* Fix error while computing streaks

* Push notifications for horse+gun

* Move logic to JS via pgboss job

* Fix argument to notifyNewStreak

* Update checkWallet comment

* Refactor notification id hack

* Formatting

* Fix missing update of possibleTypes

This didn't cause any bugs because the added types have no field resolvers.

* Add user migration

* Fix missing cast to date

* Run checkWallet queries inside transaction
2025-04-09 15:29:44 -05:00
nl
af096a08a0
Gradually replace default tips with user-defined ones on long press (up to 7) (#2069)
* commented the lines to make sure dupes are also checked on subdomains

* chore: fix lint issues

* add more than 3 custom tips, up to 7 total

* fix merge issue

* shorten logic

* don't check length for slice without need

---------

Co-authored-by: 김현희 <pygmal@gimhyeonhuiui-MacBookAir.local>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-04-07 18:21:51 -05:00