Commit Graph

303 Commits

Author SHA1 Message Date
itsrealfake a34c8dc7e9
add TypePolicy to Fact (#1138)
closes #995

enables apollo cache to work for 'stacked' 'spent' in /statistics page.
2024-05-03 14:35:16 -05:00
ekzyis 98a27caaa9
Allow http: and ws: in dev CSP (#1126)
* Allow HTTP in dev build

* Also allow ws://
2024-05-03 14:17:10 -05:00
ekzyis 4961cc045b
Allow deletion of wallet logs (#1101)
* Allow deletion of wallet logs

* Refactor wallet logs client<>server glue code

* Use variant='link' and className='text-muted fw-bold nav-link' for clear & cancel

There is a bug though: 'clear' stays highlighted after modal is closed

* Include wallet in toast

* Delete logs on logout

* Fix ugly wallet name in confirm dialog

* Fix clear still highlighted after modal closed

* Only delete client wallet logs

* Fix ugly wallet name in toast

* Fix bad search and replace

* Use Wallet object as constant

* Also delete LNC logs on logout

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-05-03 14:14:33 -05:00
Keyan fd2008e5d1
reintroduce daily rewards (#1134)
* reintroduce daily rewards

* update reward sponsor

* daily rewards countdown

* update rewards job schedule
2024-05-01 09:30:36 -05:00
Keyan c3d709b025
add lnc attached wallet (#1104)
* add litd to docker env

* lnc payments

* handle locked wallet configuration

* create new lnc connection for every action

* ensure creds are decrypted before reconnecting

* perform permissions check
2024-04-26 21:22:30 -05:00
keyan 2180afaed0 lower wallet limit to 100k 2024-04-25 19:37:22 -05:00
SatsAllDay fbd3f8efed
introduce `persistOnNavigate` option for toasts (#1095)
ensure that post auto-delete success toasts are preserved
when navigating back to the prior page
2024-04-21 17:25:48 -05:00
ekzyis 59b3d1c375
Round sats in FORWARDEDTIP push notification (#1086) 2024-04-17 14:24:07 -05:00
keyan 00ca35465c replace node-fetch usage with existing cross-fetch 2024-04-15 19:26:40 -05:00
ekzyis 2ec0a1a559
Use crypto.randomBytes for unique CLN invoice label (#1074) 2024-04-15 09:16:32 -05:00
ekzyis 9f4d5e13aa
CLN autowithdrawal (#1042)
* Add CLN node to docker-compose.yml

* Attach CLN wallet via CLNRest

* Remove leading space

* Implement autowithdrawal to CLN in worker

* Fix UnhandledSchemeError during build

See https://github.com/vercel/next.js/discussions/33982

* Refactor CLN invoice code into @/lib/cln

* Fix missing env vars

* Fix validation error if rune invalid

* Update header

* Add rune placeholder

* Fix missing expiry for test invoice

* Remove nonsensical comment

* Remove unnecessary async

* Show level SUCCESS as OK in logs

* Add stacker_cln commands to sndev

* fix sndev posix compliance, add cln_withdraw

* give stacker_cln larger channels

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-04-14 17:34:21 -05:00
ekzyis 7774910292
Fix cert required (#1057) 2024-04-11 18:59:51 -05:00
Ben Allen 255ad29897
fix: parseInternalLinks test (#1050) 2024-04-09 14:44:45 -05:00
keyan 81d3212ffb add NEXT_PUBLIC_URL 2024-04-08 17:54:39 -05:00
Ben Allen 5be6df0266
Internal links are not target=_blank by default (#1037)
* feat: internal links are not target=_blank by default

* feat: use <Link>

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-04-08 16:56:44 -05:00
SatsAllDay e6b825dafe
Mute Management Settings Page (#1034)
* first pass of a mute mgmt page, ported from subscription mgmt page pr

* adjust error message for mutes

* muted users -> muted stackers

* fix typo in component name
2024-04-08 09:13:56 -05:00
SatsAllDay 91a0d1ccd7
env vars for polling intervals (#1038)
* env vars for polling intervals

add env vars for 4 different common polling intervals,
fast (1000), normal (30000), long (60000), extra long (300000)

use env vars in all `pollInterval` params to `useQuery`

* replace `setInterval`'s interval with `FAST_POLL_INTERVAL`
2024-04-08 09:13:12 -05:00
keyan 1d154ec9b5 attempt to fix lastChecked getting overwritten 2024-04-06 18:28:23 -05:00
keyan 3472670df5 add clientside fetch delay 2024-04-06 10:38:54 -05:00
SatsAllDay 992fc54160
Subscription management page (#1000)
* first pass of a subscription management page under settings

* add tabs to settings ui

* NymActionDropdown

* update Apollo InMemoryCache to merge paginated list of my subscribed users

* various updates

* switch from UsersNullable to Users

* bake the nym action dropdwon into the user component

* add back fields to the user query

* `meSubscriptionPosts`, `meSubscriptionComments`, `meMute`

* Refetch my subscribed users when a user subscription is changed

* update user list to hide stats in the subscribed list users

* update my sub'd users fragment to remove unnecessary user fields

* memoize subscribe user context provider value to avoid re-renders

* use inner join instead of left join

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* throw error when unauthenticated

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-04-03 19:38:47 -05:00
keyan 2c9e668177 april million sat madness 2024-04-01 08:56:13 -05:00
ekzyis a1317b97e9 Add missing unitSingular, unitPlural 2024-03-26 00:53:49 +01:00
ekzyis d1f36b77d2 Add withdrawal push notifications 2024-03-26 00:50:48 +01:00
ekzyis 3388f818cf Add withdrawal notifications 2024-03-26 00:50:48 +01:00
ekzyis 3da299bddc Fix zapUndos not nullable in schema 2024-03-25 20:34:28 +01:00
ekzyis c2aef34ba2 Add threshold for zap undos 2024-03-25 20:34:28 +01:00
SatsAllDay 9bc95d4bb1
gracefully handle errors when fetching lnurlp wellknown info (#960)
if `fetch` or `req.json` fails, catch those errors and return a default error to the user

if the res payload indicates error but doesn't return a `reason`, also return the same
default error message to the user
2024-03-24 13:25:14 -05:00
keyan 4b4a5361ef fix #951 also retroactively 2024-03-20 20:56:40 -05:00
ekzyis 01d779723f
Check userId set in sendUserNotification (#949) 2024-03-20 19:59:48 -05:00
ekzyis a1a82b9680
Delete unused lib/push-notifications.js (#947) 2024-03-20 19:58:42 -05:00
ekzyis d237861ff5
Use module path aliases (#938)
* Use module path aliases

* fix broken refactor

* path mapping for svgs, style, and remaining places (bonus: lose babel dep)

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-03-19 19:37:31 -05:00
ekzyis 22ff832efb
Don't export sendUserNotification (#937)
* Rename file to webPush.js

* Move webPush code into lib/webPush

* Don't export sendUserNotification

* Fix null in deposit push notification

* restore deposit notification change

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-03-19 17:43:04 -05:00
ekzyis 687d71f246
Purchase archived territories (#897)
* Handle archived territories in territory form

* Use dedicated mutation

* Add sanity check for eternal territories

* Fix fields and cost ignored

* Remove no longer needed manual validation in upsertSub

* Remove founder check

* Always check if sub is archived

Using { abortEarly: false } now since previously, if no description was not given, we wouldn't detect if the sub was archived since validation would abort on empty descriptions.

Only on submission all fields would get validated but since we ignore archived errors during submission, the user would never see that the sub is archived before submission
+ the wrong mutation would run if archived is not already true before submission.

Hence, we need to validate all fields always.

There is currently still a bug where the validation does not immediately run but maybe this can be fixed by simply using validateImmediately on the Formik component.

* Fix archived warning not shown after first render

* Only create transfers if owner actually changes

* Reuse helper functions in lib/territory.js

* Rename var to editing

* Use onChange instead of validation override

* Run same validation on server for unarchiving

* Fix 'territory archived' shown during edits

* Use && instead of ternary operator for conditional query

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-03-19 17:23:59 -05:00
ekzyis b03295ce59
Put all Web Push code into lib/webPush.js (#936)
* Rename file to webPush.js

* Move webPush code into lib/webPush
2024-03-19 15:48:13 -05:00
keyan 39991575d6 increase boost minimum to 50k 2024-03-18 16:15:37 -05:00
ekzyis 2ba4063645 Add setting for no referral links on copy 2024-03-17 16:23:03 +01:00
ekzyis 501885cfa0
Ignore if sub belongs to user during existence check (#904)
* Ignore if sub belongs to user during existence check

* Remove code no longer needed

* Fix territory edit

Territory edits were broken because validation failed for existing territories and if you edit an territory, it obviously already exists.

This commit fixes this by ignoring the territory that we're currently editing.

* Fix existence check using stale cache

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-03-14 11:17:53 -05:00
Keyan 23ee62fb21
add sndev shell script and enhance docker compose local dev
* add hot reloading worker:dev script

* refine docker config

* sndev bash script and docker reliability stuff

* make posix shell

* restart: always -> unless-stopped

* proper check for postgres health

* add db seed to sndev

* refinements after fresh builds

* begin adding regtest network

* add changes to .env.sample

* reorganize docker and add static certs/macroon to lnd

* copy wallet and macaroon dbs for deterministic wallets/macaroons

* fix perms of shared directories

* allow debian useradd with duplicate id

* add auto-mining

* make bitcoin health check dependent on blockheight

* open channel between ln nodes

* improve channel opens

* add sndev payinvoice

* add sndev withdraw

* ascii art

* add sndev status

* sndev passthrough to docker and containers

* add sndev psql command

* remove script logging

* small script cleanup

* smaller db seed

* pin opensearch version

Co-authored-by: ekzyis <ek@stacker.news>

* pin opensearch dashboard

Co-authored-by: ekzyis <ek@stacker.news>

* add sndev prisma

* add help for all commands

* set -e

* s3 and image proxy with broken name resolution

* finally fully working image uploads

* use a better diff algo

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-03-13 09:04:09 -05:00
Keyan 48aef15a07
use keyset pagination for notifications (#899) 2024-03-06 13:53:13 -06:00
ekzyis b379e7467f
Territory transfers (#878)
* Allow founders to transfer territories

* Log territory transfers in new AuditLog table

* Add territory transfer notifications

* Use polymorphic AuditEvent table

* Add setting for territory transfer notifications

* Add push notification

* Rename label from user to stacker

* More space between cancel and confirm button

* Remove AuditEvent table

The audit table is not necessary for territory transfers and only adds complexity and unrelated discussion to this PR.

Thinking about a future-proof schema for territory transfers and how/what to audit at the same time made my head spin.

Some thoughts I had:

1. Maybe using polymorphism for an audit log / audit events is not a good idea

Using polymorphism as is currently used in the code base (user wallets) means that every generic event must map to exactly one specialized event.

Is this a good requirement/assumption? It already didn't work well for naive auditing of territory transfers since we want events to be indexable by user (no array column) so every event needs to point to a single user but a territory transfer involves multiple users.

This made me wonder: Do we even need a table? Maybe the audit log for a user can be implemented using a view? This would also mean no data denormalization.

2. What to audit and how and why?

Most actions are already tracked in some way by necessity: zaps, items, mutes, payments, ...

In that case: what is the benefit of tracking these things individually in a separate table?

Denormalize simply for convenience or performance? Why no view (see previous point)? Use case needs to be more clearly defined before speccing out a schema.

* Fix territory transfer notification id conflict

* Use include instead of two separate queries

* Drop territory transfer setting

* Remove trigger usage

* Prevent transfers to yourself
2024-03-05 13:56:02 -06:00
keyan b16234630b better link rel attr handling 2024-03-04 19:20:14 -06:00
Keyan 0b0e36e3cb
Monthly rewards (#890)
* show placeholder for hidden stackers in top

* top rewardability views

* make territory revenue idependent job

* monthly rewards and leaderboard on rewards pages

* fix earn reschedule

* add query for rewards leaderboard

* reduce likelihood of rewards racing with views

* fix earn and refine values views
2024-03-01 10:28:55 -06:00
ekzyis fa4f09ddca
Territory notifications for everyone (#870)
* Territory notifications

* Migrate old setting to new table

* Auto subscribe founders to their territories on creation

* Fix (un)subscribe not shown to founder

* Rename to toggleSubSubscription

* Fix inconsistency between toggleSubSubscription and toggleMuteSub

* Add dedicated button in header for following territories

* Don't drop noteTerritoryPosts column

* Fix db dip in Sub.meSubscription resolver

* Move territory subscribe to new territory context menu

* Decrease space between share icon and mute button

* Fix eslint
2024-02-23 09:12:49 -06:00
Austin Kelsay 565e939245
Nostr crossposting all item types (#779)
* crosspost-item

* crosspost old items, update with nEventId

* Updating noteId encoding, cleaning up a little

* Fixing item-info condition, cleaning up

* Linting

* 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

* 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

* Basic setup for crossposting poll / link items

* post rebase fixes and Bounty and job crossposts

* Job crossposting working

* adding back accidentally removed import

* Lint / rebase

* Outsource as much crossposting logic from discussion-form into use-crossposter as possible

* Fix incorrect property for user relays, fix itemId param in updateNoteId

* Fix toast messages / error cases in use-crossposter

* Update item forms to for updated use-crossposter hook

* CrosspostDropdownItem in share updated to accomodate use-crossposter update

* Encode paramaterized replacable event id's in naddress format with nostr-tools, bounty to follw nip-99 spec

* Increase timeout on relay connection / cleaning up

* No longer crossposting job

* Add blastr, fix crosspost button in item-info for polls/discussions, finish removing job crosspostr code

* Fix toaster error, create reusable crossposterror function to surface toaster

* Cleaning up / comments / linting

* Update copy

* Simplify CrosspostdropdownItem, keep replies from being crossposted

* Moved query for missing item fields when crossposting to use-crossposter hook

* Remove unneeded param in CrosspostDropdownItem, lint

* Small fixes post rebase

* Remove unused import

* fix nostr-tools version, fix package-lock.json

* Update components/item-info.js

Co-authored-by: ekzyis <ek@stacker.news>

* Remove unused param, determine poll item type from pollCost field, add mutiny strfry relay to defaults

* Update toaster implementations, use no-cache for item query, restructure crosspostItem to use await with try catch

* crosspost info modal that lives under adv-post-form now has dynamic crossposting info

* Move determineItemType into handleEventCreation, mover item/event handing outside of do ... while loop

* Lint

* Reconcile skip method with onCancel function in toaster

* Handle failedRelays being undefined

* determine item type from router.query.type if available otherwise use item fields

* Initiliaze failerRelays as undefined but handle error explicitly

* Lint

* Fix crosspost default value for link, poll, bounty forms

---------

Co-authored-by: ekzyis <27162016+ekzyis@users.noreply.github.com>
Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-02-21 19:18:36 -06:00
mzivil 46a0af19eb
Make poll expiration configurable (#860)
* add poll expires at column to Item table

* update upsertPoll mutation for pollExpiresAt param

* use pollExpiresAt to show time left for poll

* correctly pluralize days for timeLeft

* correctly update pollExpiresAt when item is updated to remove poll expiration

* add DateTimePicker and DateTimeInput components to select datetimes

* update pollExpiresAt to be nullable and more than 1 day in the future

* hide time left text if poll has no expiration

* initialize pollExpiresAt with current value or default of 25 hours in the future

we add a one hour time buffer so that the user doesn't get a validation error
for pollExpiresAt if they post their poll within an hour from creation. there's
still a chance they'll hit the validation error but they should see the error
message toast

* add DateTimeInput into the options part of the poll form

add right padding to make room for the "clear" button.

allow field to be cleared (i.e. null pollExpiresAt) to allow
non-ending polls.

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-02-21 12:18:43 -06:00
keyan fe0d960208 handle other possible base64-like string encodings 2024-02-18 15:08:55 -06:00
ekzyis 6e6c355a3f
Add tests for internal linking (#808)
* Add tests for internal linking

* Add workflow for unit tests

* Use jest
2024-02-17 15:53:36 -06:00
Keyan 798fab097d
Make territory billing period changeable (#840)
* allow updates to territory billing

* simplify prorating

* handle updates during grace period and rehydrating archive
2024-02-16 12:25:12 -06:00
keyan b5bf0c88e3 fix sub apollo cache merge errors 2024-02-15 11:32:09 -06:00
ekzyis 1444ff476e
Validate pubkey, relay URL and secret of NWC URL (#810)
* Validate pubkey, relay URL and secret of NWC URL

* Fix NWC secret regexp

* Use sequential validation in Yup schema

* Add note about possible mismatch between hostnames and pubkeys

* Remove unused param
2024-02-14 15:09:13 -06:00
mzivil f59ee5df17
Add ranked territories to 'top' page (#828)
* add subViewGroup function to create view to read sub stats from

* add topSubs resolver to graphql query

* add TOP_SUBS query fragment

* add SUB_SORTS for top territory sorting

* add custom cache policy for topSubs

* add territories to top header select

* add top territories page

* add db views for sub stats

* configure sub_stats views to refresh by worker

* filter rows with empty subName

* update msats_spent calculation to include all ItemAct in sub

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-02-14 14:27:00 -06:00
Alex Lewin b3498fe277
Add Opt-in to Display Linked Accounts in Profile (#826)
* Add display linked accounts to settings

* Apply suggestions from code review

Co-authored-by: ekzyis <ek@stacker.news>

* small styling enhancements

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-02-14 13:33:31 -06:00
keyan 5c3c7fb185 allow more restricted macroons fix #827 2024-02-14 12:58:25 -06:00
keyan e57671ba9b dont imply required websocket fix #830 2024-02-14 11:55:08 -06:00
ekzyis 5eeaf671f8 Fix settings save requires relay set 2024-02-14 18:27:35 +01: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 8238d4d5be
Enforce HTTPS for LNbits (#809)
* Enforce HTTPS for LNbits

* Use URL constructor
2024-02-11 17:39:06 -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 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
mzivil 986ba582e5 fix lint errors 2024-02-02 16:06:33 -05:00
mzivil a039f29cdf add stripTrailingSlash utility function 2024-02-02 15:44:37 -05:00
keyan d14123cc42 improved comment linking 2024-01-17 19:03:49 -06:00
ekzyis 40f2697675 Disallow automated withdrawals to same node 2024-01-13 17:32:54 +01:00
ekzyis 5dd4136c0b Fix missing HTTPS support for automated withdrawals during development 2024-01-13 17:32:54 +01:00
ekzyis 12f9c4761d Fix isNaN checks 2024-01-13 17:32:53 +01:00
keyan b530b611f5 disable self sends in autowithdraw 2024-01-12 09:37:50 -06:00
keyan 86e8350994 autowithdraw to lightning address 2024-01-11 13:10:07 -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
ekzyis 2151323c8d
Use LND subscriptions (#726)
* Use parallel invoice subscriptions

* Fix missing idempotency

* Log error

* Use cursor for invoice subscription

* Subscribe to outgoing payments for withdrawals

* Add TODO comments regarding migration to LND subscriptions

* Also use isPoll variable in checkInvoice

* Queue status check of pending withdrawals

* Use for loop to check pending withdrawals

* Reconnect to LND gRPC API on error

* Fix hash modified of applied migrations

* Separate wallet code from worker index

* refactor subscription code some more

* remove unnecessary subWrapper abstraction
* move all wallet related code into worker/wallet.js such that only a single import is needed in worker/index.js

* Migrate from polling to LND subscriptions

* Remove unnecessary reconnect code

* Add FIXME

* Add listener for HODL invoice updates

* Remove obsolete comment

* Update README

* Add job to cancel hodl invoice if expired

* Fix missing else

* small bug fixes and readability enhancements

* refine and add periodic redundant deposit/withdrawal checks

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-01-08 16:37:58 -06:00
ekzyis 31a40e15be
refactor delete notification (#731)
Co-authored-by: ekzyis <ek@stacker.news>
2024-01-03 16:24:46 -06:00
keyan 717f8d1ef6 territory billing notifications 2024-01-03 15:20:10 -06:00
keyan c96d01e23a add sanctioned country codes 2024-01-02 16:05:07 -06:00
keyan 385b07a506 increase bounty limits 2023-12-27 10:23:54 -06:00
keyan 374a7985da unify zap/downzap/bounty mutation 2023-12-26 16:51:47 -06:00
ekzyis 9f7f09378d
Consider mutes during push notifications (#697)
Co-authored-by: ekzyis <ek@stacker.news>
2023-12-19 20:02:48 -06:00
keyan 65744364f1 undo zap/downzap and improve downzap ux 2023-12-19 19:55:19 -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
keyan 0fe1d45c8f wallet limit reduction + country list constants 2023-12-15 14:04:09 -06:00
keyan ca02d627c1 make anon fees consistent 2023-12-10 16:56:22 -06:00
keyan 7fb31ab47e fix pin jitter? 2023-12-08 18:30:00 -06:00
keyan 88dd002e23 increase territory description length 2023-12-08 14:49:13 -06:00
keyan 4013c26bb7 add minimum title length 2023-12-08 14:31:06 -06:00
keyan 1d66be68cc make territory billing renewal opt-in 2023-12-08 14:02:00 -06:00
keyan 0aac2696d0 allow websocket urls to have paths 2023-12-07 16:21:13 -06:00
keyan 10203f565c territories 2023-12-04 21:34:06 -06:00
keyan 2298f1455f allow edits to copyright policy 2023-12-04 17:05:16 -06:00
keyan 6c576bda84 legal footer 2023-12-04 13:42:39 -06:00
keyan aeb3ab40fa max length on text 2023-12-04 13:20:56 -06:00
keyan f31598d08d balance limit changes 2023-12-04 09:35:54 -06:00
keyan f465c6d881 remove negative lookbehind for #656 and fix mention regex 2023-12-03 12:58:28 -06:00
SatsAllDay a7b5534b7d
check both `navigator.permissions.query` and `Notification.permission` for permissions (#655)
it seems these values are not kept in sync on iOS Safari, which may be the source
of badges not working on iOS PWA
2023-11-25 11:32:41 -06:00
keyan 47a5b311c3 refine mentions 2023-11-21 14:49:39 -06:00
keyan af59e3ef54 merge non-normalized user subtypes fixing #645 2023-11-20 09:05:02 -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
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 d599ec76ce fix mention clientside cache problems 2023-11-12 14:51:12 -06:00
keyan c23e49872a make fee button less of a hack 2023-11-10 18:18:10 -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