Commit Graph

1295 Commits

Author SHA1 Message Date
keyan 15c11efc0a add anon's earnings to reward pool 2023-08-14 14:37:09 -05:00
keyan 03f0329984 fix image uploading/edit 2023-08-13 14:12:18 -05:00
keyan 9727fb4838 merge bugs fixes for anon zapping 2023-08-12 09:21:40 -05:00
ekzyis f0bc1baed2 Save payment tokens in localStorage 2023-08-12 04:18:32 +02:00
ekzyis 4d725272e3 Fix cost not set after form reset 2023-08-12 03:12:03 +02:00
SatsAllDay 1f6e144cb2
iOS splash screen for dark-theme (#393)
Add images for each supported iOS device for a dark-theme splash screen

Conditionally use light vs dark images based on the `(prefers-color-scheme: dark)`
media query

Note: Once the PWA is installed, it appears that iOS caches the splash screen image for an
unknown period of time, so if you change your device's preferred theme after installation,
the splash screen doesn't update to reflect it. The PWA must be re-installed for
this change to take effect.
2023-08-11 19:08:24 -05:00
ekzyis 9c212eea30
Fix dropdown items not visible in darkmode on some browsers (#394)
See 6354913420

Co-authored-by: ekzyis <ek@stacker.news>
2023-08-11 19:05:34 -05:00
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
keyan 5b821906cf use builtin copy input label 2023-08-11 18:43:45 -05:00
keyan 705e21a72c add comma to anon info 2023-08-11 18:19:35 -05:00
keyan 86239a235d make invoice expiration times have saner defaults 2023-08-11 18:10:46 -05:00
keyan abb9ca5524 anon info typo 2023-08-11 17:54:26 -05:00
keyan a5eb7b5443 invoice check backoff 2023-08-11 17:54:26 -05:00
ekzyis 9e4f9aa558 Catch invoice errors in fund error modal 2023-08-12 00:35:24 +02:00
keyan 39db6e096d restyle fund error modal 2023-08-11 17:05:21 -05:00
keyan 63dd5d4d09 fix qr layout shift 2023-08-11 17:05:21 -05:00
ekzyis 73aa0d2d44 Fix localStorage cleared because error were swallowed 2023-08-11 23:36:53 +02:00
keyan 38fddcf283 concat hash and hmac and call it a token 2023-08-11 14:22:18 -05:00
keyan b2508b738a make anon hat appear on profile 2023-08-11 14:12:18 -05:00
keyan e995fd4929 give anon a bio and remove cowboy hat/top stackers; 2023-08-11 13:32:01 -05:00
keyan d406ccc2d8 remove balance limit on anon 2023-08-11 12:59:09 -05:00
keyan 6e694139f4 exclude anon from trust graph before algo runs 2023-08-11 12:49:50 -05:00
keyan 9c6ecf9526 correct overlay zap text for anon 2023-08-11 12:43:18 -05:00
keyan e4c2d113ef remove redundant meTotalSats 2023-08-11 12:41:02 -05:00
keyan 5302263e2e anon tips should be denormalized 2023-08-11 12:25:30 -05:00
keyan 6ba1c3e8ab anon func mods, e.g. inv limits 2023-08-11 12:14:37 -05:00
ekzyis 41f46cf41e 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.
2023-08-11 05:30:22 +02:00
ekzyis 28b4588a12 Fix [object Object] as error message
Any errors thrown here are already objects of shape { message: string }
2023-08-11 05:30:06 +02:00
keyan d92701c56f don't abbreviate 2023-08-10 19:58:33 -05:00
keyan 0f74893c7d reduce anon invoice expiration to 3 minutes 2023-08-10 18:40:11 -05:00
keyan ea9c405dfa add sat amounts to invoices 2023-08-10 18:33:57 -05:00
keyan e668b1f7f3 use datePivot more places 2023-08-10 17:56:30 -05:00
keyan 53a6c9489f fix forgotten find and replace 2023-08-10 17:40:50 -05:00
keyan 2fa34eccb6 make anon user's invoices expire in 5 minutes 2023-08-10 17:36:49 -05:00
keyan 26762efcea add generic date pivot helper 2023-08-10 17:36:49 -05:00
keyan 46274fba4f give anon an icon 2023-08-10 17:36:49 -05:00
ekzyis 2fbf1e4cc3 Keep track of modal stack 2023-08-11 00:35:43 +02:00
ekzyis 49736e8d3c Always show repeat and contacts on action error 2023-08-10 23:04:06 +02:00
ekzyis 35760e1655 Fix anon users can't zap other anon users 2023-08-10 22:57:45 +02:00
keyan 081c5fef0b make anon posting less hidden, add anon info button explainer 2023-08-10 14:41:56 -05:00
Keyan cbfd6998a6
Merge branch 'master' into 266-zaps-without-account 2023-08-10 12:40:30 -05:00
ekzyis 41463d7183
Set IMGPROXY_MAX_SRC_RESOLUTION to 200 (#389)
Co-authored-by: ekzyis <ek@stacker.news>
2023-08-10 12:17:33 -05:00
keyan 248e0c1c13 rewards: rm negative log range and lowest trust step = 1 2023-08-10 12:15:01 -05:00
ekzyis bb2212d51e 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.
2023-08-10 07:10:07 +02:00
keyan e913ab71ad more even rewards 2023-08-09 22:27:03 -05:00
ekzyis 4fe1d416de Fix onConfirmation called at every render 2023-08-10 04:13:09 +02:00
ekzyis 9bc5138461 Fix unexpected token 'export' 2023-08-10 03:34:38 +02:00
ekzyis 318088179a Rename to useInvoiceable 2023-08-10 03:34:38 +02:00
ekzyis 38dbbd5a4f Fix comment copy-paste error 2023-08-10 03:34:38 +02:00
ekzyis bd59e392b7 Remove unused id param 2023-08-10 03:34:38 +02:00