Commit Graph

974 Commits

Author SHA1 Message Date
keyan 5c3c7fb185 allow more restricted macroons fix #827 2024-02-14 12:58:25 -06:00
keyan 04991b4ddf try url object with next/link to fix #822 2024-02-13 19:44:03 -06:00
ekzyis d6465162bd
Fix missing setInitialized (#815)
Payment methods were not marked as initialized if the local storage item did not exist on page load.
2024-02-13 14:30:54 -06:00
Keyan ec4e1b5da7
LND autowithdraw (#806)
* wip

* wip

* improved validatation, test connection before save, code reuse

* worker send to lnd

* autowithdraw priority
2024-02-13 13:17:56 -06:00
ekzyis 894a73d713
Show item page in internal links (#807)
* Include item page in link text

* Fix invalid URLs parsed
2024-02-12 13:34:33 -06:00
mzivil 6355d7eabc
Add nsfw setting to territories (#788)
* add nsfw column to sub

* add nsfw boolean to territorySchema

* save nsfw value in upsertSub mutation

* return nsfw value from Sub query for correct value in edit territory form

* add nsfw checkbox to territory form

* add nsfw badge to territory header

* add nsfwMode to user

* show nsfw badge next to item territory

* exclude nsfw sub from items query

* show nsfw mode checkbox on settings page

* fix nsfw badge formatting

* separate user from current, signed in user

* update relationClause to join with sub table

* refactor to simplify hide nsfw sql

* filter nsfw items when viewing user items

* hide nsfw posts for logged out users

* filter nsfw subs based on user preference

* show nsfw sub name if logged out user is viewing the page

* show current sub at the top of the list instead of bottom

* always join item with sub to check nsfw

* check for sub presence before showing nsfw badge on item

* skip manually adding sub to select if sub is null

* fix relationClause to join with root item

* move moderation and nsfw into accordion

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-02-09 20:35:32 -06:00
ekzyis b3d485e8c4
Refactor default payment method setting (#803)
* Refactor setting of default providers

* fixed warning about component update while rendering another component
* individual providers no longer need to know if they are the default or not
* default setting is now handled by WebLNContext -- the same context that returns the provider. this makes a lot more sense and is a lot easier to read
* default payment checkbox is now also disabled if there is only one enabled provider or if it is the default provider

* Fix order lost on page reload

On page reload, the providers were synced in the order they were loaded.

This means that the default payment provider setting was lost.

Fixed this by syncing order to local storage and on page reload, only syncing providers when they were initialized (else the order would have been lost again).
2024-02-09 09:42:26 -06:00
ekzyis ec3e8f0079
Remove deprecated comment (#801) 2024-02-09 09:39:59 -06:00
ekzyis 310011f05d
Expose WebLN interface via React Context (#749)
* Add LNbits card

* Save LNbits Provider in WebLN context

* Check LNbits connection on save

* refactor: put LNbitsProvider into own file

* Pay invoices using WebLN provider from context

* Remove deprecated FIXME

* Try WebLN provider first

* Fix unhandled promise rejection

* Fix this in sendPayment

* Be optimistic regarding WebLN zaps

This wraps the WebLN payment promise with Apollo cache updates.

We will be optimistics and assume that the payment will succeed and update the cache accordingly.

When we notice that the payment failed, we undo this update.

* Bold strike on WebLN zap

If lightning strike animation is disabled, toaster will be used.

* Rename undo variable to amount

* Fix zap undo

* Add NWC card

* Attempt to check NWC connection using info event

* Fix NaN on zap

Third argument of update is reserved for context

* Fix TypeError in catch of QR code

* Add basic NWC payments

* Wrap LNbits getInfo with try/catch

* EOSE is enough to check NWC connection

* refactor: Wrap WebLN providers into own context

I should have done this earlier

* Show red indicator on error

* Fix useEffect return value

* Fix wrong usage of pubkey

The event pubkey is derived from the secret. Doesn't make sense to manually set it. It's also the wrong pubkey: we're not the wallet service.

* Use p tag in NWC request

* Add comment about required filter field

* Aesthetic changes to NWC sendPayment

* Add TODO about receipt verification

* Fix WebLN attempted again after error

* Fix undefined name

* Add code to mock NWC relay

* Revert "Bold strike on WebLN zap"

This reverts commit a9eb27daec0cd2ef30b56294b05e0056fb5b4184.

* Fix update undo

* Fix lightning strike before payment

* WIP: Wrap WebLN payments with toasts

* add toasts for pending, error, success
* while pending, invoice can be canceled
* there are still some race conditions between payiny the invoice / error on payment and invoice cancellation

* Fix invoice poll using stale value from cache

* Remove unnecessary if

* Make sure that pay_invoice is declared as supported

* Check if WebLN provider is enabled before calling sendPayment

* Fix bad retry

If WebLN payments failed due to insufficient balances, the promise resolved and thus the action was retried but failed immediately since the invoice (still) wasn't paid.

* Fix cache undo update

* Fix no cache update after QR payment

* refactor: Use fragments to undo cache updates

* Remove console.log

* Small changes to NWC relay mocking

* Return SendPaymentResponse

See https://www.webln.guide/building-lightning-apps/webln-reference/webln.sendpayment

* Also undo cache update on retry failure

* Disable NWC mocking

* Fix initialValue not set

But following warning is now shown in console:

"""
Warning: A component is changing a controlled input to be uncontrolled.
This is likely caused by the value changing from a defined to undefined, which should not happen.
Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components
"""

* Remove comment since only relevant for blastr (mutiny relay)

* Remove TODO

* Fix duplicate cache update

* Fix QR modal not closed after payment

* Ignore lnbits variable unused

* Use single relay connection for all NWC events

* Fix missing timer and subscription cleanup

* Remove TODO

Confirmed that nostr-tools verifies events and filters for us.

See https://github.com/nbd-wtf/nostr-tools/blob/master/abstract-relay.ts#L161

* Fix switch from controlled to uncontrolled input

* Show 'configure' on error

* Use budgetable instead of async

* Remove EOSE listener

Only nostr.mutinywallet.com didn't respond with info events due to implementation-specific reasons. This is no longer the case.

* Use invoice expiry for NWC timeout

I don't think there was a specific reason why I used 60 seconds initially.

* Validate LNbits config on save

* Validate NWC config on save

* Also show unattach if configuration is invalid

If unattach is only shown if configuration is valid, resetting the configuration is not possible while it's invalid. So we're stuck with a red wallet indicator.

* Fix detection of WebLN payment

It depended on a Apollo cache update function being available. But that is not the case for every WebLN payment.

* Fix formik bag lost

* Use payment instead of zap in toast

* autoscale capture svc by response time

* docs and changes for testing lnbits locally

* Rename configJSON to config

Naming of config object was inconsistent with saveConfig function which was annoying.

Also fixed other inconsistencies between LNbits and NWC provider.

* Allow setting of default payment provider

* Update TODO comment about provider priority

The list 'paymentMethods' is not used yet but is already implemented for future iterations.

* Add wallet security disclaimer

* Update labels

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-02-08 12:33:13 -06:00
ekzyis 46eeb729c3 Fix pinned items don't show up in home 2024-02-04 22:15:18 +01:00
mzivil f2f39f4c22 fix clicks on billing types label not toggling correct radio
Currently, all the billing types radios are being assigned the
same "billingType" id, so clicking on any of the labels
always selects the monthly one. If you inspect the HTML, all the
billing type labels have 'for="billingType"' which is how the HTML
knows which input to select.

We have to keep the "name" attribute the same because that's how
the input values are linked to the billingType form field.

To fix, we explicitly assign the "id" prop for each radio so
that the <label>'s "for" attribute is tied to the correct
radio input.
2024-02-03 16:59:37 -05:00
mzivil 3328c1daa3 fix clicks on post types label not toggling correct checkbox
Currently, all the post types checkbox are being assigned the
same "postTypes" id, so clicking on any of the post type labels
always toggles the first one. If you inspect the HTML, all the
post type labels have 'for="postTypes"' which is how the HTML
knows which checkbox to toggle.

We have to keep the "name" attribute the same because that's how
the checkbox values are linked to the postTypes field.

To fix, we explicitly assign the id prop for each checkbox so
that the <label>'s "for" attribute is tied to the correct
checkbox input.
2024-02-03 16:59:37 -05:00
keyan c23f1f82bc allow pins to be zapped but not from pin position 2024-02-03 15:27:36 -06:00
Keyan b2ba333905
Merge pull request #777 from stackernews/toast-tags
Add tags and onCancel to toasts
2024-02-01 11:10:10 -06:00
ekzyis 730158fd5c Finalize hodl invoices after payment within 60 seconds 2024-02-01 17:28:06 +01:00
ekzyis 1fa129272a Use toast body as default tag 2024-02-01 16:17:54 +01:00
ekzyis 878d661154 Add tag and cancel support to toasts 2024-02-01 16:17:54 +01:00
keyan 61c64646b5 use capture microservice 2024-01-30 18:22:40 -06:00
ekzyis d1ed72bb85
Allow territory founders to pin items (#767)
* Add pinning of items

* Fix empty section in context menu

* Pin comments

* Fix layout shift during comment pinning

* Add comments, rename, formatting

* Max 3 pins allowed

* Fix argument

* Fix missing position update for other items

* Improve error message

* only show saloon in home

* refine pinItem style and transaction usage

* pin styling enhancements

* simpler handling of excess pins

* fix pin positioning like mergePins

* give existing pins null subName

* prevent empty items on load

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-01-30 11:04:56 -06:00
keyan 35c76c077e improved footnote styling and list styling 2024-01-28 13:26:32 -06:00
keyan 2338be774d better quoteblock styling 2024-01-28 13:26:32 -06:00
keyan 5086c2036d add ids to all toasts to help id rogue toasts 2024-01-28 13:26:32 -06:00
ekzyis e4aff5d11b
Format internal links as #<id> (#765)
* Format internal links

* Fix URL text ignored
2024-01-24 17:29:52 -06:00
keyan dc8d35fdcf only open related posts when there aren't comments 2024-01-20 15:17:34 -06:00
keyan 70aa7dd1ad fix single date in datepicker 2024-01-19 20:38:35 -06:00
keyan 968263ba6a have datepicker store unix timestamps 2024-01-19 15:30:36 -06:00
keyan eb99fcef9e improve stat gathering 2024-01-19 15:19:26 -06:00
keyan 0134968fc1 don't trigger date picker onchange until 2 dates are picked 2024-01-19 15:14:52 -06:00
keyan d14123cc42 improved comment linking 2024-01-17 19:03:49 -06:00
ekzyis 2ceada66d6
Remove plausible link (#762) 2024-01-17 18:11:00 -06:00
keyan 61a66127d1 search/related posts refinements 2024-01-17 17:39:48 -06:00
ekzyis 9ef0c81245
refactor: replace recursion with promise sequence in `useInvoiceable` (#752)
* refactor: replace recursion with promise sequence

This commit refactors `useInvoicable`. The hard-to-follow recursion was replaced by awaiting promises which resolve or reject when one step of our JIT invoice flow is done.

Therefore, `onSubmit` is now fully agnostic of JIT invoices. The handler only returns when payment + action was successful or canceled - just like when a custodial zap was successful.

* refactor more and fix bugs

* move invoice cancel logic into hook where invoice is also created
* fix missing invoice cancellation if user closes modal or goes back.
* refactor promise logic: it makes more sense to wrap the payment promise with the modal promise than the other way around.

* Fix unhandled rejection

* Fix unnecessary prop drilling

* Fix modal not closed after successful action

* Fix unnecessary async promise executor

* Use function to set state
2024-01-16 18:40:11 -06:00
keyan 9af3388353 semantic search 2024-01-15 17:22:57 -06:00
keyan 1dae33312f allow territories to be renamed 2024-01-11 17:48:08 -06:00
keyan 86e8350994 autowithdraw to lightning address 2024-01-11 13:10:07 -06:00
keyan 572103b2e3 improve wallet limit phrasing 2024-01-11 13:08:37 -06:00
ekzyis bdf9b1f0fd
Territory post notifications (#745)
* Notify founders of new posts

* Only merge notifications of same territory

* Show territory posts in /notifications

* Don't notify on own posts
2024-01-11 11:27:54 -06:00
keyan 9a9e81b109 refine territory details on post form 2024-01-08 19:02:00 -06:00
ekzyis f8cbd43be7
Show territory details in post form (#725)
* Show territory details in post form

* Style territory details in post form

* Keep details closed by default

* Use SUB_FULL

* Undo unused changes to specify accordian default

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-01-08 17:46:23 -06:00
keyan 5137f1423d change reply placeholder 2024-01-04 18:48:10 -06:00
keyan 26e0dd6f7e Revert "fix #703"
This reverts commit 8996fd085a.
2024-01-03 20:39:26 -06:00
keyan 6a600c2043 fix null sub in select 2024-01-03 19:45:30 -06:00
ekzyis 31a40e15be
refactor delete notification (#731)
Co-authored-by: ekzyis <ek@stacker.news>
2024-01-03 16:24:46 -06:00
keyan 8996fd085a fix #703 2024-01-03 16:12:33 -06:00
keyan 717f8d1ef6 territory billing notifications 2024-01-03 15:20:10 -06:00
ekzyis 562b243111
Fix usage of hardcoded strings for sw message types (#730)
Co-authored-by: ekzyis <ek@stacker.news>
2024-01-03 14:02:01 -06:00
ekzyis 31cef5a7b7
Only close notifications manually on iOS (#729)
* Only close notifications manually on iOS

* Use function instead of hardcoded string

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-01-03 11:56:29 -06:00
ekzyis ade35b9ea0
Add verbose logging in onPush listener (#724)
* refactor: Use log function in service worker

* Add verbose logging on push listener

* Fix TypeError: Cannot read properties of null (reading 'postMessage')

navigator.serviceWorker.controller is null on forced refreshes:

"""
This property returns null if the request is a force refresh (Shift + refresh) or if there is no active worker.
"""

-- https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller

This means when we unregister a service worker manually (like I do for debugging purposes) and then reload the page, there is no service worker available when this code is run.

Adding a check with a more helpful error message should improve UX.

This error might also happen in other cases where a page refresh should also help.

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-01-03 11:51:04 -06:00
keyan c597acfb8f add mempool link 2024-01-02 16:35:01 -06:00
keyan 240ac3497d refine territory mutes 2023-12-31 10:52:19 -06:00
keyan 76b63240db fix territory mutes for logged out 2023-12-30 19:45:41 -06:00
keyan 0999004646 mute territories in overflow 2023-12-30 19:41:16 -06:00
keyan 9ab1d770eb remove debug log statement 2023-12-30 18:43:41 -06:00
keyan f267137662 add muted section to territory select 2023-12-30 18:19:42 -06:00
keyan 214e863458 mute territories 2023-12-30 17:16:09 -06:00
ekzyis 3a0c50566b
Fix TypeError (reading 'moderated') (#722)
Co-authored-by: ekzyis <ek@stacker.news>
2023-12-30 14:40:06 -06:00
ekzyis c23799be81
Remove ineffective guard against all caps (#723)
Co-authored-by: ekzyis <ek@stacker.news>
2023-12-30 14:38:41 -06:00
keyan dc15be914c opt-in moderation for territory founders 2023-12-29 18:05:16 -06:00
keyan 45e7503784 improve outlawed comment ux 2023-12-27 18:14:22 -06:00
keyan 6170853d72 unify idempotent act and act 2023-12-27 10:15:18 -06:00
keyan 73ad93f2bb idempotent zaps 2023-12-26 20:27:52 -06:00
keyan 374a7985da unify zap/downzap/bounty mutation 2023-12-26 16:51:47 -06:00
keyan 67a9fe23cf stablize act mutation reference 2023-12-26 15:55:48 -06:00
keyan 8c5c29ee45 remove snow 2023-12-25 18:05:45 -06:00
ekzyis 05bdd988fa
Christmas zaps (#707)
* Christmas zaps

* Also add 50px margin on left side

* Remove wrong comment

* Use grey snow in light mode

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-12-24 16:49:41 -06:00
keyan ac1c64e402 reduce redundant messaging in wallet limit banner 2023-12-21 17:52:35 -06:00
keyan f3ac63050e floor the chain fee float 2023-12-21 17:45:03 -06:00
keyan 4c36b7813a refine wallet limit banner slightly 2023-12-21 17:40:11 -06:00
ekzyis 01984c0b43
Add wallet limit banner (#699)
* Colorize balance if over soft limit

* Remove default banner export

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-12-21 17:31:16 -06:00
keyan fdf8f8e395 fix footnote links 2023-12-20 18:54:56 -06:00
keyan 633c96d619 handle hash urls with 'view more' 2023-12-20 18:16:34 -06:00
st4rgut24 e9a5d22a6e
Add chain fees to price carousel (#658)
* add chain fees to price carousel

* restore check for valid carousel values

* add nym to contributors

---------

Co-authored-by: stargut <stargut@starguts-MacBook-Pro.local>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-12-20 16:06:22 -06:00
ekzyis 056be01f15
Request persistent storage (#701)
* Request persistent storage

* Only prompt for persistent storage if push notifications enabled

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-12-20 14:38:43 -06:00
keyan 65744364f1 undo zap/downzap and improve downzap ux 2023-12-19 19:55:19 -06:00
keyan 7e0da18878 down zap ui polish 2023-12-19 18:25:41 -06:00
keyan 9455847484 add timeouts for nostr extension calls 2023-12-19 16:01:48 -06:00
Austin Kelsay 5737027c0f
Nostr crossposting improvements (#629)
* Add nostr event id field to items

* crosspost-item

* crosspost old items, update with nEventId

* Updating noteId encoding, cleaning up a little

* Fixing item-info condition, cleaning up

* Linting

* Spacing nit

* Add createdAt variable back

* Change instances of eventId to noteId

* Adding upsertNoteId mutation

* Cleaning up updateItem, using toasts to communivate success/failure in crosspost-item

* Linting

* Fix type

* Move crosspost to share button, make sure only OP can crosspost

* Lint

* Simplify conditions

* user might have no nostr extension installed

Co-authored-by: ekzyis <27162016+ekzyis@users.noreply.github.com>

* change upsertNoteId to updateNoteID for resolver and mutations, change isOp to mine, remove unused noteId params

* Use nostr.com for linking out with noteId

* lint

* add noopener to window.open call

* Simplify condition, throw GraphQLError

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: ekzyis <27162016+ekzyis@users.noreply.github.com>
2023-12-19 11:48:48 -06:00
ekzyis 6682817578
Do not remove orientation EXIF data (#683)
* Keep orientation metadata

* npm install piexifjs

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-12-19 09:45:21 -06:00
keyan fc3f46a343 fix #687 2023-12-17 13:23:52 -06:00
keyan 3a7d899ce7 fix missing view more? #687 2023-12-15 18:18:30 -06:00
keyan a5e50821b7 gofac yourself 2023-12-14 11:30:51 -06:00
keyan ca02d627c1 make anon fees consistent 2023-12-10 16:56:22 -06:00
keyan c8bca3ef63 allow territory founders to disable freebies 2023-12-10 15:41:20 -06:00
keyan e08fca15b6 set billing state from existing on edit 2023-12-08 19:11:25 -06:00
keyan 1d66be68cc make territory billing renewal opt-in 2023-12-08 14:02:00 -06:00
ekzyis 5e51fe5330
Fix bio replies (#669)
Co-authored-by: ekzyis <ek@stacker.news>
2023-12-07 15:50:36 -06:00
keyan c33d4b9b01 fix horizontal layout shift from select 2023-12-06 13:40:14 -06:00
keyan 5496fe82e9 fix select width on mobile 2023-12-06 13:19:39 -06:00
keyan 10203f565c territories 2023-12-04 21:34:06 -06:00
keyan 82a1b450f5 view more viewheight 2023-12-04 20:08:52 -06:00
keyan e8e22ad7d4 fix click to reveal text initial render 2023-12-04 18:02:48 -06:00
keyan 86cdb69082 add copyright policy 2023-12-04 16:56:13 -06:00
keyan 4127adb169 click to reveal text when very long 2023-12-04 16:30:39 -06:00
keyan 6c576bda84 legal footer 2023-12-04 13:42:39 -06:00
keyan f465c6d881 remove negative lookbehind for #656 and fix mention regex 2023-12-03 12:58:28 -06:00
ekzyis 32403d0c29
Unsubscribe on signout (#653)
Co-authored-by: ekzyis <ek@stacker.news>
2023-11-25 14:29:42 -06:00
keyan a1114e5270 fix mention positioning 2023-11-22 09:12:43 -06:00
keyan 8e01568622 remove dead gql 2023-11-21 17:26:24 -06:00
keyan 70e4b27c03 fix youtube/twitter embed styling when there's text 2023-11-21 16:20:54 -06:00
keyan 6bc1b08606 fix twitter embed styling 2023-11-21 15:39:53 -06:00
keyan 20e46e747d small refinements to image min-width 2023-11-21 14:58:15 -06:00
keyan 47a5b311c3 refine mentions 2023-11-21 14:49:39 -06:00
keyan a74c5201bc reply cancel confirm 2023-11-21 12:49:22 -06:00
keyan 21c1fd11ba refine quote reply hook and #643 2023-11-21 12:35:37 -06:00
keyan d211fe93ea fix quote reply by removing imperative logic 2023-11-20 21:38:18 -06:00
keyan 2bcf3acda6 fix small images #619 2023-11-20 19:54:22 -06:00
keyan 58a9d03e28 only query for deleteScheduledAt when needed 2023-11-20 15:38:49 -06:00
keyan a12e969bd1 fix #631 2023-11-20 13:54:09 -06:00
keyan 1266ae2983 fee button improvements 2023-11-20 13:20:28 -06:00
keyan af59e3ef54 merge non-normalized user subtypes fixing #645 2023-11-20 09:05:02 -06:00
SatsAllDay 44e12a4b44
Move the `AD` badge to be alongside other item info badges (#647) 2023-11-20 08:33:59 -06:00
SatsAllDay 4596681fbc
Toast on delete bot directive usage (#620)
* Toast on successful delete bot directive

* refactor duplicate code into a reusable function

* restore empty spacing lines to clean up the diff

* perf optimization, only query for deleteScheduledAt for your own items

* Issue a warning toast if the delete bot was mentioned but the item was not scheduled for deletion

* use bs-secondary color for warning

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-11-19 15:09:47 -06:00
st4rgut24 d84c46df81
Dont display price component until after initial render (#637)
* Dont display price component until after initial render

* change variable name and remove log

* fix linting issues

---------

Co-authored-by: stargut <stargut@starguts-MBP.fios-router.home>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-11-19 15:01:12 -06:00
SatsAllDay 64a16373c5
Fix client-side error boundary (#623)
* * add error boundary immediately above page component

* send error logs to server via LoggerContext

* display error stack and component stack in copyable text area

* wrap every context provider in an error boundary

* memoize context values to fix error boundary propagation issue

* Wrap page component in an error boundary so we can use our context utilities
for a better experience, like toast and logger

Still have a top-level error boundary that catches things from the context providers,
just in case.

Don't display the whole error stack, just because it's ugly, but make it copyable
2023-11-19 14:24:56 -06:00
ekzyis 158baa61e3
Strip EXIF data before upload on client (#634)
Co-authored-by: ekzyis <ek@stacker.news>
2023-11-19 14:22:46 -06:00
keyan a318727f9c fix freebie dialog (#460) 2023-11-19 14:16:35 -06:00
keyan 589b15b597 fix custom dates to use ms since epoch 2023-11-14 10:23:44 -06:00
keyan ffe9983b80 fix successive zap timing issues? 2023-11-13 20:02:34 -06:00
keyan 7b58edb77b reintroduce searching by most recent 2023-11-13 18:17:45 -06:00
ekzyis 503f4c380b
Disable reply button while uploading (#627)
Co-authored-by: ekzyis <ek@stacker.news>
2023-11-13 09:30:01 -06:00
keyan d599ec76ce fix mention clientside cache problems 2023-11-12 14:51:12 -06:00
keyan 03acce2305 fix nostr auth (#621) 2023-11-12 11:59:18 -06:00
keyan 081e22f63e fix post headings 2023-11-12 09:04:28 -06:00
keyan a78661c6e7 omit op from self-reply fee escalation 2023-11-11 16:47:54 -06:00
keyan c23e49872a make fee button less of a hack 2023-11-10 18:18:10 -06:00
keyan 3499f92436 dramatically improve search 2023-11-10 09:22:30 -06:00
keyan 7cb3a7ad64 small receipt styling 2023-11-10 09:22:14 -06:00
keyan 494b8b3dcd better organize user graphql types 2023-11-09 19:05:35 -06:00
rleed d86d8b3bac
Provide option to clear withdrawal invoices (#591)
* add settings option

* add auto-drop worker

* add manual delete option

* add warning and note

* cleanup

* incorporate most review feedback

* add warning to settings option

* remove debugging tweaks and simplify

* refine auto delete bolt11s

* refine UI

---------

Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-11-09 11:50:43 -06:00
ekzyis 41a1c686dc
Fix stale images (#618)
Co-authored-by: ekzyis <ek@stacker.news>
2023-11-08 18:17:51 -06:00
SatsAllDay 522c821c89
Notification badges (#595)
* First pass of implementing Badging API for notifications

* Only show app badge when driven from push notifications

* Display number of unread push notifications instead of just an empty badge

Clear badge via postMessage when notifications page is loaded

* de-dupe some code, update badge counter on each notification click

* remove ids, track open note count instead

* restore optional chaining

* ensure note count doesn't go below 0, and fix event.waitUntil error when clearing badge

* incorporate PR feedback
2023-11-08 18:17:01 -06:00
rleed 3a56782572
Custom date selector for more pages (#567)
* add custom range option to top items page

* add custom range option to profile page

* add date filter option to chart pages

* cleanup

* fix x-axis date labels

* date picker improvements

* enhancements to custom date selection

* remove unneeded condition

---------

Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-11-08 18:15:36 -06:00
ekzyis 8f590425dc
Image uploads (#576)
* Add icon to add images

* Open file explorer to select image

* Upload images to S3 on selection

* Show uploaded images below text input

* Link and remove image

* Fetch unsubmitted images from database

* Mark S3 images as submitted in imgproxy job

* Add margin-top

* Mark images as submitted on client after successful mutation

* Also delete objects in S3

* Allow items to have multiple uploads linked

* Overwrite old avatar

* Add fees for presigned URLs

* Use Github style upload

* removed upfront fees
* removed images provider since we no longer need to keep track of unsubmitted images on the client
* removed User.images resolver
* removed deleteImage mutation
* use Github style upload where it shows ![Uploading <filename>...]() first and then replaces that with ![<filename>](<url>) after successful upload

* Add Upload.paid boolean column

One item can have multiple images linked to it, but an image can also be used in multiple items (many-to-many relation).

Since we don't really care to which item an image is linked and vice versa, we just use a boolean column to mark if an image was already paid for.

This makes fee calculation easier since no JOINs are required.

* Add image fees during item creation/update

* we calculate image fees during item creation and update now
* function imageFees returns queries which deduct fees from user and mark images as paid + fees
* queries need to be run inside same transaction as item creation/update

* Allow anons to get presigned URLs

* Add comments regarding avatar upload

* Use megabytes in error message

* Remove unnecessary avatar check during image fees calculation

* Show image fees in frontend

* Also update image fees on blur

This makes sure that the images fees reflect the current state. For example, if an image was removed.

We could also add debounced requests.

* Show amount of unpaid images in receipt

* Fix fees in sats deducted from msats

* Fix algebraic order of fees

Spam fees must come immediately after the base fee since it multiplies the base fee.

* Fix image fees in edit receipt

* Fix stale fees shown

If we pay for an image and then want to edit the comment, the cache might return stale date; suggesting we didn't pay for the existing image yet.

* Add 0 base fee in edit receipt

* Remove 's' from 'image fees' in receipts

* Remove unnecessary async

* Remove 'Uploading <name>...' from text input on error

* Support upload of multiple files at once

* Add schedule to delete unused images

* Fix image fee display in receipts

* Use Drag and Drop API for image upload

* Remove dragOver style on drop

* Increase max upload size to 10MB to allow HQ camera pictures

* Fix free upload quota

* Fix stale image fees served

* Fix bad image fee return statements

* Fix multiplication with feesPerImage

* Fix NULL returned for size24h, sizeNow

* Remove unnecessary text field in query

* refactor: Unify <ImageUpload> and <Upload> component

* Add avatar cache busting using random query param

* Calculate image fee info in postgres function

* we now calculate image fee info in a postgres function which is much cleaner
* we use this function inside `create_item` and `update_item`: image fees are now deducted in the same transaction as creating/updating the item!
* reversed changes in `serializeInvoiceable`

* Fix line break in receipt

* Update upload limits

* Add comment about `e.target.value = null`

* Use debounce instead of onBlur to update image fees info

* Fix invoice amount

* Refactor avatar upload control flow

* Update image fees in onChange

* Fix rescheduling of other jobs

* also update schedule from every minute to every hour

* Add image fees in calling context

* keep item ids on uploads

* Fix incompatible onSubmit signature

* Revert "keep item ids on uploads"

This reverts commit 4688962abc.

* many2many item uploads

* pretty subdomain for images

* handle upload conditions for profile images and job logos

---------

Co-authored-by: ekzyis <ek@ekzyis.com>
Co-authored-by: ekzyis <ek@stacker.news>
2023-11-06 14:53:33 -06:00
ekzyis 5dfeb700bc
Resubscribe if service worker lost push subscription (#597)
* Also delete push subscription in IndexedDB

* Fix pushsubscriptionchange function signature

* Send SYNC_SUBSCRIPTION after successful registration

* Resubscribe if service worker lost subscription

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-11-05 15:08:44 -06:00
keyan 8bc3f5b384 Revert "halloween animation"
This reverts commit e939026295.
2023-11-01 11:57:55 -05:00
keyan 8881b19e45 Revert "protect zaps from webgl occasionally being unavailable"
This reverts commit b5828cdf94.
2023-11-01 11:57:17 -05:00
keyan b5828cdf94 protect zaps from webgl occasionally being unavailable 2023-10-31 09:48:39 -05:00
keyan e939026295 halloween animation 2023-10-29 16:50:03 -05:00
keyan 30d8c92fe2 fix accidental reply hit on mobile 2023-10-26 15:49:28 -05:00
keyan 835554b3cd small adjustments to secondary form text 2023-10-26 15:12:21 -05:00
keyan 7589295e8c fix url UX exposing state 2023-10-26 14:36:20 -05:00
keyan 43a54d407e keep as much context as possible when navigating deeper in comment threads 2023-10-26 14:24:49 -05:00
keyan 39625f7e08 improve markdown tab spacing 2023-10-26 13:28:12 -05:00
keyan 43d3ba1807 better search layout spacing 2023-10-26 13:01:01 -05:00
keyan e8aaf1956e fix spacing on mixed items 2023-10-26 12:52:06 -05:00
keyan 4d98110282 restore ctrl+click on item title clicking 2023-10-26 12:30:13 -05:00
keyan 02b98582b8 add spacing to comment reply button 2023-10-26 12:17:43 -05:00
keyan 41cb6ac3d8 continue notification polling even if found 2023-10-26 11:53:27 -05:00
ekzyis cbcf80e1ba
Fix QR code overflow on mobile (#589)
Co-authored-by: ekzyis <ek@stacker.news>
2023-10-26 10:36:46 -05:00
keyan 0c9131f698 only show invoice data on full page 2023-10-23 19:58:33 -05:00