Commit Graph

595 Commits

Author SHA1 Message Date
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 575a820a7a fix broken merge 2024-03-06 14:35:45 -06: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 508008f586
Fix Sub.meSubscription not resolved on page load (#888) 2024-02-28 09:31:31 -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
mzivil b0bf7add34
Show founded territories on profile (#868)
* add nterritories field to User

* add userSubs query

* show territories tab on user profiles

hide the tab if user has 0 territories, except when the
viewer navigated directly to the user's territories page

* add USER_WITH_SUBS query for user territories page

* add user territories page
2024-02-21 19:55:48 -06:00
ekzyis c57fcd6518
Allow zap undo's for short period of time (#857)
* Cancel zaps

* Hide zap error toast

* Immediately throw error about insufficient funds

* Optimistic UX

* Also hide success zap toast

* Show undo instead of cancel

* Include sat amount in toast

* Fix undo toasts removed on navigation

* Add setting for zap undos

* Add undo to custom zaps

* Use WithUndos suffix

* Fix toast flow transition

* Fix setting not respected

* Skip undo flow if funds insufficient

* Remove brackets around undo

* Fix insufficient funds detection

* Fix downzap undo

* Add progress bar to toasts

* Use 'button' instead of 'notification' in zap undo info

* Remove console.log

* Fix toast progress bar restarts

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-02-21 18:48:42 -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
keyan 3106850ce9 fix reference to old materialized view 2024-02-16 12:58:50 -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 57917d47a2 fix lnaddr autowithdraw 2024-02-15 08:59:45 -06:00
Dillon 35d212573e
auto canceling bolt11s from lnd when auto dropped from DB (#793)
* auto canceling bolt11s from lnd when auto dropped from DB

* auto canceling bolt11s from lnd when auto dropped from DB

* removed semicolon for lint

* changed cancleHodlInvoic to deletePayment function

* updated code to account for failed LND deletes

* linter fixes

* updated to only remove hashes and bolt11's from model when successfully deleted from LND

* updated to revert unsuccessful deletes from LND and add those values back into the db

* linter fix and renaming for clarity

* updated WITH query

* added if statement to account for invoices not returning from db

* fixed linter

* reverted docker-compose.yml

* made it dry

* made it dry

* added a comment because the query might be confusing

* made query moar dry

* Query formatting

* Fix query returns number of rows instead of rows

* updated  to

* fixed linter

* removed lnbits dir

* removed gitignore and docker-compose.yml from pr

* added deleting from LND in wallet resolver

* linter + added missing import

* fixed merge conflict

* refine invoice deletion

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-02-14 17:31:25 -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
ekzyis 0c3be0cd08
Fix saloon comments hidden in profile (#831) 2024-02-14 11:58:29 -06:00
keyan 2ce2580e8e fix posts not showing up in bookmarks 2024-02-14 09:12:00 -06:00
keyan a6aebd7004 fix comment bookmarks 2024-02-13 16:22:36 -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
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
Noah 02278c6073
Improved ux for domain only searches (#782)
* improves ux for url only searches

* updates with sn nym

* add back original implementation when query has more than url: filter

* eliminates use of wildcards

* adds docs for testing search in a way that more closely resembles prod

* fixes lint issues

---------

Co-authored-by: utanapishtim <utnapishtim.utanapishtim@gmail.com>
2024-02-07 18:45:11 -06:00
ekzyis 46eeb729c3 Fix pinned items don't show up in home 2024-02-04 22:15:18 +01:00
keyan c23f1f82bc allow pins to be zapped but not from pin position 2024-02-03 15:27:36 -06:00
mzivil 986ba582e5 fix lint errors 2024-02-02 16:06:33 -05:00
mzivil 7ff02ebe30 rename mutated hostname and pathname variables to avoid confusion 2024-02-02 15:57:34 -05:00
mzivil db7c4c3d76 rename uri to uriRegex to avoid confusion 2024-02-02 15:50:18 -05:00
mzivil 99e547e6ae fix all hacker news and bitcoin talk links showing up as dupes
It looks like a regression was introduced at some point, because
the `uri` that's compared against the `whitelist` is a regular
expression and not the url hostname + pathname as it was originally
written.

This brings back the original behavior of comparing the whitelist
against the hostname + pathname
2024-02-02 15:46:30 -05:00
mzivil 068f1e9eba use stripTrailingSlash for uriRegex in dupes 2024-02-02 15:45:49 -05:00
mzivil 4076727ed3 fix yewtu.be links showing up as dupes of each other 2024-02-02 12:43:24 -05:00
benthecarman e4c1c9bade
Remove description hash check for lnurl 2024-01-31 12:21:26 +00: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 d8f4071afb refine serialization retries 2024-01-28 13:26:32 -06:00
ekzyis 4bc0a930b3
Fix image deletion batch size (#769) 2024-01-28 12:29:56 -06:00
keyan eb99fcef9e improve stat gathering 2024-01-19 15:19:26 -06:00
keyan c41ad5d469 fix for 404 on empty search results 2024-01-19 15:12:47 -06:00
keyan 61a66127d1 search/related posts refinements 2024-01-17 17:39:48 -06:00
keyan fe5991112e support query quoting for exact matches 2024-01-16 20:01:06 -06:00
keyan 9af3388353 semantic search 2024-01-15 17:22:57 -06:00
ekzyis b7413e9e32 Fix 'column Item.day does not exist' 2024-01-14 19:10:31 +01:00
ekzyis 40f2697675 Disallow automated withdrawals to same node 2024-01-13 17:32:54 +01:00
keyan 09f459b569 fix fee percent type error 2024-01-12 23:47:05 -06:00
keyan b530b611f5 disable self sends in autowithdraw 2024-01-12 09:37:50 -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
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 39c9775c4c
Fix TypeError on item creation if JIT invoicing is used (#744)
* Fix TypeError on item creation if JIT invoicing is used

* Fix bad if body

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-01-10 19:24:49 -06:00