Commit Graph

135 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
ekzyis 7369bd819d
Add nostr login (#367)
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-07 19:50:01 -05:00
keyan ffb856ae88 fix oauth signup 2023-08-07 15:05:55 -05:00
keyan c7e2623461 increase apollo slowlog threshold 2023-07-31 16:02:50 -05:00
keyan c909efb7b7 update wallet code to prisma 5, handle prisma 5 errors on serialization 2023-07-31 08:31:40 -05:00
keyan d04dc691df provide jwt migration 2023-07-30 14:03:24 -05:00
keyan 5232b59625 upgrade to next-auth 4 (bonus: improve error pages) 2023-07-29 14:38:20 -05:00
keyan 7542dd6cc4 upgrade to prisma 4 2023-07-26 19:18:42 -05:00
keyan 672853a7ea upgrade to prisma 3 2023-07-26 11:01:31 -05:00
keyan ab2046ab0b fix issues with new linting 2023-07-25 09:14:45 -05:00
keyan dae9c64e96 more package updates 2023-07-24 19:50:55 -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 93afd4ea9a fix credentials login/signup/link bug 2023-07-10 19:20:38 -05:00
keyan e8aa0a4dae users? => stackers? 2023-07-09 12:53:50 -05:00
keyan 59ee15b551 new user email copy 2023-06-19 17:42:47 -05:00
keyan cc6dc8c68b add daily discussion thread permalink 2023-06-19 14:40:24 -05:00
ekzyis e97509eea7
Use PWA with display: standalone (#292)
* Use next-pwa

* Use standalone + back button

* Use Notification API

* Use custom service worker

* Use url_handlers

* Add offline page

* Use smaller icon in notification

* Only prompt for notifications if logged in

* small enhancements to standalone pwa

* remove unused back arrow

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-05-31 17:28:33 -05:00
mvpratt 48b08d2aff limit oauth scope to minimum possible: public github info for user 2023-04-26 13:02:42 -05:00
keyan a3e928dc42 correct lnurlp nostr pubkey stuff 2023-02-24 10:41:47 -06:00
keyan 30cde2ea38 fix nip57? 2023-02-15 11:20:43 -06:00
keyan 9f2c8d64bc use decodeURIComponent instead 2023-02-14 19:04:05 -06:00
keyan 93d4581360 complete nip 57 support 2023-02-14 16:58:12 -06:00
keyan ef5346000b support NIP-57 2023-02-14 12:52:15 -06:00
keyan 29c59d93ea open timestamps 2023-01-22 14:17:50 -06:00
keyan 9644a9f867 slashtags auth 2023-01-18 12:49:20 -06:00
keyan ae5c6c457f global modal + small fixes/enhancements 2023-01-10 17:13:37 -06:00
keyan 2d012ba7fe allow nip05 for users 2023-01-06 18:53:29 -06:00
keyan 41226245c5 referrals 2022-12-19 16:27:52 -06:00
keyan ebbd1175b1 don't mix int types 2022-11-26 18:23:49 -06:00
keyan 525cab2573 upgrade deps 2022-11-06 11:28:58 -06:00
keyan 172d6c3c2f optionally hide invoice descriptions 2022-08-30 16:50:47 -05:00
keyan 0ad886ffc0 constrain invoice quantity and amount 2022-08-30 15:33:39 -05:00
keyan 1df49e03d9 account linking 2022-06-08 16:26:44 -05:00
keyan c061f4a6f0 limit pending invoices 2022-05-31 17:17:48 -05:00
keyan 47392f0d7c expire lnurl withdrawals after an hour 2022-05-19 11:50:02 -05:00
keyan 6a8fba14eb check invoice description hash against lnurl pay metadata 2022-05-19 09:22:25 -05:00
keyan 9c8396670a adhere to lnurlp spec better 2022-05-19 08:18:28 -05:00
keyan aa4ac2ecc9 add ln addr + lnurl pay qr code to profile pages 2022-05-06 14:34:35 -05:00
keyan 771978d562 sub to newsletter on sign up 2022-05-04 13:29:30 -05:00
keyan dc44764008 limit related queries in me query for SSR 2022-04-28 17:00:09 -05:00
keyan 934c5021a9 a few perf enhancements + gql slowlogs 2022-04-28 13:11:05 -05:00
keyan 8e0aaab161 refine module instantiation 2022-04-27 17:06:42 -05:00
keyan 188230c37c add notification settings 2022-04-21 17:50:02 -05:00
keyan 344958943c provide 'plain text' email login link for users using embedded browsers in their mobile email clients 2022-03-10 16:47:00 -06:00
keyan 3e977c020d fix lightning font loading 2022-02-23 21:17:10 -06:00
keyan 8c2a4dc76a add search SEO and capture 2022-02-05 11:29:41 -06:00
keyan 28b86af898 basic search query api 2022-01-26 09:35:14 -06:00
keyan d0403fc959 fix lnurlp domain 2022-01-25 14:28:50 -06:00
keyan e37475f927 send to lightning address 2022-01-24 11:25:15 -06:00
keyan d102065479 don't request email from gh 2022-01-19 17:14:45 -06:00
keyan f9016d13ee only check capture if not page is not cached 2022-01-12 19:35:17 -06:00
keyan 3d94ef32ac improve screen capture: 2x resolution, caching, exit on exception 2022-01-12 17:13:09 -06:00
keyan 9d07318156 cast amount 2022-01-09 11:22:43 -06:00
keyan 8286095871 msats on lnaddr pay 2022-01-09 11:13:57 -06:00
keyan 25e46a525d fix lnaddr not checking 2022-01-09 10:50:51 -06:00
keyan 7989e38207 limit to one capture at a time 2021-11-30 09:35:17 -06:00
keyan b8080137a8 lnurl-withdrawal support 2021-10-28 14:59:53 -05:00
keyan 55af57a5b7 move website capture to a spawned process 2021-10-22 17:21:38 -05:00
keyan 18f4c9c88d create invite page 2021-10-15 12:56:54 -05:00
keyan e288f88ec7 share metadata functions 2021-10-07 14:03:54 -07:00
keyan e16c056ef1 attempt description hash encoding 2021-10-07 13:36:12 -07:00
keyan 5928dcf06d make description hash match? 2021-10-07 13:14:11 -07:00
keyan 48ff38dc56 add max to lnaddr 2021-10-07 12:12:49 -07:00
keyan bef68781a7 fully specify ln addr url 2021-10-07 11:53:05 -07:00
keyan eafe474746 WIP lightning addr 2021-10-07 11:37:59 -07:00
keyan ca1a95094c ssr everything 2021-09-30 10:46:58 -05:00
keyan 8a054d55ff provide more desc error in lnurl-auth 2021-08-12 18:46:15 -05:00
keyan 1d6e301b10 fix crashes and report which object failed in walletd 2021-08-12 16:21:56 -05:00
keyan eab1c69c7d don't delay capture 2021-07-08 10:14:31 -05:00
keyan 248f5a9967 use env for url 2021-07-07 19:45:02 -05:00
keyan 68e80b615c working previews 2021-07-07 19:15:27 -05:00
keyan 9a15c228dc add forgetten lnurl-auth files 2021-06-26 22:18:32 -05:00
keyan 2e26e421e7 lnurl-auth 2021-06-26 22:09:39 -05:00
keyan 17a79b2251 prepare for deployment 2021-06-02 10:23:30 -04:00
keyan 4f627e2a5c check for usernames on typing 2021-05-21 17:32:21 -05:00
keyan 8a462252af force unique user name 2021-05-21 14:34:40 -05:00
keyan bf73e98425 add lightning 2021-04-29 16:58:43 -05:00
keyan f7b92d64c3 improve resolver and provide sats/$ 2021-04-29 10:56:28 -05:00
keyan 900b70da77 custom auth page 2021-04-24 16:05:07 -05:00
keyan 28ed42fc29 more progress 2021-04-14 18:56:29 -05:00
keyan 9acde2df1c a bunch of increments 2021-04-12 13:05:09 -05:00
keyan 341b3a291a begin working on db schema 2021-03-25 14:29:24 -05:00
keyan 53a3236b0d Initial commit from Create Next App 2021-03-22 15:36:10 -05:00