Commit Graph

38 Commits

Author SHA1 Message Date
ekzyis b9461b7eb3
Allow zapping, posting and commenting without funds or an account (#336)
* Add anon zaps

* Add anon comments and posts (link, discussion, poll)

* Use payment hash instead of invoice id as proof of payment

Our invoice IDs can be enumerated.
So there is a - even though very rare - chance that an attacker could find a paid invoice which is not used yet and use it for himself.
Random payment hashes prevent this.

Also, since we delete invoices after use, using database IDs as proof of payments are not suitable.
If a user tells us an invoice ID after we deleted it, we can no longer tell if the invoice was paid or not since the LN node only knows about payment hashes but nothing about the database IDs.

* Allow pay per invoice for stackers

The modal which pops up if the stacker does not have enough sats now has two options: "fund wallet" and "pay invoice"

* Fix onSuccess called twice

For some reason, when calling `showModal`, `useMemo` in modal.js and the code for the modal component (here: <Invoice>) is called twice.

This leads to the `onSuccess` callback being called twice and one failing since the first one deletes the invoice.

* Keep invoice modal open if focus is lost

* Skip anon user during trust calculation

* Add error handling

* Skip 'invoice not found' errors

* Remove duplicate insufficient funds handling

* Fix insufficient funds error detection

* Fix invoice amount for comments

* Allow pay per invoice for bounty and job posts

* Also strike on payment after short press

* Fix unexpected token 'export'

* Fix eslint

* Remove unused id param

* Fix comment copy-paste error

* Rename to useInvoiceable

* Fix unexpected token 'export'

* Fix onConfirmation called at every render

* Add invoice HMAC

This prevents entities which know the invoice hash (like all LN nodes on the payment path) from using the invoice hash on SN.

Only the user which created the invoice knows the HMAC and thus can use the invoice hash.

* make anon posting less hidden, add anon info button explainer

* Fix anon users can't zap other anon users

* Always show repeat and contacts on action error

* Keep track of modal stack

* give anon an icon

* add generic date pivot helper

* make anon user's invoices expire in 5 minutes

* fix forgotten find and replace

* use datePivot more places

* add sat amounts to invoices

* reduce anon invoice expiration to 3 minutes

* don't abbreviate

* Fix [object Object] as error message

Any errors thrown here are already objects of shape { message: string }

* Fix empty invoice creation attempts

I stumbled across this while checking if anons can edit their items.

I monkey patched the code to make it possible (so they can see the 'edit' button) and tried to edit an item but I got this error:

  Variable "$amount" of required type "Int!" was not provided.

I fixed this even though this function should never be called without an amount anyway. It will return a sane error in that case now.

* anon func mods, e.g. inv limits

* anon tips should be denormalized

* remove redundant meTotalSats

* correct overlay zap text for anon

* exclude anon from trust graph before algo runs

* remove balance limit on anon

* give anon a bio and remove cowboy hat/top stackers;

* make anon hat appear on profile

* concat hash and hmac and call it a token

* Fix localStorage cleared because error were swallowed

* fix qr layout shift

* restyle fund error modal

* Catch invoice errors in fund error modal

* invoice check backoff

* anon info typo

* make invoice expiration times have saner defaults

* add comma to anon info

* use builtin copy input label

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-11 18:50:57 -05:00
SatsAllDay 6e05cd38f9
Singular/Plural "Sats" labels (#380)
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-08 16:04:06 -05:00
keyan e1c51075a2 fix conditional nextFetchPolicy overriding cache-only on SSR and suppress time hydration warnings 2023-07-31 14:54:30 -05:00
keyan ab2046ab0b fix issues with new linting 2023-07-25 09:14:45 -05:00
keyan 6407455def upgrade react-bootstrap 2023-07-24 13:53:53 -05:00
keyan 59f7b6ff26 Revert "Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades""
This reverts commit 18910fa2ed.
2023-07-23 10:08:43 -05:00
keyan 18910fa2ed Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades"
This reverts commit d0314ab73c.
2023-07-23 09:16:12 -05:00
keyan d0314ab73c shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades 2023-07-21 17:33:11 -05:00
keyan 6d8780373a form enhancements 2023-05-11 14:34:42 -05:00
keyan 4cae1ae230 reuse validation on server 2023-02-08 13:39:53 -06:00
keyan 9644a9f867 slashtags auth 2023-01-18 12:49:20 -06:00
keyan 525cab2573 upgrade deps 2022-11-06 11:28:58 -06:00
keyan 52de4a253e max amount for alby 2022-09-06 09:37:53 -05:00
keyan c061f4a6f0 limit pending invoices 2022-05-31 17:17:48 -05:00
keyan 188230c37c add notification settings 2022-04-21 17:50:02 -05:00
secondl1ght d056a4c120
Update wallet.js 2022-03-17 12:04:53 -06:00
keyan 9490b3dc5f max fee needs to be a number 2022-02-02 16:01:48 -06:00
keyan e37475f927 send to lightning address 2022-01-24 11:25:15 -06:00
keyan 54c1c8c41b wallet history link on wallet pages 2021-12-16 14:17:50 -06:00
keyan b8080137a8 lnurl-withdrawal support 2021-10-28 14:59:53 -05:00
keyan 07b9da353b smarter use of SSR and caching 2021-10-26 15:49:37 -05:00
keyan edf9584391 remove ln adder alert debugging 2021-10-08 07:40:35 -07:00
keyan d3c3657a92 add alert for lightning address 2021-10-08 07:35:57 -07:00
keyan ca1a95094c ssr everything 2021-09-30 10:46:58 -05:00
keyan 3f8b5894cb small clean up 2021-09-09 14:10:15 -05:00
keyan 968892b661 clean up console messages 2021-09-07 13:04:56 -05:00
keyan 7ffb3fd18a support webln fund and withdrawal 2021-09-07 12:52:59 -05:00
keyan 18f1a9f335 center wallet balance text 2021-09-02 12:22:48 -05:00
keyan 79cb2d5c27 withdrawl => withdrawal/withdraw 2021-08-19 16:42:21 -05:00
keyan 3fa42caa4e add wallet balance to all wallet pages 2021-07-15 11:42:02 -05:00
keyan 2e26e421e7 lnurl-auth 2021-06-26 22:09:39 -05:00
keyan 01922e4b88 notifications done 2021-06-24 18:56:01 -05:00
keyan 157488ea5d make withdrawls mostly work 2021-05-13 16:19:51 -05:00
keyan ce55fdfe9c withdrawl page 2021-05-13 08:28:38 -05:00
keyan 7a8afd56c3 partial withdrawl 2021-05-12 20:51:37 -05:00
keyan d92fc12187 half done with wallets 2021-05-12 18:04:19 -05:00
keyan bc0389e622 invoiced ... WIP transactions 2021-05-11 10:52:50 -05:00
keyan 4b07edf6f5 ready for invoices 2021-05-06 16:15:22 -05:00