Commit Graph

114 Commits

Author SHA1 Message Date
ekzyis 0ea4f9bc27
Fix click to load in preview (#427)
* Rename confusing variable name

* Use nullish coalescing operator

* Fix click to load in preview

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-08-23 15:30:38 -05:00
rleed 799ec987b4
Forward sats to user: text trimming and menu click-out UX improvements (#397)
Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-08-19 18:30:41 -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
SatsAllDay d5f7855adf
Debounce API requests on edit nym by 500ms (#387)
Support an optional debounce prop on Input component

If provided, the debounce is applied to the validation of the containing form,
imperatively invoking form validation after debounce is finalized

Also required introducing the `validateOnChange` prop on `Form` which gets passed to `Formik`, and defaults to true, just as it does in `Formik`.

Imperatively invoking form validation seemed to be the only way to debounce the validation call through formik.
2023-08-09 17:06:22 -05:00
keyan 42234eae9b highlight notification on back button 2023-08-03 19:14:04 -05:00
keyan f91be5d70f fix form skeleton 2023-07-31 12:35:58 -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
Jo Wo bf4b8714fe
Render images without markdown and use image proxy (#245)
* Parse image links during markdown rendering

* Use imgproxy to replace links

* Add healthcheck

See https://docs.imgproxy.net/healthcheck

* Enable WebP and animation support

* Only replace image URLs

* Replace all occurrences

* Fix creating posts with no text

* Embed image on link posts where link is image

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-07-12 19:10:01 -05:00
ekzyis 40ef4f47c8
Remove unused var (#330)
Co-authored-by: ekzyis <ek@stacker.news>
2023-07-04 14:36:38 -05:00
ekzyis eac73e7169
Fix double submit (#328)
Co-authored-by: ekzyis <ek@stacker.news>
2023-06-23 10:21:29 -05:00
keyan f8724f75e7 add tab shortcut and better resulting selection ranges 2023-06-19 13:07:06 -05:00
keyan 02ec14549f prevent markdown input cursor from moving 2023-06-13 09:19:50 -05:00
keyan ef533d41a6 move markdown related code to proper component 2023-06-12 17:39:20 -05:00
keyan 6a49f37c68 only honor selection range in textarea 2023-06-12 17:21:13 -05:00
keyan 79df6b2be2 prevent default on all markdown shortcuts 2023-06-12 13:49:58 -05:00
ekzyis 069417d130
Enable push notifications in settings (#301)
* Enable push notifications in settings

* Fix checkbox still checked after user denied permission

The error was related to me thinking that the value prop does anything. It didn't.
The value of the checkbox is handled by formik.
So the solution was to hook into formik and use the handler which actually changes the value.

* Add double opt-in to /notifications

* Better styling of alert in /notifications

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-06-12 13:03:44 -05:00
ekzyis 393d4c7603
Add Markdown formatting hotkeys: CTRL+K, CTRL+I, CTRL+B (#305)
* Fix usage of deprecated event.keyCode

* Add CTRL+K to insert markdown link formatting

* Also add CTRL+B and CTRL+I

* Fix undo not working after using setValue

Undo doesn't work if inputs are changed using javascript code like helpers.setValue().

The solution is to also use `document.execCommand()`.

See https://stackoverflow.com/questions/27027833/is-it-possible-to-edit-a-text-input-with-javascript-and-add-to-the-undo-stack

However, `document.execCommand()` is deprecated but there seems to be no alternative, see:

- https://stackoverflow.com/questions/60581285/execcommand-is-now-obsolete-whats-the-alternative
- https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand#browser_compatibility
- https://github.com/codex-team/editor.js/discussions/2214

And so far, every browser still seems to support it: https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand#browser_compatibility

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-06-12 12:29:50 -05:00
keyan 87e86526f8 fix submit button not being disabled 2023-05-18 13:02:19 -05:00
keyan 6d8780373a form enhancements 2023-05-11 14:34:42 -05:00
keyan df1f1a483a require sub selection, allow editting 2023-05-10 19:30:51 -05:00
keyan 2d012ba7fe allow nip05 for users 2023-01-06 18:53:29 -06:00
keyan 30b1ee33aa user search 2022-10-25 12:13:06 -05:00
keyan e4d150413b search filters 2022-10-20 17:44:44 -05:00
keyan 729bcead69 select instead of dropdown for currency 2022-10-04 16:21:42 -05:00
ekzyis c184faf017 Use dropdown for fiat selection in settings 2022-09-18 03:45:21 +02:00
keyan a5d1d8dc0f user suggestions on forward 2022-08-31 14:09:49 -05:00
keyan 016e357ebd clear inputs 2022-08-30 17:02:45 -05:00
keyan 388c7d0240 full powered editing 2022-08-18 13:15:24 -05:00
keyan ddb4a30c4b spam fees 2022-08-11 15:38:10 -05:00
keyan 82280b0966 add polls 2022-07-30 08:51:04 -05:00
keyan beef34abfa linkable headers 2022-07-17 10:35:50 -05:00
keyan 08defc561b improved heading and images for markdown 2022-07-13 18:00:48 -05:00
keyan d978ff5ea5 forward tips from posts 2022-04-19 13:32:39 -05:00
keyan a627322220 add job company and location 2022-03-07 15:50:13 -06:00
keyan b954186d31 jobs w/o payments yet 2022-02-24 13:05:57 -06:00
keyan 37f8784789 don't render markdown preview unless user wants to see it 2022-02-10 11:51:44 -06:00
keyan e37475f927 send to lightning address 2022-01-24 11:25:15 -06:00
keyan 7aa294b57e less hasty fix preventing localStorage call on SSR 2022-01-08 09:31:37 -06:00
keyan e6c693f241 don't call localStorage on server 2022-01-07 20:05:00 -06:00
keyan b6a530f5c4 comment draft saving 2022-01-07 12:55:40 -06:00
keyan e42f1d6bb9 WIP save drafts of posts 2022-01-07 12:28:23 -06:00
keyan d92f58aaf4 inv & with satistics + filtering 2021-12-16 11:27:12 -06:00
keyan 2d97314d33 dark mode without ability to switch 2021-11-04 14:22:03 -04:00
keyan e4c1c2f1e1 refine tipping 2021-09-12 11:55:38 -05:00
keyan 0a20f2ea23 WIP tips 2021-09-10 13:55:36 -05:00
keyan ce0e3dac45 auto-populate link title 2021-08-22 10:25:17 -05:00
keyan 4a770b61b6 cmd or ctrl enter to submit 2021-08-19 16:13:33 -05:00
keyan b4be2c613b comment edit spagetti 2021-08-10 17:59:06 -05:00
keyan 605aac97ab markdown previews 2021-07-01 18:51:58 -05:00
keyan 4d161a8092 add sticky footer 2021-06-02 19:15:28 -04:00
keyan 80ff13abd6 finish mvp 2021-05-24 19:08:56 -05:00
keyan a9ea341a7b create reserved usernames 2021-05-21 19:09:11 -05:00
keyan 4f627e2a5c check for usernames on typing 2021-05-21 17:32:21 -05:00
keyan 0eabe1463d attempts at serializable transactions 2021-05-19 20:09:32 -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 4b07edf6f5 ready for invoices 2021-05-06 16:15:22 -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 bc5d4d4808 tables 2021-04-13 19:57:32 -05:00